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