kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

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

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