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

e47e58
From 73cae2c78af65cdfd6fa0c8257b4d3ae593f9f74 Mon Sep 17 00:00:00 2001
2c033f
From: Rui Matos <tiagomatos@gmail.com>
2c033f
Date: Tue, 6 Oct 2015 21:16:18 +0200
e47e58
Subject: [PATCH 2/8] monitor-manager-xrandr: Work around spurious hotplugs on
e47e58
 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
---
e47e58
 src/backends/x11/meta-monitor-manager-xrandr.c | 20 ++++++++++++++++++--
e47e58
 1 file changed, 18 insertions(+), 2 deletions(-)
2c033f
2c033f
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
e47e58
index c369d4960..8d1bdfb69 100644
2c033f
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
2c033f
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
e47e58
@@ -1909,6 +1909,18 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
e47e58
     g_quark_from_static_string ("-meta-monitor-xrandr-data");
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)
e47e58
@@ -1916,6 +1928,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
67f8b7
   MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
e47e58
   gboolean is_hotplug;
e47e58
   gboolean is_our_configuration;
2c033f
+  unsigned int timestamp;
2c033f
 
2c033f
   if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
2c033f
     return FALSE;
e47e58
@@ -1925,8 +1938,11 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
e47e58
   meta_monitor_manager_read_current_state (manager);
2c033f
 
67f8b7
 
e47e58
-  is_hotplug = (manager_xrandr->resources->timestamp <
e47e58
-                manager_xrandr->resources->configTimestamp);
2c033f
+  timestamp = manager_xrandr->resources->timestamp;
2c033f
+  if (is_xvnc (manager))
2c033f
+    timestamp += 100;
2c033f
+
e47e58
+  is_hotplug = (timestamp < manager_xrandr->resources->configTimestamp);
e47e58
   is_our_configuration = (manager_xrandr->resources->timestamp ==
e47e58
                           manager_xrandr->last_xrandr_set_timestamp);
e47e58
   if (is_hotplug)
2c033f
-- 
e47e58
2.14.2
2c033f