Blame SOURCES/0002-idle-monitor-Postpone-dispatching-of-idle-timeout-if.patch

61bfcb
From 22879378393c21a1a1e5307dc457233bd40ef877 Mon Sep 17 00:00:00 2001
61bfcb
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
61bfcb
Date: Tue, 16 Apr 2019 18:07:31 +0200
61bfcb
Subject: [PATCH 2/2] idle-monitor: Postpone dispatching of idle timeout if not
61bfcb
 ready
61bfcb
61bfcb
If we update the ready time while the source is already in the
61bfcb
to-dispatch list, changing the ready time doesn't have any effect, and
61bfcb
the source will still be dispatched. This could cause incorrect idle
61bfcb
watch firing causing the power management plugin in
61bfcb
gnome-settings-daemon to sometimes turn off monitors due to it believing
61bfcb
the user had been idle for some time, while in fact, they just logged
61bfcb
back in.
61bfcb
61bfcb
Fix this by not actually dispatching the idle timeout if the ready time
61bfcb
is in the future when actually dispatching.
61bfcb
---
61bfcb
 src/backends/meta-idle-monitor.c | 7 +++++++
61bfcb
 1 file changed, 7 insertions(+)
61bfcb
61bfcb
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
61bfcb
index 2b634f59a..2c06ee73c 100644
61bfcb
--- a/src/backends/meta-idle-monitor.c
61bfcb
+++ b/src/backends/meta-idle-monitor.c
61bfcb
@@ -311,6 +311,13 @@ idle_monitor_dispatch_timeout (GSource     *source,
61bfcb
                                gpointer     user_data)
61bfcb
 {
61bfcb
   MetaIdleMonitorWatch *watch = (MetaIdleMonitorWatch *) user_data;
61bfcb
+  int64_t now;
61bfcb
+  int64_t ready_time;
61bfcb
+
61bfcb
+  now = g_source_get_time (source);
61bfcb
+  ready_time = g_source_get_ready_time (source);
61bfcb
+  if (ready_time > now)
61bfcb
+    return G_SOURCE_CONTINUE;
61bfcb
 
61bfcb
   _meta_idle_monitor_watch_fire (watch);
61bfcb
   g_source_set_ready_time (watch->timeout_source, -1);
61bfcb
-- 
61bfcb
2.20.1
61bfcb