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