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

474558
From ad61347e9d92380fbbb4effd8a19349777d76715 Mon Sep 17 00:00:00 2001
db633a
From: Rui Matos <tiagomatos@gmail.com>
db633a
Date: Tue, 6 Oct 2015 21:16:18 +0200
474558
Subject: [PATCH] monitor-manager-xrandr: Work around spurious hotplugs on Xvnc
db633a
db633a
Xvnc turns its outputs off/on on every mode set which makes us believe
db633a
there was an hotplug when there actually wasn't. Work around this by
db633a
requiring new randr configuration timestamps to be ahead of the last
db633a
set timestamp by at least 100 ms for us to consider them an actual
db633a
hotplug.
db633a
---
474558
 .../x11/meta-monitor-manager-xrandr.c         | 25 ++++++++++++++++++-
474558
 1 file changed, 24 insertions(+), 1 deletion(-)
db633a
db633a
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
474558
index dbe3e4e3b..90a3952db 100644
db633a
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
db633a
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
474558
@@ -1058,6 +1058,24 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
e3f29c
     g_quark_from_static_string ("-meta-monitor-xrandr-data");
db633a
 }
db633a
 
db633a
+static gboolean
db633a
+is_xvnc (MetaMonitorManager *manager)
db633a
+{
474558
+  MetaMonitorManagerXrandr *manager_xrandr =
474558
+    META_MONITOR_MANAGER_XRANDR (manager);
474558
+  GList *l;
db633a
+
474558
+  for (l = meta_gpu_get_outputs (manager_xrandr->gpu); l; l = l->next)
474558
+    {
474558
+      MetaOutput *output = l->data;
474558
+
474558
+      if (g_str_has_prefix (output->name, "VNC-"))
474558
+        return TRUE;
474558
+    }
db633a
+
db633a
+  return FALSE;
db633a
+}
db633a
+
db633a
 gboolean
db633a
 meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr,
db633a
 					   XEvent                   *event)
474558
@@ -1067,6 +1085,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
474558
   XRRScreenResources *resources;
e3f29c
   gboolean is_hotplug;
e3f29c
   gboolean is_our_configuration;
db633a
+  unsigned int timestamp;
db633a
 
db633a
   if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
db633a
     return FALSE;
474558
@@ -1078,7 +1097,11 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
474558
   gpu_xrandr = META_GPU_XRANDR (manager_xrandr->gpu);
474558
   resources = meta_gpu_xrandr_get_resources (gpu_xrandr);
db633a
 
474558
-  is_hotplug = resources->timestamp < resources->configTimestamp;
474558
+  timestamp = resources->timestamp;
db633a
+  if (is_xvnc (manager))
db633a
+    timestamp += 100;
db633a
+
474558
+  is_hotplug = timestamp < resources->configTimestamp;
474558
   is_our_configuration = (resources->timestamp ==
e3f29c
                           manager_xrandr->last_xrandr_set_timestamp);
e3f29c
   if (is_hotplug)
db633a
-- 
474558
2.17.0
db633a