You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.4 KiB
63 lines
2.4 KiB
From 73cae2c78af65cdfd6fa0c8257b4d3ae593f9f74 Mon Sep 17 00:00:00 2001 |
|
From: Rui Matos <tiagomatos@gmail.com> |
|
Date: Tue, 6 Oct 2015 21:16:18 +0200 |
|
Subject: [PATCH 2/8] monitor-manager-xrandr: Work around spurious hotplugs on |
|
Xvnc |
|
|
|
Xvnc turns its outputs off/on on every mode set which makes us believe |
|
there was an hotplug when there actually wasn't. Work around this by |
|
requiring new randr configuration timestamps to be ahead of the last |
|
set timestamp by at least 100 ms for us to consider them an actual |
|
hotplug. |
|
--- |
|
src/backends/x11/meta-monitor-manager-xrandr.c | 20 ++++++++++++++++++-- |
|
1 file changed, 18 insertions(+), 2 deletions(-) |
|
|
|
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c |
|
index c369d4960..8d1bdfb69 100644 |
|
--- a/src/backends/x11/meta-monitor-manager-xrandr.c |
|
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c |
|
@@ -1909,6 +1909,18 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass) |
|
g_quark_from_static_string ("-meta-monitor-xrandr-data"); |
|
} |
|
|
|
+static gboolean |
|
+is_xvnc (MetaMonitorManager *manager) |
|
+{ |
|
+ unsigned int i; |
|
+ |
|
+ for (i = 0; i < manager->n_outputs; ++i) |
|
+ if (g_str_has_prefix (manager->outputs[i].name, "VNC-")) |
|
+ return TRUE; |
|
+ |
|
+ return FALSE; |
|
+} |
|
+ |
|
gboolean |
|
meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr, |
|
XEvent *event) |
|
@@ -1916,6 +1928,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra |
|
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr); |
|
gboolean is_hotplug; |
|
gboolean is_our_configuration; |
|
+ unsigned int timestamp; |
|
|
|
if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify) |
|
return FALSE; |
|
@@ -1925,8 +1938,11 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra |
|
meta_monitor_manager_read_current_state (manager); |
|
|
|
|
|
- is_hotplug = (manager_xrandr->resources->timestamp < |
|
- manager_xrandr->resources->configTimestamp); |
|
+ timestamp = manager_xrandr->resources->timestamp; |
|
+ if (is_xvnc (manager)) |
|
+ timestamp += 100; |
|
+ |
|
+ is_hotplug = (timestamp < manager_xrandr->resources->configTimestamp); |
|
is_our_configuration = (manager_xrandr->resources->timestamp == |
|
manager_xrandr->last_xrandr_set_timestamp); |
|
if (is_hotplug) |
|
-- |
|
2.14.2 |
|
|
|
|