From 20d1df8a23cdf10fd89b555189686184de49f9a5 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Thu, 7 Feb 2013 09:32:24 +0000 Subject: [PATCH] Add ecore_x_randr_crtc_info_get function. NB: This will save us Many X round-trips in the new randr dialog. Signed-off-by: Christopher Michael SVN revision: 83728 --- src/lib/ecore_x/xlib/ecore_x_randr.c | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c b/src/lib/ecore_x/xlib/ecore_x_randr.c index 7191f38067..1d003a72f1 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr.c @@ -1779,6 +1779,42 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc #endif } +/* + * @since 1.8 + */ +EAPI Ecore_X_Randr_Crtc_Info * +ecore_x_randr_crtc_info_get(Ecore_X_Window root, const Ecore_X_Randr_Crtc crtc) +{ +#ifdef ECORE_XRANDR + XRRScreenResources *res = NULL; + + if (_randr_version < RANDR_VERSION_1_2) return NULL; + + /* try to get the screen resources from Xrandr */ + if ((res = _ecore_x_randr_screen_resources_get(_ecore_x_disp, root))) + { + XRRCrtcInfo *info = NULL; + Ecore_X_Randr_Crtc_Info *ret = NULL; + + /* try to get crtc info */ + if ((info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + if ((ret = malloc(sizeof(Ecore_X_Randr_Crtc_Info)))) + memcpy(ret, info, sizeof(Ecore_X_Randr_Crtc_Info)); + + /* free the crtc info */ + XRRFreeCrtcInfo(info); + } + + /* free the resources */ + XRRFreeScreenResources(res); + + return ret; + } +#endif + return NULL; +} + /* * @brief Add given mode to given output. *