Skip to content

Commit

Permalink
Rename XSECURELOCK_SAVER_STOP_ON_DPMS (#157)
Browse files Browse the repository at this point in the history
The correct name should be XSECURELOCK_SAVER_STOP_ON_BLANK. We also
starts children when screensaver is on, but screen is not blanked, or
when screensaver is one and screen is blanked, but this option is not
enabled.
  • Loading branch information
vincentbernat authored Jul 21, 2023
1 parent 15e9b01 commit 8a448bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ Options to XSecureLock can be passed by environment variables:
* `XSECURELOCK_SAVER_DELAY_MS`: Milliseconds to wait after starting
children process and before mapping windows to let children be
ready to display and reduce the black flash.
* `XSECURELOCK_SAVER_STOP_ON_DPMS`: specifies if saver is stopped
when DPMS blanks the screen (to save power).
* `XSECURELOCK_SAVER_STOP_ON_BLANK`: specifies if saver is stopped
when screen is blanked (DPMS or XSS) to save power.
* `XSECURELOCK_XSCREENSAVER_PATH`: Location where XScreenSaver hacks are
installed for use by `saver_xscreensaver`.
Expand Down
10 changes: 5 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,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;
Expand Down Expand Up @@ -443,7 +443,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.
Expand Down Expand Up @@ -1110,7 +1110,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);
Expand Down Expand Up @@ -1174,7 +1174,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,
Expand Down

0 comments on commit 8a448bd

Please sign in to comment.