aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c')
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c
deleted file mode 100644
index d4d834f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c
+++ /dev/null
@@ -1,102 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6#include "ecore_x_randr.h"
7
8static Eina_Bool _randr_available = EINA_FALSE;
9#ifdef ECORE_XRANDR
10static int _randr_major, _randr_minor;
11int _randr_version;
12#define RANDR_1_1 ((1 << 16) | 1)
13#define RANDR_1_2 ((1 << 16) | 2)
14#define RANDR_1_3 ((1 << 16) | 3)
15
16#define RANDR_VALIDATE_ROOT(screen, \
17 root) ((screen = \
18 XRRRootToScreen(_ecore_x_disp, \
19 root)) != -1)
20
21#define Ecore_X_Randr_Unset -1
22
23XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * dpy,
24 Window window);
25
26#endif /* ifdef ECORE_XRANDR */
27
28void
29_ecore_x_randr_init(void)
30{
31#ifdef ECORE_XRANDR
32 _randr_major = 1;
33 _randr_minor = 3;
34 _randr_version = 0;
35
36 _ecore_x_randr_get_screen_resources = NULL;
37 if (XRRQueryVersion(_ecore_x_disp, &_randr_major, &_randr_minor))
38 {
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;
44
45 _randr_available = EINA_TRUE;
46 }
47 else
48 _randr_available = EINA_FALSE;
49
50#else
51 _randr_available = EINA_FALSE;
52#endif
53}
54
55/*
56 * @brief query whether randr is available or not
57 * @return EINA_TRUE, if extension is available, else EINA_FALSE
58 */
59EAPI Eina_Bool
60ecore_x_randr_query(void)
61{
62 return _randr_available;
63}
64
65/*
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
69 */
70EAPI int
71ecore_x_randr_version_get(void)
72{
73#ifdef ECORE_XRANDR
74 LOGFN(__FILE__, __LINE__, __FUNCTION__);
75 if (_randr_available)
76 {
77 return _randr_version;
78 }
79 else
80 {
81 return Ecore_X_Randr_Unset;
82 }
83#else
84 return -1;
85#endif
86}
87
88Eina_Bool
89_ecore_x_randr_root_validate(Ecore_X_Window root)
90{
91#ifdef ECORE_XRANDR
92 Ecore_X_Randr_Screen scr = -1;
93 if (root && RANDR_VALIDATE_ROOT(scr, root))
94 return EINA_TRUE;
95 else
96 return EINA_FALSE;
97
98#else
99 return EINA_FALSE;
100#endif
101}
102