From 87c3b0cd6bca0220c6e4c18640c5660abc5694b6 Mon Sep 17 00:00:00 2001 From: Jake Ob Date: Sun, 6 Aug 2023 17:39:10 +0300 Subject: [PATCH] Pull changes from google#157 --- README.md | 6 +++--- main.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 47dbc0a..bd721e9 100644 --- a/README.md +++ b/README.md @@ -142,9 +142,9 @@ Options to xsecurelock can be passed by environment variables:  `0`: Do not reset the saver module, set as default.
 `1`: Reset the saver module.
- `XSECURELOCK_SAVER_STOP_ON_DPMS`: Specifies if saver is stopped when DPMS blanks the screen:
-  `0`: Do not stop when DPMS blanks the screen.
-  `1`: Stop when DPMS blanks the screen, set as default.
+ `XSECURELOCK_SAVER_STOP_ON_BLANK`: Specifies if saver is stopped when screen is blanked (DPMS or XSS):
+  `0`: Do not stop saver when screen is blanked.
+  `1`: Stop saver when screen is blanked, set as default.
`XSECURELOCK_GLOBAL_SAVER`: Specifies the desired global screen saver module (by default this is a multiplexer that runs `XSECURELOCK_SAVER` on each screen).
diff --git a/main.c b/main.c index 0e2b67b..8025068 100644 --- a/main.c +++ b/main.c @@ -150,8 +150,8 @@ const char *blank_dpms_state = "off"; int saver_reset_on_auth_close = 0; //! Delay we should wait before starting mapping windows to let children run. int saver_delay_ms = 0; -//! Whetever stopping saver when DPMS is running -int saver_stop_on_dpms = 0; +//! Whetever stopping saver when screen is blanked +int saver_stop_on_blank = 0; //! The PID of a currently running notify command, or 0 if none is running. pid_t notify_command_pid = 0; @@ -439,7 +439,7 @@ void LoadDefaults() { saver_reset_on_auth_close = GetIntSetting("XSECURELOCK_SAVER_RESET_ON_AUTH_CLOSE", 0); saver_delay_ms = GetIntSetting("XSECURELOCK_SAVER_DELAY_MS", 0); - saver_stop_on_dpms = GetIntSetting("XSECURELOCK_SAVER_STOP_ON_DPMS", 1); + saver_stop_on_blank = GetIntSetting("XSECURELOCK_SAVER_STOP_ON_BLANK", 1); } /*! \brief Parse the command line arguments, or exit in case of failure. @@ -1106,7 +1106,7 @@ int main(int argc, char **argv) { if (scrnsaver_event_base != 0) { XScreenSaverInfo *info = XScreenSaverAllocInfo(); XScreenSaverQueryInfo(display, root_window, info); - if (info->state == ScreenSaverOn) { + if (info->state == ScreenSaverOn && info->kind == ScreenSaverBlanked && saver_stop_on_blank) { xss_requested_saver_state = WATCH_CHILDREN_SAVER_DISABLED; } XFree(info); @@ -1170,7 +1170,7 @@ int main(int argc, char **argv) { // Make sure to shut down the saver when blanked. Saves power. enum WatchChildrenState requested_saver_state = - (saver_stop_on_dpms && blanked) ? WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state; + (saver_stop_on_blank && blanked) ? WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state; // Now check status of our children. if (WatchChildren(display, auth_window, saver_window, requested_saver_state,