[gnome-settings-daemon/randr-hotplug: 12/13] Ignore RANDR events that have the same timestamp



commit f2d2c756cbcdc6e3bf7bf093201c1a82dcd40764
Author: Federico Mena Quintero <federico novell com>
Date:   Sun May 31 15:24:31 2009 -0500

    Ignore RANDR events that have the same timestamp
    
    Due to the various RANDR calls that cause events to be generated, we may get
    events that have the same timestamps.  However, we don't want to reconfigure
    the outputs on every single event; just when we know that something may
    really be different.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>
---
 plugins/xrandr/gsd-xrandr-manager.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index ececa44..e6394bc 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -102,6 +102,9 @@ struct GsdXrandrManagerPrivate
         /* fn-F7 status */
         int             current_fn_f7_config;             /* -1 if no configs */
         GnomeRRConfig **fn_f7_configs;  /* NULL terminated, NULL if there are no configs */
+
+        /* Last time at which we got a "screen got reconfigured" event; see on_randr_event() */
+        guint32 last_config_timestamp;
 };
 
 static void     gsd_xrandr_manager_class_init  (GsdXrandrManagerClass *klass);
@@ -1018,7 +1021,7 @@ on_randr_event (GnomeRRScreen *screen, gpointer data)
 
         gnome_rr_screen_get_timestamps (screen, &change_timestamp, &config_timestamp);
 
-        if (change_timestamp > config_timestamp) {
+        if (change_timestamp >= config_timestamp) {
                 /* The event is due to an explicit configuration change.
                  *
                  * If the change was performed by us, then we need to do nothing.
@@ -1028,13 +1031,18 @@ on_randr_event (GnomeRRScreen *screen, gpointer data)
                  */
                 show_timestamps_dialog (manager, "ignoring since change > config");
         } else {
-                /* Here, config_timestamp >= change_timestamp.  This means that
+                /* Here, config_timestamp > change_timestamp.  This means that
                  * the screen got reconfigured because of hotplug/unplug; the X
                  * server is just notifying us, and we need to configure the
                  * outputs in a sane way.
                  */
+
+
 #if 1
-                auto_configure_outputs (manager, config_timestamp);
+                if (config_timestamp != priv->last_config_timestamp) {
+                        priv->last_config_timestamp = config_timestamp;
+                        auto_configure_outputs (manager, config_timestamp);
+                }
 #else
                 /* WHY THIS CODE IS DISABLED:
                  *



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