diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2019-04-16 16:07:31 +0000 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2019-05-03 07:49:22 +0000 |
commit | b53240a50e04ee37ad2475400b880adf53ce0432 (patch) | |
tree | 587583f6bd28c132e55f657e17b99b7ec16c2ef8 /src/backends/meta-idle-monitor.c | |
parent | 668c44e66bf681ff50c62766ea9d1ca1d0762ec4 (diff) | |
download | mutter-cherry-pick-1ca0fdc9.tar.gz |
idle-monitor: Postpone dispatching of idle timeout if not readycherry-pick-1ca0fdc9
If we update the ready time while the source is already in the
to-dispatch list, changing the ready time doesn't have any effect, and
the source will still be dispatched. This could cause incorrect idle
watch firing causing the power management plugin in
gnome-settings-daemon to sometimes turn off monitors due to it believing
the user had been idle for some time, while in fact, they just logged
back in.
Fix this by not actually dispatching the idle timeout if the ready time
is in the future when actually dispatching.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/543
(cherry picked from commit 1ca0fdc928511edea57b72bfb798be84b8293b1e)
Diffstat (limited to 'src/backends/meta-idle-monitor.c')
-rw-r--r-- | src/backends/meta-idle-monitor.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c index 6673fe06c..ff94e0b8a 100644 --- a/src/backends/meta-idle-monitor.c +++ b/src/backends/meta-idle-monitor.c @@ -316,6 +316,13 @@ idle_monitor_dispatch_timeout (GSource *source, gpointer user_data) { MetaIdleMonitorWatch *watch = (MetaIdleMonitorWatch *) user_data; + int64_t now; + int64_t ready_time; + + now = g_source_get_time (source); + ready_time = g_source_get_ready_time (source); + if (ready_time > now) + return G_SOURCE_CONTINUE; _meta_idle_monitor_watch_fire (watch); g_source_set_ready_time (watch->timeout_source, -1); |