devilhorns pushed a commit to branch master.
commit bc31a55bda4dc270fac57b857069de38a05ec59c
Author: Chris Michael <[email protected]>
Date: Sat May 11 16:09:39 2013 +0100
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]>
---
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 a23b173..8767704 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -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);
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c
b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
index 2bb43c1..a429b35 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 22b7e1c..b6f74f0 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 *
***************************************/
--
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may