From 68542ae1effafc57e3f628bd70fd0c6994e3192d Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Wed, 10 Dec 2014 18:23:49 +0100 Subject: [PATCH] Revert "monitor-manager-xrandr: Don't do extra work on RRScreenChangeNotify" This reverts commit 47e339b46e80f01c2a4d020dbef7341e5a02b7eb. The approach that was used to reduce the amount of work we do on RR events to the necessary minimum is flawed. It assumes that, when the first event we see where the retrieved XRRScreenResources.timestamp is bigger than the previous, we already have all the data we need to rebuild our view of the world. That isn't true however, because the X server sends RRScreenChangeNotify events for every step of the configuration change, i.e. it lacks an atomic reconfiguration API. In particular, if the X screen size is one of the changes, when we rebuild our state and emit monitors-changed, the X screen size might still be the previous one and since we stop updating ourselves until another reconfiguration happens (noticed by looking at XRRScreenResources.timestamp) we end up with the wrong idea of the X screen size. https://bugzilla.gnome.org/show_bug.cgi?id=738630 --- src/backends/x11/meta-monitor-manager-xrandr.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index 7a3926faa..6abe6e011 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -1110,15 +1110,12 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra { MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr); gboolean hotplug; - Time old_timestamp; if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify) return FALSE; XRRUpdateConfiguration (event); - old_timestamp = manager_xrandr->resources->timestamp; - meta_monitor_manager_read_current_config (manager); hotplug = manager_xrandr->resources->timestamp < manager_xrandr->resources->configTimestamp; @@ -1129,9 +1126,8 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra } else { - /* If something else changed -- tell the world about it. */ - if (old_timestamp < manager_xrandr->resources->timestamp) - meta_monitor_manager_rebuild_derived (manager); + /* Something else changed -- tell the world about it. */ + meta_monitor_manager_rebuild_derived (manager); } return TRUE;