mirror of
https://github.com/mintycube/slock.git
synced 2024-10-22 14:05:51 +02:00
Fix bug in DPMS patch + moved patches.h to patches.def.h to match that of config
This commit is contained in:
parent
4c905a9c07
commit
2445d75b5d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
*.o
|
*.o
|
||||||
dwm
|
dwm
|
||||||
config.h
|
config.h
|
||||||
|
patches.h
|
||||||
|
6
Makefile
6
Makefile
@ -18,12 +18,16 @@ options:
|
|||||||
@echo CC $<
|
@echo CC $<
|
||||||
@${CC} -c ${CFLAGS} $<
|
@${CC} -c ${CFLAGS} $<
|
||||||
|
|
||||||
${OBJ}: config.h config.mk arg.h util.h
|
${OBJ}: config.h config.mk arg.h util.h patches.h
|
||||||
|
|
||||||
config.h:
|
config.h:
|
||||||
@echo creating $@ from config.def.h
|
@echo creating $@ from config.def.h
|
||||||
@cp config.def.h $@
|
@cp config.def.h $@
|
||||||
|
|
||||||
|
patches.h:
|
||||||
|
@echo creating $@ from patches.def.h
|
||||||
|
@cp patches.def.h $@
|
||||||
|
|
||||||
slock: ${OBJ}
|
slock: ${OBJ}
|
||||||
@echo CC -o $@
|
@echo CC -o $@
|
||||||
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#include <X11/extensions/dpms.h>
|
|
||||||
|
|
||||||
static void
|
|
||||||
monitorreset(Display* dpy, CARD16 standby, CARD16 suspend, CARD16 off)
|
|
||||||
{
|
|
||||||
DPMSSetTimeouts(dpy, standby, suspend, off);
|
|
||||||
DPMSForceLevel(dpy, DPMSModeOn);
|
|
||||||
XFlush(dpy);
|
|
||||||
}
|
|
@ -1,8 +1,4 @@
|
|||||||
/* Patches */
|
/* Patches */
|
||||||
#if DPMS_PATCH
|
|
||||||
#include "dpms.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MESSAGE_PATCH
|
#if MESSAGE_PATCH
|
||||||
#include "message.c"
|
#include "message.c"
|
||||||
#endif
|
#endif
|
||||||
|
19
slock.c
19
slock.c
@ -29,6 +29,9 @@
|
|||||||
#if QUICKCANCEL_PATCH
|
#if QUICKCANCEL_PATCH
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif // QUICKCANCEL_PATCH
|
#endif // QUICKCANCEL_PATCH
|
||||||
|
#if DPMS_PATCH
|
||||||
|
#include <X11/extensions/dpms.h>
|
||||||
|
#endif // DPMS_PATCH
|
||||||
|
|
||||||
#include "arg.h"
|
#include "arg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -542,7 +545,7 @@ main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
#if DPMS_PATCH
|
#if DPMS_PATCH
|
||||||
/* DPMS-magic to disable the monitor */
|
/* DPMS magic to disable the monitor */
|
||||||
if (!DPMSCapable(dpy))
|
if (!DPMSCapable(dpy))
|
||||||
die("slock: DPMSCapable failed\n");
|
die("slock: DPMSCapable failed\n");
|
||||||
if (!DPMSEnable(dpy))
|
if (!DPMSEnable(dpy))
|
||||||
@ -550,11 +553,11 @@ main(int argc, char **argv) {
|
|||||||
if (!DPMSGetTimeouts(dpy, &standby, &suspend, &off))
|
if (!DPMSGetTimeouts(dpy, &standby, &suspend, &off))
|
||||||
die("slock: DPMSGetTimeouts failed\n");
|
die("slock: DPMSGetTimeouts failed\n");
|
||||||
if (!standby || !suspend || !off)
|
if (!standby || !suspend || !off)
|
||||||
/* set values if there arent some */
|
die("slock: at least one DPMS variable is zero\n");
|
||||||
standby = suspend = off = 300;
|
if (!DPMSSetTimeouts(dpy, monitortime, monitortime, monitortime))
|
||||||
|
die("slock: DPMSSetTimeouts failed\n");
|
||||||
|
|
||||||
DPMSSetTimeouts(dpy, monitortime, monitortime, monitortime);
|
XSync(dpy, 0);
|
||||||
XFlush(dpy);
|
|
||||||
#endif // DPMS_PATCH
|
#endif // DPMS_PATCH
|
||||||
|
|
||||||
/* run post-lock command */
|
/* run post-lock command */
|
||||||
@ -563,9 +566,6 @@ main(int argc, char **argv) {
|
|||||||
case -1:
|
case -1:
|
||||||
die("slock: fork failed: %s\n", strerror(errno));
|
die("slock: fork failed: %s\n", strerror(errno));
|
||||||
case 0:
|
case 0:
|
||||||
#if DPMS_PATCH
|
|
||||||
monitorreset(dpy, standby, suspend, off);
|
|
||||||
#endif // DPMS_PATCH
|
|
||||||
if (close(ConnectionNumber(dpy)) < 0)
|
if (close(ConnectionNumber(dpy)) < 0)
|
||||||
die("slock: close: %s\n", strerror(errno));
|
die("slock: close: %s\n", strerror(errno));
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
@ -578,7 +578,8 @@ main(int argc, char **argv) {
|
|||||||
readpw(dpy, &rr, locks, nscreens, hash);
|
readpw(dpy, &rr, locks, nscreens, hash);
|
||||||
#if DPMS_PATCH
|
#if DPMS_PATCH
|
||||||
/* reset DPMS values to inital ones */
|
/* reset DPMS values to inital ones */
|
||||||
monitorreset(dpy, standby, suspend, off);
|
DPMSSetTimeouts(dpy, standby, suspend, off);
|
||||||
|
XSync(dpy, 0);
|
||||||
#endif // DPMS_PATCH
|
#endif // DPMS_PATCH
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user