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