Skip to content

Commit ff8fbc3

Browse files
committed
Make sure pending resume commands still get run regardless of logind idle inhibitors
1 parent 4b9e70c commit ff8fbc3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

main.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@ static void enable_timeouts(void) {
623623
state.timeouts_enabled = true;
624624
struct swayidle_timeout_cmd *cmd;
625625
wl_list_for_each(cmd, &state.timeout_cmds, link) {
626-
register_timeout(cmd, cmd->timeout);
626+
if (cmd->idle_timer == NULL || !cmd->resume_pending) {
627+
register_timeout(cmd, cmd->timeout);
628+
}
627629
}
628630
}
629631

@@ -637,7 +639,9 @@ static void disable_timeouts(void) {
637639
state.timeouts_enabled = false;
638640
struct swayidle_timeout_cmd *cmd;
639641
wl_list_for_each(cmd, &state.timeout_cmds, link) {
640-
destroy_cmd_timer(cmd);
642+
if (!cmd->resume_pending) {
643+
destroy_cmd_timer(cmd);
644+
}
641645
}
642646
if (state.logind_idlehint) {
643647
set_idle_hint(false);
@@ -661,7 +665,9 @@ static void handle_idled(struct swayidle_timeout_cmd *cmd) {
661665
static void handle_resumed(struct swayidle_timeout_cmd *cmd) {
662666
cmd->resume_pending = false;
663667
swayidle_log(LOG_DEBUG, "active state");
664-
if (cmd->registered_timeout != cmd->timeout) {
668+
if (!state.timeouts_enabled) {
669+
destroy_cmd_timer(cmd);
670+
} else if (cmd->registered_timeout != cmd->timeout) {
665671
register_timeout(cmd, cmd->timeout);
666672
}
667673
#if HAVE_SYSTEMD || HAVE_ELOGIND

0 commit comments

Comments
 (0)