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 <devilhorns@comcast.net>
This commit is contained in:
Chris Michael 2013-05-11 16:09:39 +01:00
parent 35b8b8fbf5
commit bc31a55bda
3 changed files with 72 additions and 0 deletions

View 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);

View 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
*/

View 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 *
***************************************/