From 81ee8886ceb64fecff74655cb971966cb88295d7 Mon Sep 17 00:00:00 2001 From: Tim Klocke Date: Wed, 9 Oct 2019 10:24:54 +0200 Subject: [PATCH] backends: Update inhibited state for the monitor and respect that state The inhibited state of the monitor was after the initializiation never updated. meta_idle_monitor_reset_idletime didn't respect the inhibited state, so it set timeouts if it shouldn't have. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/573 --- src/backends/meta-idle-monitor.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c index 9fa481742..2ff1602e7 100644 --- a/src/backends/meta-idle-monitor.c +++ b/src/backends/meta-idle-monitor.c @@ -207,6 +207,8 @@ update_inhibited (MetaIdleMonitor *monitor, if (inhibited == monitor->inhibited) return; + monitor->inhibited = inhibited; + g_hash_table_foreach (monitor->watches, update_inhibited_watch, monitor); @@ -516,9 +518,16 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor) } else { - g_source_set_ready_time (watch->timeout_source, - monitor->last_event_time + - watch->timeout_msec * 1000); + if (monitor->inhibited) + { + g_source_set_ready_time (watch->timeout_source, -1); + } + else + { + g_source_set_ready_time (watch->timeout_source, + monitor->last_event_time + + watch->timeout_msec * 1000); + } } }