mirror of
https://github.com/mintycube/slock.git
synced 2024-10-22 14:05:51 +02:00
Adding dwmlogo patch ref. #5
This commit is contained in:
parent
e5a9d8539b
commit
e5e04272d1
@ -26,6 +26,8 @@ slock tool, how to install it and how it works.
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2021-09-13 - Added the dwm logo patch
|
||||||
|
|
||||||
2021-09-09 - Added the auto-timeout, failure-command and secret-password patches
|
2021-09-09 - Added the auto-timeout, failure-command and secret-password patches
|
||||||
|
|
||||||
2021-06-08 - Added the color message patch
|
2021-06-08 - Added the color message patch
|
||||||
@ -69,6 +71,9 @@ slock tool, how to install it and how it works.
|
|||||||
- the monitor will automatically be activated by pressing a key or moving the mouse and the
|
- the monitor will automatically be activated by pressing a key or moving the mouse and the
|
||||||
password can be entered then
|
password can be entered then
|
||||||
|
|
||||||
|
- [dwmlogo](https://tools.suckless.org/slock/patches/dwmlogo/)
|
||||||
|
- draws the dwm logo which changes color based on the state
|
||||||
|
|
||||||
- [failure-command](https://tools.suckless.org/slock/patches/failure-command/)
|
- [failure-command](https://tools.suckless.org/slock/patches/failure-command/)
|
||||||
- allows for a command to be run after a specified number of incorrect attempts
|
- allows for a command to be run after a specified number of incorrect attempts
|
||||||
|
|
||||||
|
30
config.def.h
30
config.def.h
@ -3,6 +3,9 @@ static const char *user = "nobody";
|
|||||||
static const char *group = "nogroup"; // use "nobody" for arch
|
static const char *group = "nogroup"; // use "nobody" for arch
|
||||||
|
|
||||||
static const char *colorname[NUMCOLS] = {
|
static const char *colorname[NUMCOLS] = {
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
[BACKGROUND] = "#2d2d2d", /* after initialization */
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
[INIT] = "black", /* after initialization */
|
[INIT] = "black", /* after initialization */
|
||||||
[INPUT] = "#005577", /* during input */
|
[INPUT] = "#005577", /* during input */
|
||||||
[FAILED] = "#CC3333", /* wrong password */
|
[FAILED] = "#CC3333", /* wrong password */
|
||||||
@ -28,11 +31,34 @@ static const char * text_color = "#ffffff";
|
|||||||
static const char * font_name = "6x10";
|
static const char * font_name = "6x10";
|
||||||
#endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH
|
#endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH
|
||||||
|
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
/* insert grid pattern with scale 1:1, the size can be changed with logosize */
|
||||||
|
static const int logosize = 75;
|
||||||
|
static const int logow = 12; /* grid width and height for right center alignment*/
|
||||||
|
static const int logoh = 6;
|
||||||
|
|
||||||
|
static XRectangle rectangles[] = {
|
||||||
|
/* x y w h */
|
||||||
|
{ 0, 3, 1, 3 },
|
||||||
|
{ 1, 3, 2, 1 },
|
||||||
|
{ 0, 5, 8, 1 },
|
||||||
|
{ 3, 0, 1, 5 },
|
||||||
|
{ 5, 3, 1, 2 },
|
||||||
|
{ 7, 3, 1, 2 },
|
||||||
|
{ 8, 3, 4, 1 },
|
||||||
|
{ 9, 4, 1, 2 },
|
||||||
|
{ 11, 4, 1, 2 },
|
||||||
|
};
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
|
|
||||||
#if XRESOURCES_PATCH
|
#if XRESOURCES_PATCH
|
||||||
/*
|
/*
|
||||||
* Xresources preferences to load at startup
|
* Xresources preferences to load at startup
|
||||||
*/
|
*/
|
||||||
ResourcePref resources[] = {
|
ResourcePref resources[] = {
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
{ "color2", STRING, &colorname[BACKGROUND] },
|
||||||
|
#endif //DWM_LOGO_PATCH
|
||||||
{ "color0", STRING, &colorname[INIT] },
|
{ "color0", STRING, &colorname[INIT] },
|
||||||
{ "color4", STRING, &colorname[INPUT] },
|
{ "color4", STRING, &colorname[INPUT] },
|
||||||
{ "color1", STRING, &colorname[FAILED] },
|
{ "color1", STRING, &colorname[FAILED] },
|
||||||
@ -87,11 +113,11 @@ static const secretpass scom[] = {
|
|||||||
/* Enable blur */
|
/* Enable blur */
|
||||||
#define BLUR
|
#define BLUR
|
||||||
/* Set blur radius */
|
/* Set blur radius */
|
||||||
static const int blurRadius=5;
|
static const int blurRadius = 5;
|
||||||
/* Enable Pixelation */
|
/* Enable Pixelation */
|
||||||
//#define PIXELATION
|
//#define PIXELATION
|
||||||
/* Set pixelation radius */
|
/* Set pixelation radius */
|
||||||
static const int pixelSize=10;
|
static const int pixelSize = 10;
|
||||||
#endif // BLUR_PIXELATED_SCREEN_PATCH
|
#endif // BLUR_PIXELATED_SCREEN_PATCH
|
||||||
|
|
||||||
#if CONTROLCLEAR_PATCH
|
#if CONTROLCLEAR_PATCH
|
||||||
|
@ -10,21 +10,22 @@ MANPREFIX = ${PREFIX}/share/man
|
|||||||
X11INC = /usr/X11R6/include
|
X11INC = /usr/X11R6/include
|
||||||
X11LIB = /usr/X11R6/lib
|
X11LIB = /usr/X11R6/lib
|
||||||
|
|
||||||
# Uncomment for message patch / MESSAGE_PATCH / COLORMESSAGE_PATCH
|
# Uncomment for message patch / MESSAGE_PATCH / COLORMESSAGE_PATCH / DWM_LOGO_PATCH
|
||||||
#XINERAMA=-lXinerama
|
XINERAMA=-lXinerama
|
||||||
|
XINERAMAFLAGS = -DXINERAMA
|
||||||
|
|
||||||
# Uncomment for pam auth patch / PAMAUTH_PATCH
|
# Uncomment for pam auth patch / PAMAUTH_PATCH
|
||||||
#PAM=-lpam
|
#PAM=-lpam
|
||||||
|
|
||||||
# Uncomment for blur pixelated screen patch / BLUR_PIXELATED_SCREEN_PATCH
|
# Uncomment for blur pixelated screen patch / BLUR_PIXELATED_SCREEN_PATCH
|
||||||
#IMLIB=-lImlib2
|
IMLIB=-lImlib2
|
||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I. -I/usr/include -I${X11INC}
|
INCS = -I. -I/usr/include -I${X11INC}
|
||||||
LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext -lXrandr ${XINERAMA} ${PAM} ${IMLIB}
|
LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext -lXrandr ${XINERAMA} ${PAM} ${IMLIB}
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H
|
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H ${XINERAMAFLAGS}
|
||||||
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
|
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
|
||||||
LDFLAGS = -s ${LIBS}
|
LDFLAGS = -s ${LIBS}
|
||||||
COMPATSRC = explicit_bzero.c
|
COMPATSRC = explicit_bzero.c
|
||||||
|
@ -50,17 +50,17 @@ create_lock_image(Display *dpy)
|
|||||||
pp = &pixel;
|
pp = &pixel;
|
||||||
for (int j = 0; j < pixelSize && j < height; j++) {
|
for (int j = 0; j < pixelSize && j < height; j++) {
|
||||||
for (int i = 0; i < pixelSize && i < width; i++) {
|
for (int i = 0; i < pixelSize && i < width; i++) {
|
||||||
imlib_image_query_pixel(x+i,y+j,pp);
|
imlib_image_query_pixel(x + i, y + j, pp);
|
||||||
red += pixel.red;
|
red += pixel.red;
|
||||||
green += pixel.green;
|
green += pixel.green;
|
||||||
blue += pixel.blue;
|
blue += pixel.blue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
red /= (pixelSize*pixelSize);
|
red /= (pixelSize * pixelSize);
|
||||||
green /= (pixelSize*pixelSize);
|
green /= (pixelSize * pixelSize);
|
||||||
blue /= (pixelSize*pixelSize);
|
blue /= (pixelSize * pixelSize);
|
||||||
imlib_context_set_color(red,green,blue,pixel.alpha);
|
imlib_context_set_color(red, green, blue, pixel.alpha);
|
||||||
imlib_image_fill_rectangle(x,y,pixelSize,pixelSize);
|
imlib_image_fill_rectangle(x, y, pixelSize, pixelSize);
|
||||||
red = 0;
|
red = 0;
|
||||||
green = 0;
|
green = 0;
|
||||||
blue = 0;
|
blue = 0;
|
||||||
|
29
patch/dwmlogo.c
Normal file
29
patch/dwmlogo.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
static void
|
||||||
|
resizerectangles(struct lock *lock)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < LENGTH(rectangles); i++){
|
||||||
|
lock->rectangles[i].x = (rectangles[i].x * logosize)
|
||||||
|
+ lock->xoff + ((lock->mw) / 2) - (logow / 2 * logosize);
|
||||||
|
lock->rectangles[i].y = (rectangles[i].y * logosize)
|
||||||
|
+ lock->yoff + ((lock->mh) / 2) - (logoh / 2 * logosize);
|
||||||
|
lock->rectangles[i].width = rectangles[i].width * logosize;
|
||||||
|
lock->rectangles[i].height = rectangles[i].height * logosize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drawlogo(Display *dpy, struct lock *lock, int color)
|
||||||
|
{
|
||||||
|
#if BLUR_PIXELATED_SCREEN_PATCH
|
||||||
|
lock->drawable = lock->bgmap;
|
||||||
|
#else
|
||||||
|
XSetForeground(dpy, lock->gc, lock->colors[BACKGROUND]);
|
||||||
|
XFillRectangle(dpy, lock->drawable, lock->gc, 0, 0, lock->x, lock->y);
|
||||||
|
#endif // BLUR_PIXELATED_SCREEN_PATCH
|
||||||
|
XSetForeground(dpy, lock->gc, lock->colors[color]);
|
||||||
|
XFillRectangles(dpy, lock->drawable, lock->gc, lock->rectangles, LENGTH(rectangles));
|
||||||
|
XCopyArea(dpy, lock->drawable, lock->win, lock->gc, 0, 0, lock->x, lock->y, 0, 0);
|
||||||
|
XSync(dpy, False);
|
||||||
|
}
|
2
patch/dwmlogo.h
Normal file
2
patch/dwmlogo.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
static void resizerectangles(struct lock *lock);
|
||||||
|
static void drawlogo(Display *dpy, struct lock *lock, int color);
|
@ -9,6 +9,10 @@
|
|||||||
#include "message.c"
|
#include "message.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
#include "dwmlogo.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if KEYPRESS_FEEDBACK_PATCH
|
#if KEYPRESS_FEEDBACK_PATCH
|
||||||
#include "keypress_feedback.c"
|
#include "keypress_feedback.c"
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
#include "blur_pixelated_screen.h"
|
#include "blur_pixelated_screen.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
#include "dwmlogo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PAMAUTH_PATCH
|
#if PAMAUTH_PATCH
|
||||||
#include "pamauth.h"
|
#include "pamauth.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if KEYPRESS_FEEDBACK_PATCH
|
#if KEYPRESS_FEEDBACK_PATCH
|
||||||
#include "keypress_feedback.h"
|
#include "keypress_feedback.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#if XRESOURCES_PATCH
|
|
||||||
#include "xresources.h"
|
|
||||||
#endif
|
#endif
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <X11/Xresource.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -47,6 +48,6 @@ config_init(Display *dpy)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
db = XrmGetStringDatabase(resm);
|
db = XrmGetStringDatabase(resm);
|
||||||
for (p = resources; p < resources + LEN(resources); p++)
|
for (p = resources; p < resources + LENGTH(resources); p++)
|
||||||
resource_load(db, p->name, p->type, p->dst);
|
resource_load(db, p->name, p->type, p->dst);
|
||||||
}
|
}
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
#include <X11/Xresource.h>
|
|
||||||
|
|
||||||
/* macros */
|
|
||||||
#define LEN(a) (sizeof(a) / sizeof(a)[0])
|
|
||||||
|
|
||||||
/* Xresources preferences */
|
|
||||||
enum resource_type {
|
|
||||||
STRING = 0,
|
|
||||||
INTEGER = 1,
|
|
||||||
FLOAT = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
enum resource_type type;
|
|
||||||
void *dst;
|
|
||||||
} ResourcePref;
|
|
@ -65,6 +65,11 @@
|
|||||||
*/
|
*/
|
||||||
#define DPMS_PATCH 0
|
#define DPMS_PATCH 0
|
||||||
|
|
||||||
|
/* This patch draws the dwm logo which changes color based on the state.
|
||||||
|
* https://tools.suckless.org/slock/patches/dwmlogo/
|
||||||
|
*/
|
||||||
|
#define DWM_LOGO_PATCH 0
|
||||||
|
|
||||||
/* This patch allows for a command to be run after a specified number of incorrect attempts.
|
/* This patch allows for a command to be run after a specified number of incorrect attempts.
|
||||||
* https://tools.suckless.org/slock/patches/failure-command/
|
* https://tools.suckless.org/slock/patches/failure-command/
|
||||||
*/
|
*/
|
||||||
|
93
slock.c
93
slock.c
@ -39,6 +39,9 @@
|
|||||||
#if DPMS_PATCH
|
#if DPMS_PATCH
|
||||||
#include <X11/extensions/dpms.h>
|
#include <X11/extensions/dpms.h>
|
||||||
#endif // DPMS_PATCH
|
#endif // DPMS_PATCH
|
||||||
|
#ifdef XINERAMA
|
||||||
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "arg.h"
|
#include "arg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -57,6 +60,9 @@ static time_t locktime;
|
|||||||
#endif // QUICKCANCEL_PATCH
|
#endif // QUICKCANCEL_PATCH
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
#if DWM_LOGO_PATCH && !BLUR_PIXELATED_SCREEN_PATCH
|
||||||
|
BACKGROUND,
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
INIT,
|
INIT,
|
||||||
INPUT,
|
INPUT,
|
||||||
FAILED,
|
FAILED,
|
||||||
@ -72,6 +78,23 @@ enum {
|
|||||||
NUMCOLS
|
NUMCOLS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if XRESOURCES_PATCH
|
||||||
|
/* Xresources preferences */
|
||||||
|
enum resource_type {
|
||||||
|
STRING = 0,
|
||||||
|
INTEGER = 1,
|
||||||
|
FLOAT = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *name;
|
||||||
|
enum resource_type type;
|
||||||
|
void *dst;
|
||||||
|
} ResourcePref;
|
||||||
|
#endif // XRESOURCES_PATCH
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
struct lock {
|
struct lock {
|
||||||
int screen;
|
int screen;
|
||||||
Window root, win;
|
Window root, win;
|
||||||
@ -80,6 +103,13 @@ struct lock {
|
|||||||
Pixmap bgmap;
|
Pixmap bgmap;
|
||||||
#endif // BLUR_PIXELATED_SCREEN_PATCH
|
#endif // BLUR_PIXELATED_SCREEN_PATCH
|
||||||
unsigned long colors[NUMCOLS];
|
unsigned long colors[NUMCOLS];
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
unsigned int x, y;
|
||||||
|
unsigned int xoff, yoff, mw, mh;
|
||||||
|
Drawable drawable;
|
||||||
|
GC gc;
|
||||||
|
XRectangle rectangles[LENGTH(rectangles)];
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
};
|
};
|
||||||
|
|
||||||
#if SECRET_PASSWORD_PATCH
|
#if SECRET_PASSWORD_PATCH
|
||||||
@ -97,7 +127,6 @@ struct xrandr {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#include "patch/include.h"
|
#include "patch/include.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
die(const char *errstr, ...)
|
die(const char *errstr, ...)
|
||||||
@ -377,17 +406,20 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
|
|||||||
#endif // CAPSCOLOR_PATCH
|
#endif // CAPSCOLOR_PATCH
|
||||||
if (running && oldc != color) {
|
if (running && oldc != color) {
|
||||||
for (screen = 0; screen < nscreens; screen++) {
|
for (screen = 0; screen < nscreens; screen++) {
|
||||||
#if BLUR_PIXELATED_SCREEN_PATCH
|
#if DWM_LOGO_PATCH
|
||||||
|
drawlogo(dpy, locks[screen], color);
|
||||||
|
#elif BLUR_PIXELATED_SCREEN_PATCH
|
||||||
if (locks[screen]->bgmap)
|
if (locks[screen]->bgmap)
|
||||||
XSetWindowBackgroundPixmap(dpy, locks[screen]->win, locks[screen]->bgmap);
|
XSetWindowBackgroundPixmap(dpy, locks[screen]->win, locks[screen]->bgmap);
|
||||||
else
|
else
|
||||||
XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[0]);
|
XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[0]);
|
||||||
|
XClearWindow(dpy, locks[screen]->win);
|
||||||
#else
|
#else
|
||||||
XSetWindowBackground(dpy,
|
XSetWindowBackground(dpy,
|
||||||
locks[screen]->win,
|
locks[screen]->win,
|
||||||
locks[screen]->colors[color]);
|
locks[screen]->colors[color]);
|
||||||
#endif // BLUR_PIXELATED_SCREEN_PATCH
|
|
||||||
XClearWindow(dpy, locks[screen]->win);
|
XClearWindow(dpy, locks[screen]->win);
|
||||||
|
#endif // BLUR_PIXELATED_SCREEN_PATCH
|
||||||
#if MESSAGE_PATCH || COLOR_MESSAGE_PATCH
|
#if MESSAGE_PATCH || COLOR_MESSAGE_PATCH
|
||||||
writemessage(dpy, locks[screen]->win, screen);
|
writemessage(dpy, locks[screen]->win, screen);
|
||||||
#endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH
|
#endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH
|
||||||
@ -439,7 +471,12 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
|
|||||||
XColor color, dummy;
|
XColor color, dummy;
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
Cursor invisible;
|
Cursor invisible;
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
#ifdef XINERAMA
|
||||||
|
XineramaScreenInfo *info;
|
||||||
|
int n;
|
||||||
|
#endif
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
#if AUTO_TIMEOUT_PATCH
|
#if AUTO_TIMEOUT_PATCH
|
||||||
time(&lasttouched);
|
time(&lasttouched);
|
||||||
#endif // AUTO_TIMEOUT_PATCH
|
#endif // AUTO_TIMEOUT_PATCH
|
||||||
@ -460,12 +497,43 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
|
|||||||
lock->colors[i] = color.pixel;
|
lock->colors[i] = color.pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
lock->x = DisplayWidth(dpy, lock->screen);
|
||||||
|
lock->y = DisplayHeight(dpy, lock->screen);
|
||||||
|
#ifdef XINERAMA
|
||||||
|
if ((info = XineramaQueryScreens(dpy, &n))) {
|
||||||
|
lock->xoff = info[0].x_org;
|
||||||
|
lock->yoff = info[0].y_org;
|
||||||
|
lock->mw = info[0].width;
|
||||||
|
lock->mh = info[0].height;
|
||||||
|
} else
|
||||||
|
#endif // XINERAMA
|
||||||
|
{
|
||||||
|
lock->xoff = lock->yoff = 0;
|
||||||
|
lock->mw = lock->x;
|
||||||
|
lock->mh = lock->y;
|
||||||
|
}
|
||||||
|
lock->drawable = XCreatePixmap(dpy, lock->root, lock->x, lock->y, DefaultDepth(dpy, screen));
|
||||||
|
lock->gc = XCreateGC(dpy, lock->root, 0, NULL);
|
||||||
|
XSetLineAttributes(dpy, lock->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
wa.override_redirect = 1;
|
wa.override_redirect = 1;
|
||||||
|
#if DWM_LOGO_PATCH && BLUR_PIXELATED_SCREEN_PATCH
|
||||||
|
#elif DWM_LOGO_PATCH
|
||||||
|
wa.background_pixel = lock->colors[BACKGROUND];
|
||||||
|
#else
|
||||||
wa.background_pixel = lock->colors[INIT];
|
wa.background_pixel = lock->colors[INIT];
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
lock->win = XCreateWindow(dpy, lock->root, 0, 0,
|
lock->win = XCreateWindow(dpy, lock->root, 0, 0,
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
lock->x,
|
||||||
|
lock->y,
|
||||||
|
#else
|
||||||
DisplayWidth(dpy, lock->screen),
|
DisplayWidth(dpy, lock->screen),
|
||||||
DisplayHeight(dpy, lock->screen),
|
DisplayHeight(dpy, lock->screen),
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
0, DefaultDepth(dpy, lock->screen),
|
0, DefaultDepth(dpy, lock->screen),
|
||||||
CopyFromParent,
|
CopyFromParent,
|
||||||
DefaultVisual(dpy, lock->screen),
|
DefaultVisual(dpy, lock->screen),
|
||||||
@ -479,6 +547,10 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
|
|||||||
&color, &color, 0, 0);
|
&color, &color, 0, 0);
|
||||||
XDefineCursor(dpy, lock->win, invisible);
|
XDefineCursor(dpy, lock->win, invisible);
|
||||||
|
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
resizerectangles(lock);
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
|
|
||||||
/* Try to grab mouse pointer *and* keyboard for 600ms, else fail the lock */
|
/* Try to grab mouse pointer *and* keyboard for 600ms, else fail the lock */
|
||||||
for (i = 0, ptgrab = kbgrab = -1; i < 6; i++) {
|
for (i = 0, ptgrab = kbgrab = -1; i < 6; i++) {
|
||||||
if (ptgrab != GrabSuccess) {
|
if (ptgrab != GrabSuccess) {
|
||||||
@ -510,6 +582,9 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
|
|||||||
#if QUICKCANCEL_PATCH
|
#if QUICKCANCEL_PATCH
|
||||||
locktime = time(NULL);
|
locktime = time(NULL);
|
||||||
#endif // QUICKCANCEL_PATCH
|
#endif // QUICKCANCEL_PATCH
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
drawlogo(dpy, lock, INIT);
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
#if ALPHA_PATCH
|
#if ALPHA_PATCH
|
||||||
unsigned int opacity = (unsigned int)(alpha * 0xffffffff);
|
unsigned int opacity = (unsigned int)(alpha * 0xffffffff);
|
||||||
XChangeProperty(dpy, lock->win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&opacity, 1L);
|
XChangeProperty(dpy, lock->win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&opacity, 1L);
|
||||||
@ -696,5 +771,15 @@ main(int argc, char **argv) {
|
|||||||
XSync(dpy, 0);
|
XSync(dpy, 0);
|
||||||
#endif // DPMS_PATCH
|
#endif // DPMS_PATCH
|
||||||
|
|
||||||
|
#if DWM_LOGO_PATCH
|
||||||
|
for (nlocks = 0, s = 0; s < nscreens; s++) {
|
||||||
|
XFreePixmap(dpy, locks[s]->drawable);
|
||||||
|
XFreeGC(dpy, locks[s]->gc);
|
||||||
|
}
|
||||||
|
|
||||||
|
XSync(dpy, 0);
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
#endif // DWM_LOGO_PATCH
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user