Skip to content

Commit f990c30

Browse files
committed
Make sure pending resume commands still get run regardless of logind idle inhibitors
1 parent e81d40f commit f990c30

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
@@ -605,7 +605,9 @@ static void enable_timeouts(void) {
605605
state.timeouts_enabled = true;
606606
struct swayidle_timeout_cmd *cmd;
607607
wl_list_for_each(cmd, &state.timeout_cmds, link) {
608-
register_timeout(cmd, cmd->timeout);
608+
if (cmd->idle_timer == NULL || !cmd->resume_pending) {
609+
register_timeout(cmd, cmd->timeout);
610+
}
609611
}
610612
}
611613

@@ -619,7 +621,9 @@ static void disable_timeouts(void) {
619621
state.timeouts_enabled = false;
620622
struct swayidle_timeout_cmd *cmd;
621623
wl_list_for_each(cmd, &state.timeout_cmds, link) {
622-
destroy_cmd_timer(cmd);
624+
if (!cmd->resume_pending) {
625+
destroy_cmd_timer(cmd);
626+
}
623627
}
624628
if (state.logind_idlehint) {
625629
set_idle_hint(false);
@@ -645,7 +649,9 @@ static void handle_resume(void *data, struct org_kde_kwin_idle_timeout *timer) {
645649
struct swayidle_timeout_cmd *cmd = data;
646650
cmd->resume_pending = false;
647651
swayidle_log(LOG_DEBUG, "active state");
648-
if (cmd->registered_timeout != cmd->timeout) {
652+
if (!state.timeouts_enabled) {
653+
destroy_cmd_timer(cmd);
654+
} else if (cmd->registered_timeout != cmd->timeout) {
649655
register_timeout(cmd, cmd->timeout);
650656
}
651657
#if HAVE_SYSTEMD || HAVE_ELOGIND

0 commit comments

Comments
 (0)