princeamd pushed a commit to branch ecore-1.7.

commit 4b6c6c4d990773fc47e3c9cafd788f4334930286
Author: Christopher Michael <[email protected]>
Date:   Thu Feb 7 09:32:24 2013 +0000

    Backport: 20d1df8 :: 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 <[email protected]>
    
    SVN revision: 83728
    Signed-off-by: Deon Thomas <[email protected]>
---
 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 7191f38..1d003a7 100644
--- a/src/lib/ecore_x/xlib/ecore_x_randr.c
+++ b/src/lib/ecore_x/xlib/ecore_x_randr.c
@@ -1780,6 +1780,42 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, 
Ecore_X_Randr_Crtc crtc
 }
 
 /*
+ * @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.
  *
  * @param output The output the mode is added to.

-- 

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

Build for Windows Store.

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

Reply via email to