princeamd pushed a commit to branch ecore-1.7.

commit eee0868d08ea8014664f3114b8b0ba8543a9f695
Author: Chris Michael <[email protected]>
Date:   Sat May 11 16:09:39 2013 +0100

    Backport: bc31a55 :: Add ecore_x_randr_config_timestamp_get to return 
config timestamp that XRandr has currently.
    
    NB: needed for some updates/fixes to randr dialog.
    
    Signed-off-by: Chris Michael <[email protected]>
    Signed-off-by: Deon Thomas <[email protected]>
---
 src/lib/ecore_x/Ecore_X.h             |  1 +
 src/lib/ecore_x/xcb/ecore_xcb_randr.c | 36 +++++++++++++++++++++++++++++++++++
 src/lib/ecore_x/xlib/ecore_x_randr.c  | 35 ++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index e06cf18..1e2fe70 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -1838,6 +1838,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);
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c 
b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
index a10dc0e..cf47d19 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
@@ -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
  */
diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c 
b/src/lib/ecore_x/xlib/ecore_x_randr.c
index bda1c9e..1cfc571 100644
--- a/src/lib/ecore_x/xlib/ecore_x_randr.c
+++ b/src/lib/ecore_x/xlib/ecore_x_randr.c
@@ -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 *
  ***************************************/

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to