[gnome-desktop/randr-hotplug: 4/9] Add gnome_rr_screen_get_timestamps() to query the XRR timestamps



commit 5c285b04f5c41b94981696dafef285a007c96823
Author: Federico Mena Quintero <federico novell com>
Date:   Wed May 27 18:57:49 2009 -0500

    Add gnome_rr_screen_get_timestamps() to query the XRR timestamps
    
    Gnome-settings-daemon will need these timestamps to distinguish between
    RANDR events due to change-requests that it performs itself, from events
    due to requests that happened from other clients (or from hotplug notifications).
    
    Signed-off-by: Federico Mena Quintero <federico novell com>
---
 libgnome-desktop/gnome-rr.c            |   27 +++++++++++++++++++++++++++
 libgnome-desktop/libgnomeui/gnome-rr.h |    3 +++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 6d73336..ed87c11 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -656,6 +656,33 @@ gnome_rr_screen_get_ranges (GnomeRRScreen *screen,
 }
 
 /**
+ * gnome_rr_screen_get_timestamps
+ * @screen: a #GnomeRRScreen
+ * @change_timestamp_ret: Location in which to store the timestamp at which the RANDR configuration was last changed
+ * @config_timestamp_ret: Location in which to store the timestamp at which the RANDR configuration was last obtained
+ *
+ * Queries the two timestamps that the X RANDR extension maintains.  The X
+ * server will prevent change requests for stale configurations, those whose
+ * timestamp is not equal to that of the latest request for configuration.  The
+ * X server will also prevent change requests that have an older timestamp to
+ * the latest change request.
+ */
+void
+gnome_rr_screen_get_timestamps (GnomeRRScreen *screen,
+				guint32       *change_timestamp_ret,
+				guint32       *config_timestamp_ret)
+{
+    g_return_if_fail (screen != NULL);
+
+    if (change_timestamp_ret)
+	*change_timestamp_ret = screen->info->resources->timestamp;
+
+    if (config_timestamp_ret)
+	*config_timestamp_ret = screen->info->resources->configTimestamp;
+}
+
+
+/**
  * gnome_rr_screen_refresh
  * @screen: a #GnomeRRScreen
  * @error: location to store error, or %NULL
diff --git a/libgnome-desktop/libgnomeui/gnome-rr.h b/libgnome-desktop/libgnomeui/gnome-rr.h
index 274b5e5..02d8800 100644
--- a/libgnome-desktop/libgnomeui/gnome-rr.h
+++ b/libgnome-desktop/libgnomeui/gnome-rr.h
@@ -91,6 +91,9 @@ void            gnome_rr_screen_get_ranges         (GnomeRRScreen         *scree
 						    int                   *max_width,
 						    int                   *min_height,
 						    int                   *max_height);
+void            gnome_rr_screen_get_timestamps     (GnomeRRScreen         *screen,
+						    guint32               *change_timestamp_ret,
+						    guint32               *config_timestamp_ret);
 
 /* GnomeRROutput */
 guint32         gnome_rr_output_get_id             (GnomeRROutput         *output);



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