|
|
67f8b7 |
From 257c8e8d3b7103973dfdc2665d210c63496be457 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Tue, 6 Oct 2015 21:16:18 +0200
|
|
|
2c033f |
Subject: [PATCH] monitor-manager-xrandr: Work around spurious hotplugs on 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 |
---
|
|
|
2c033f |
src/backends/x11/meta-monitor-manager-xrandr.c | 19 ++++++++++++++++++-
|
|
|
2c033f |
1 file changed, 18 insertions(+), 1 deletion(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
67f8b7 |
index b82120af9..4a27b3a14 100644
|
|
|
2c033f |
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
2c033f |
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
67f8b7 |
@@ -1484,12 +1484,25 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
|
|
|
67f8b7 |
#endif
|
|
|
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)
|
|
|
67f8b7 |
{
|
|
|
67f8b7 |
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
|
|
|
67f8b7 |
gboolean hotplug;
|
|
|
2c033f |
+ unsigned int timestamp;
|
|
|
2c033f |
|
|
|
2c033f |
if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
|
|
|
2c033f |
return FALSE;
|
|
|
67f8b7 |
@@ -1498,7 +1511,11 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
|
|
|
2c033f |
|
|
|
67f8b7 |
meta_monitor_manager_read_current_config (manager);
|
|
|
67f8b7 |
|
|
|
67f8b7 |
- hotplug = manager_xrandr->resources->timestamp < manager_xrandr->resources->configTimestamp;
|
|
|
2c033f |
+ timestamp = manager_xrandr->resources->timestamp;
|
|
|
2c033f |
+ if (is_xvnc (manager))
|
|
|
2c033f |
+ timestamp += 100;
|
|
|
2c033f |
+
|
|
|
67f8b7 |
+ hotplug = timestamp < manager_xrandr->resources->configTimestamp;
|
|
|
67f8b7 |
if (hotplug)
|
|
|
67f8b7 |
{
|
|
|
67f8b7 |
/* This is a hotplug event, so go ahead and build a new configuration. */
|
|
|
2c033f |
--
|
|
|
67f8b7 |
2.12.0
|
|
|
2c033f |
|