forked from google/xsecurelock
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxautolock.patch
138 lines (129 loc) · 4.55 KB
/
xautolock.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
diff --color -urBb xautolock-2.2-orig/Imakefile xautolock-2.2/Imakefile
--- xautolock-2.2-orig/Imakefile 2001-05-06 07:44:58.000000000 -0700
+++ xautolock-2.2/Imakefile 2020-10-28 03:02:33.725485219 -0700
@@ -5,11 +5,7 @@
/*
* Tell it what extensions to use.
*/
-#ifndef HPArchitecture
#define HasScreenSaver 1 /* By default assume to have MIT ScreenSaver, */
-#else
-#define HasScreenSaver 0 /* except on HP machines (sigh...) */
-#endif
#define HasXidle 0 /* By default assume not to have Xidle. */
diff --color -urBb xautolock-2.2-orig/include/config.h xautolock-2.2/include/config.h
--- xautolock-2.2-orig/include/config.h 2007-09-30 14:27:49.000000000 -0700
+++ xautolock-2.2/include/config.h 2020-10-28 03:03:34.741093553 -0700
@@ -65,6 +65,7 @@
#ifdef HasScreenSaver
#include <X11/extensions/scrnsaver.h>
+#include <X11/extensions/dpms.h>
#endif /* HasScreenSaver */
#ifndef HasVFork
Only in xautolock-2.2: Makefile
Only in xautolock-2.2/src: diy.o
diff --color -urBb xautolock-2.2-orig/src/engine.c xautolock-2.2/src/engine.c
--- xautolock-2.2-orig/src/engine.c 2007-12-28 09:15:26.000000000 -0800
+++ xautolock-2.2/src/engine.c 2020-10-28 03:03:44.031186178 -0700
@@ -31,7 +31,10 @@
void
queryIdleTime (Display* d, Bool use_xidle)
{
- Time idleTime = 0; /* millisecs since last input event */
+ int dummy;
+ CARD16 standby, suspend, off;
+ CARD16 state;
+ BOOL onoff; Time idleTime = 0; /* millisecs since last input event */
#ifdef HasXidle
if (use_xidle)
@@ -49,6 +52,33 @@
#endif /* HasScreenSaver */
}
+ if (DPMSQueryExtension(d, &dummy, &dummy)) {
+ if (DPMSCapable(d)) {
+ DPMSGetTimeouts(d, &standby, &suspend, &off);
+ DPMSInfo(d, &state, &onoff);
+
+ if (onoff) {
+ switch (state) {
+ case DPMSModeStandby:
+ if (idleTime < (unsigned) (standby * 1000))
+ idleTime += (standby * 1000);
+ break;
+ case DPMSModeSuspend:
+ if (idleTime < (unsigned) ((suspend + standby) * 1000))
+ idleTime += ((suspend + standby) * 1000);
+ break;
+ case DPMSModeOff:
+ if (idleTime < (unsigned) ((off + suspend + standby) * 1000))
+ idleTime += ((off + suspend + standby) * 1000);
+ break;
+ case DPMSModeOn:
+ default:
+ break;
+ }
+ }
+ }
+ }
+
if (idleTime < 1000)
{
resetTriggers ();
@@ -210,7 +240,7 @@
#else /* VMS */
if (lockerPid)
{
-#if !defined (UTEKV) && !defined (SYSV) && !defined (SVR4)
+#if !defined (UTEKV) && !defined (SYSV) && !defined (SVR4) && !defined (__GLIBC__)
union wait status; /* childs process status */
#else /* !UTEKV && !SYSV && !SVR4 */
int status = 0; /* childs process status */
@@ -221,7 +251,7 @@
(void) kill (lockerPid, SIGTERM);
}
-#if !defined (UTEKV) && !defined (SYSV) && !defined (SVR4)
+#if !defined (UTEKV) && !defined (SYSV) && !defined (SVR4) && !defined (__GLIBC__)
if (wait3 (&status, WNOHANG, 0))
#else /* !UTEKV && !SYSV && !SVR4 */
if (waitpid (-1, &status, WNOHANG))
Only in xautolock-2.2/src: engine.o
Only in xautolock-2.2/src: message.o
diff --color -urBb xautolock-2.2-orig/src/options.c xautolock-2.2/src/options.c
--- xautolock-2.2-orig/src/options.c 2007-09-30 14:30:45.000000000 -0700
+++ xautolock-2.2/src/options.c 2020-10-28 03:03:12.859875393 -0700
@@ -255,6 +255,8 @@
* actually consists of multiple ones, we need to look for `;'
* characters first. We can only err on the safe side here...
*/
+ /* FIXME: This would also need to handle other stuff like e.g. & */
+#if 0
if (!strchr (*command, ';'))
{
char* tmp;
@@ -262,6 +264,14 @@
"exec %s", *command);
*command = tmp;
}
+#else
+ /* Create a copy of the string or else XrmDestroyDatabase would free() that
+ * string from underneath us.
+ */
+ char* tmp = newArray (char, strlen (*command) + 1);
+ (void) strcpy (tmp, *command);
+ *command = tmp;
+#endif
}
#endif /* !VMS */
Only in xautolock-2.2/src: options.o
Only in xautolock-2.2/src: state.o
Only in xautolock-2.2/src: xautolock.o
Only in xautolock-2.2: xautolock
Only in xautolock-2.2: xautolock._man
diff --color -urBb xautolock-2.2-orig/xautolock.man xautolock-2.2/xautolock.man
--- xautolock-2.2-orig/xautolock.man 2007-12-28 09:05:40.000000000 -0800
+++ xautolock-2.2/xautolock.man 2020-10-28 03:02:25.122399444 -0700
@@ -1,4 +1,4 @@
-.TH xautolock l "December 28, 2007"
+.TH xautolock 1 "December 28, 2007"
.SH NAME
xautolock \- fire up programs in case of user inactivity under X