[gnome-settings-daemon] bgo#610482 - Adjust XF86Display timestamps if they are out of order with RANDR timestamps



commit c114f0ca3da756725996bfa2111b2cc4e1982d92
Author: Chase Douglas <chase douglas ubuntu com>
Date:   Thu May 6 15:51:14 2010 -0500

    bgo#610482 - Adjust XF86Display timestamps if they are out of order with RANDR timestamps
    
    Some laptops seem to send XF86Display keypress events when you unsuspend them,
    probably as a way to 'make Windows work'.  For some reason these events
    come with timestamps that are out of order with respect to the
    RANDR timestamps.  So we'll adjust the keypress timestamps so that
    the events can be processed.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 plugins/xrandr/gsd-xrandr-manager.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 5a3cfde..7f406b1 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -991,6 +991,8 @@ handle_fn_f7 (GsdXrandrManager *mgr, guint32 timestamp)
         gnome_rr_config_free (current);
 
         if (priv->fn_f7_configs) {
+                guint32 server_timestamp;
+
                 mgr->priv->current_fn_f7_config++;
 
                 if (priv->fn_f7_configs[mgr->priv->current_fn_f7_config] == NULL)
@@ -1002,6 +1004,22 @@ handle_fn_f7 (GsdXrandrManager *mgr, guint32 timestamp)
 
                 g_debug ("applying");
 
+                /* See https://bugzilla.gnome.org/show_bug.cgi?id=610482
+                 *
+                 * Sometimes we'll get two rapid XF86Display keypress events,
+                 * but their timestamps will be out of order with respect to the
+                 * RANDR timestamps.  This *may* be due to stupid BIOSes sending
+                 * out display-switch keystrokes "to make Windows work".
+                 *
+                 * The X server will error out if the timestamp provided is
+                 * older than a previous change configuration timestamp. We
+                 * assume here that we do want this event to go through still,
+                 * since kernel timestamps may be skewed wrt the X server.
+                 */
+                gnome_rr_screen_get_timestamps (screen, NULL, &server_timestamp);
+                if (timestamp < server_timestamp)
+                        timestamp = server_timestamp;
+
                 apply_configuration_and_display_error (mgr, priv->fn_f7_configs[mgr->priv->current_fn_f7_config], timestamp);
         }
         else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]