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.
58 * @return @c EINA_TRUE, if extension is available, @c EINA_FALSE otherwise.
61 ecore_x_randr_query(void)
63 return _randr_available;
67 * @return version of the RandR extension supported by the server or, in case
68 * RandR extension is not available, Ecore_X_Randr_Unset (=-1).
69 * bit version information: 31 MAJOR 16 | 15 MINOR 0
72 ecore_x_randr_version_get(void)
75 LOGFN(__FILE__, __LINE__, __FUNCTION__);
78 return _randr_version;
82 return Ecore_X_Randr_Unset;
90 _ecore_x_randr_root_validate(Ecore_X_Window root)
93 Ecore_X_Randr_Screen scr = -1;
94 if (root && RANDR_VALIDATE_ROOT(scr, root))