[mutter] monitor-manager-xrandr: Re-work xrandr event handling
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-manager-xrandr: Re-work xrandr event handling
- Date: Thu, 16 Oct 2014 18:45:11 +0000 (UTC)
commit 29e5c6c363735c04c25d9e4da2bb236ef5aa2e52
Author: Rui Matos <tiagomatos gmail com>
Date: Thu Oct 16 20:31:03 2014 +0200
monitor-manager-xrandr: Re-work xrandr event handling
In randr events, configTimestamp can be considered the hotplug time,
i.e. whenever the server notices hardware changes, this value will be
updated.
Having that in mind, we can re-work the logic to make it clearer.
There are no semantic changes.
src/backends/x11/meta-monitor-manager-xrandr.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index f93390d..130cb6d 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -1060,7 +1060,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
XEvent *event)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
- gboolean new_config;
+ gboolean hotplug;
if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
return FALSE;
@@ -1073,19 +1073,17 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
if (meta_monitor_config_match_current (manager->config, manager))
return TRUE;
- new_config = manager_xrandr->resources->timestamp >= manager_xrandr->resources->configTimestamp;
-
- /* If this is the X server telling us we set a new configuration,
- * we can simply short-cut to rebuilding our logical configuration.
- */
- if (new_config)
+ hotplug = manager_xrandr->resources->timestamp < manager_xrandr->resources->configTimestamp;
+ if (hotplug)
+ {
+ /* This is a hotplug event, so go ahead and build a new configuration. */
+ meta_monitor_manager_on_hotplug (manager);
+ }
+ else
{
+ /* Something else changed -- tell the world about it. */
meta_monitor_manager_rebuild_derived (manager);
- return TRUE;
}
- /* Otherwise, this event was gotten from hotplug, so try to make
- * a configuration for our new set of outputs. */
- meta_monitor_manager_on_hotplug (manager);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]