3 #endif /* ifdef HAVE_CONFIG_H */
5 #include "ecore_x_private.h"
6 #include "ecore_x_randr.h"
8 static Eina_Bool _randr_available = EINA_FALSE;
10 static int _randr_major, _randr_minor;
12 #define RANDR_1_1 ((1 << 16) | 1)
13 #define RANDR_1_2 ((1 << 16) | 2)
14 #define RANDR_1_3 ((1 << 16) | 3)
16 #define RANDR_VALIDATE_ROOT(screen, \
18 XRRRootToScreen(_ecore_x_disp, \
21 #define Ecore_X_Randr_Unset -1
23 XRRScreenResources * (*_ecore_x_randr_get_screen_resources)(Display * dpy,
26 #endif /* ifdef ECORE_XRANDR */
29 _ecore_x_randr_init(void)
36 _ecore_x_randr_get_screen_resources = NULL;
37 if (XRRQueryVersion(_ecore_x_disp, &_randr_major, &_randr_minor))
39 _randr_version = (_randr_major << 16) | _randr_minor;
40 if (_randr_version >= RANDR_1_3)
41 _ecore_x_randr_get_screen_resources = XRRGetScreenResourcesCurrent;
42 else if (_randr_version == RANDR_1_2)
43 _ecore_x_randr_get_screen_resources = XRRGetScreenResources;
45 _randr_available = EINA_TRUE;
48 _randr_available = EINA_FALSE;
51 _randr_available = EINA_FALSE;
56 * @brief query whether randr is available or not
57 * @return EINA_TRUE, if extension is available, else EINA_FALSE
60 ecore_x_randr_query(void)
62 return _randr_available;
66 * @return version of the RandRR extension supported by the server or,
67 * in case RandRR extension is not available, Ecore_X_Randr_Unset (=-1).
68 * bit version information: 31 MAJOR 16 | 15 MINOR 0
71 ecore_x_randr_version_get(void)
74 LOGFN(__FILE__, __LINE__, __FUNCTION__);
77 return _randr_version;
81 return Ecore_X_Randr_Unset;
89 _ecore_x_randr_root_validate(Ecore_X_Window root)
92 Ecore_X_Randr_Screen scr = -1;
93 if (root && RANDR_VALIDATE_ROOT(scr, root))