Blame SOURCES/0001-monitor-manager-xrandr-Work-around-spurious-hotplugs.patch

2c033f
From 073a328a3031faa82d388805c0a6890d4de001df Mon Sep 17 00:00:00 2001
2c033f
From: Rui Matos <tiagomatos@gmail.com>
2c033f
Date: Tue, 6 Oct 2015 21:16:18 +0200
2c033f
Subject: [PATCH] monitor-manager-xrandr: Work around spurious hotplugs on Xvnc
2c033f
2c033f
Xvnc turns its outputs off/on on every mode set which makes us believe
2c033f
there was an hotplug when there actually wasn't. Work around this by
2c033f
requiring new randr configuration timestamps to be ahead of the last
2c033f
set timestamp by at least 100 ms for us to consider them an actual
2c033f
hotplug.
2c033f
---
2c033f
 src/backends/x11/meta-monitor-manager-xrandr.c | 19 ++++++++++++++++++-
2c033f
 1 file changed, 18 insertions(+), 1 deletion(-)
2c033f
2c033f
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
2c033f
index 4c1b16c..190aeac 100644
2c033f
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
2c033f
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
2c033f
@@ -1064,6 +1064,18 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
2c033f
   manager_class->set_crtc_gamma = meta_monitor_manager_xrandr_set_crtc_gamma;
2c033f
 }
2c033f
 
2c033f
+static gboolean
2c033f
+is_xvnc (MetaMonitorManager *manager)
2c033f
+{
2c033f
+  unsigned int i;
2c033f
+
2c033f
+  for (i = 0; i < manager->n_outputs; ++i)
2c033f
+    if (g_str_has_prefix (manager->outputs[i].name, "VNC-"))
2c033f
+      return TRUE;
2c033f
+
2c033f
+  return FALSE;
2c033f
+}
2c033f
+
2c033f
 gboolean
2c033f
 meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr,
2c033f
 					   XEvent                   *event)
2c033f
@@ -1075,6 +1087,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
2c033f
   unsigned int n_old_outputs, n_old_modes;
2c033f
   gboolean new_config;
2c033f
   gboolean applied_config = FALSE;
2c033f
+  unsigned int timestamp;
2c033f
 
2c033f
   if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
2c033f
     return FALSE;
2c033f
@@ -1091,7 +1104,11 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
2c033f
   manager->serial++;
2c033f
   meta_monitor_manager_xrandr_read_current (manager);
2c033f
 
2c033f
-  new_config = manager_xrandr->resources->timestamp >= manager_xrandr->resources->configTimestamp;
2c033f
+  timestamp = manager_xrandr->resources->timestamp;
2c033f
+  if (is_xvnc (manager))
2c033f
+    timestamp += 100;
2c033f
+
2c033f
+  new_config = timestamp >= manager_xrandr->resources->configTimestamp;
2c033f
 
2c033f
   /* If this is the X server telling us we set a new configuration,
2c033f
    * we can simply short-cut to rebuilding our logical configuration.
2c033f
-- 
2c033f
2.4.3
2c033f