Revert "monitor-manager-xrandr: Don't do extra work on RRScreenChangeNotify"

This reverts commit 47e339b46e. 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
This commit is contained in:
Rui Matos 2014-12-10 18:23:49 +01:00 committed by Jasper St. Pierre
parent 0c730d8feb
commit 68542ae1ef

View File

@ -1110,15 +1110,12 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
{ {
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr); MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
gboolean hotplug; gboolean hotplug;
Time old_timestamp;
if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify) if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
return FALSE; return FALSE;
XRRUpdateConfiguration (event); XRRUpdateConfiguration (event);
old_timestamp = manager_xrandr->resources->timestamp;
meta_monitor_manager_read_current_config (manager); meta_monitor_manager_read_current_config (manager);
hotplug = manager_xrandr->resources->timestamp < manager_xrandr->resources->configTimestamp; hotplug = manager_xrandr->resources->timestamp < manager_xrandr->resources->configTimestamp;
@ -1129,9 +1126,8 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
} }
else else
{ {
/* If something else changed -- tell the world about it. */ /* Something else changed -- tell the world about it. */
if (old_timestamp < manager_xrandr->resources->timestamp) meta_monitor_manager_rebuild_derived (manager);
meta_monitor_manager_rebuild_derived (manager);
} }
return TRUE; return TRUE;