mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
monitor-manager-xrandr: Don't do extra work on RRScreenChangeNotify
The X server sends several RRScreenChangeNotify events in a burst when something happens which, currently, causes us to rebuild our view of the world as many times and notify the upper layers about it which causes a lot of bogus repeated work like rebuilding background actors. We can avoid this extra work by looking at the timestamp in the XRRScreenResources struct which is updated when an X client (including us!) last changed something and comparing it with the previous timestamp. https://bugzilla.gnome.org/show_bug.cgi?id=738630
This commit is contained in:
parent
016b8f5b4a
commit
47e339b46e
@ -1059,12 +1059,15 @@ 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;
|
||||||
@ -1075,8 +1078,9 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Something else changed -- tell the world about it. */
|
/* If something else changed -- tell the world about it. */
|
||||||
meta_monitor_manager_rebuild_derived (manager);
|
if (old_timestamp < manager_xrandr->resources->timestamp)
|
||||||
|
meta_monitor_manager_rebuild_derived (manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user