Add ecore_x_randr_config_timestamp_get to return config timestamp that
authorChris Michael <devilhorns@comcast.net>
Sat, 11 May 2013 15:09:39 +0000 (16:09 +0100)
committerChris Michael <devilhorns@comcast.net>
Sat, 11 May 2013 15:30:38 +0000 (16:30 +0100)
XRandr has currently.

NB: needed for some updates/fixes to randr dialog.

Signed-off-by: Chris Michael <devilhorns@comcast.net>
src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/xcb/ecore_xcb_randr.c
src/lib/ecore_x/xlib/ecore_x_randr.c

index a23b173..8767704 100644 (file)
@@ -1986,6 +1986,7 @@ typedef struct _Ecore_X_Randr_Crtc_Gamma_Info
 
 EAPI int                                       ecore_x_randr_version_get(void);
 EAPI Eina_Bool                                 ecore_x_randr_query(void);
+EAPI Ecore_X_Time                              ecore_x_randr_config_timestamp_get(Ecore_X_Window root); /** @since 1.8 */
 EAPI Ecore_X_Randr_Orientation                 ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root);
 EAPI Ecore_X_Randr_Orientation                 ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root);
 EAPI Eina_Bool                                 ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root, Ecore_X_Randr_Orientation orientation);
index 2bb43c1..a429b35 100644 (file)
@@ -254,6 +254,42 @@ ecore_x_randr_version_get(void)
    return _randr_version;
 }
 
+/**
+ * @brief This function returns the current config timestamp from 
+ * XRRScreenConfiguration.
+ * 
+ * @params root root window to query screen configuration from
+ * 
+ * @returns The screen configuration timestamp
+ * 
+ * @since 1.8
+ */
+EAPI Ecore_X_Time 
+ecore_x_randr_config_timestamp_get(Ecore_X_Window root)
+{
+   Ecore_X_Time timestamp = 0;
+
+#ifdef ECORE_XCB_RANDR
+   xcb_randr_get_screen_info_cookie_t cookie;
+   xcb_randr_get_screen_info_reply_t *reply;
+#endif
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   CHECK_XCB_CONN;
+
+#ifdef ECORE_XCB_RANDR
+   cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
+   reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
+   if (reply)
+     {
+        timestamp = (Ecore_X_Time)reply->config_timestamp;
+        free(reply);
+     }
+#endif
+
+   return timestamp;
+}
+
 /*
  * @param root window which's primary output will be queried
  */
index 22b7e1c..b6f74f0 100644 (file)
@@ -85,6 +85,41 @@ ecore_x_randr_query(void)
    return _randr_avail;
 }
 
+/**
+ * @brief This function returns the current config timestamp from 
+ * XRRScreenConfiguration.
+ * 
+ * @params root root window to query screen configuration from
+ * 
+ * @returns The screen configuration timestamp
+ * 
+ * @since 1.8
+ */
+EAPI Ecore_X_Time 
+ecore_x_randr_config_timestamp_get(Ecore_X_Window root)
+{
+   Ecore_X_Time timestamp = 0;
+
+#ifdef ECORE_XRANDR
+   XRRScreenConfiguration *cfg;
+
+   /* try to get the screen configuration from Xrandr */
+   if ((cfg = XRRGetScreenInfo(_ecore_x_disp, root)))
+     {
+        Time tm;
+
+        XRRConfigTimes(cfg, &tm);
+
+        timestamp = (Ecore_X_Time)tm;
+
+        /* free any returned screen config */
+        if (cfg) XRRFreeScreenConfigInfo(cfg);
+     }
+#endif
+
+   return timestamp;
+}
+
 /***************************************
  * API Functions for RandR version 1.1 *
  ***************************************/