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
|
--- src/xss-lock.c.orig 2015-01-15 10:34:31.469611430 +0100
+++ src/xss-lock.c 2015-01-15 15:51:45.360306124 +0100
@@ -61,6 +61,7 @@
static gboolean opt_quiet = FALSE;
static gboolean opt_verbose = FALSE;
static gboolean opt_ignore_sleep = FALSE;
+static gboolean opt_ignore_blank = FALSE;
static gboolean opt_print_version = FALSE;
static GOptionEntry opt_entries[] = {
@@ -68,6 +69,7 @@
{"notifier", 'n', G_OPTION_FLAG_FILENAME, G_OPTION_ARG_CALLBACK, parse_notifier_cmd, "Send notification using CMD", "CMD"},
{"transfer-sleep-lock", 'l', 0, G_OPTION_ARG_NONE, &locker.transfer_sleep_lock_fd, "Pass sleep delay lock file descriptor to locker", NULL},
{"ignore-sleep", 0, 0, G_OPTION_ARG_NONE, &opt_ignore_sleep, "Do not lock on suspend/hibernate", NULL},
+ {"ignore-blank", 0, 0, G_OPTION_ARG_NONE, &opt_ignore_blank, "Do not lock on screensaver events", NULL},
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &opt_quiet, "Output only fatal errors", NULL},
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose, "Output more messages", NULL},
{"version", 0, 0, G_OPTION_ARG_NONE, &opt_print_version, "Print version number and exit", NULL},
@@ -170,34 +172,36 @@
xcb_screensaver_notify_event_t *xss_event =
(xcb_screensaver_notify_event_t *)event;
- switch (xss_event->state) {
- case XCB_SCREENSAVER_STATE_ON:
- if (xss_event->kind == XCB_SCREENSAVER_KIND_INTERNAL)
- /* According to the original protocol, this forces the external
- * saver (i.e., me) to be started after deactivating the
- * internal saver, which may be started if the server is
- * grabbed when the saver activates, but Xorg does not seem to
- * work that way; I'm leaving this in anyway.
- */
- xcb_force_screen_saver(connection, XCB_SCREEN_SAVER_ACTIVE);
- else if (!notifier.cmd || xss_event->forced) {
- start_child(&locker);
- logind_session_set_idle_hint(TRUE);
- } else if (!locker.pid)
- start_child(¬ifier);
- else
- logind_session_set_idle_hint(TRUE);
- break;
- case XCB_SCREENSAVER_STATE_OFF:
- kill_child(¬ifier);
- logind_session_set_idle_hint(FALSE);
- break;
- case XCB_SCREENSAVER_STATE_CYCLE:
- if (!locker.pid) {
- logind_session_set_idle_hint(TRUE);
- start_child(&locker);
- }
- break;
+ if (!opt_ignore_blank) {
+ switch (xss_event->state) {
+ case XCB_SCREENSAVER_STATE_ON:
+ if (xss_event->kind == XCB_SCREENSAVER_KIND_INTERNAL)
+ /* According to the original protocol, this forces the external
+ * saver (i.e., me) to be started after deactivating the
+ * internal saver, which may be started if the server is
+ * grabbed when the saver activates, but Xorg does not seem to
+ * work that way; I'm leaving this in anyway.
+ */
+ xcb_force_screen_saver(connection, XCB_SCREEN_SAVER_ACTIVE);
+ else if (!notifier.cmd || xss_event->forced) {
+ start_child(&locker);
+ logind_session_set_idle_hint(TRUE);
+ } else if (!locker.pid)
+ start_child(¬ifier);
+ else
+ logind_session_set_idle_hint(TRUE);
+ break;
+ case XCB_SCREENSAVER_STATE_OFF:
+ kill_child(¬ifier);
+ logind_session_set_idle_hint(FALSE);
+ break;
+ case XCB_SCREENSAVER_STATE_CYCLE:
+ if (!locker.pid) {
+ logind_session_set_idle_hint(TRUE);
+ start_child(&locker);
+ }
+ break;
+ }
}
}
return TRUE;
|