diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c new file mode 100644 index 0000000..1d956b7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * Xinerama code | ||
3 | */ | ||
4 | |||
5 | #ifdef HAVE_CONFIG_H | ||
6 | # include <config.h> | ||
7 | #endif /* ifdef HAVE_CONFIG_H */ | ||
8 | |||
9 | #include "Ecore.h" | ||
10 | #include "ecore_x_private.h" | ||
11 | #include "Ecore_X.h" | ||
12 | #include "Ecore_X_Atoms.h" | ||
13 | |||
14 | #ifdef ECORE_XINERAMA | ||
15 | static XineramaScreenInfo *_xin_info = NULL; | ||
16 | static int _xin_scr_num = 0; | ||
17 | #endif /* ifdef ECORE_XINERAMA */ | ||
18 | |||
19 | EAPI int | ||
20 | ecore_x_xinerama_screen_count_get(void) | ||
21 | { | ||
22 | #ifdef ECORE_XINERAMA | ||
23 | int event_base, error_base; | ||
24 | |||
25 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
26 | if (_xin_info) | ||
27 | XFree(_xin_info); | ||
28 | |||
29 | _xin_info = NULL; | ||
30 | if (XineramaQueryExtension(_ecore_x_disp, &event_base, &error_base)) | ||
31 | { | ||
32 | _xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num); | ||
33 | if (_xin_info) | ||
34 | return _xin_scr_num; | ||
35 | } | ||
36 | |||
37 | #endif /* ifdef ECORE_XINERAMA */ | ||
38 | return 0; | ||
39 | } /* ecore_x_xinerama_screen_count_get */ | ||
40 | |||
41 | EAPI Eina_Bool | ||
42 | ecore_x_xinerama_screen_geometry_get(int screen, | ||
43 | int *x, | ||
44 | int *y, | ||
45 | int *w, | ||
46 | int *h) | ||
47 | { | ||
48 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
49 | #ifdef ECORE_XINERAMA | ||
50 | if (_xin_info) | ||
51 | { | ||
52 | int i; | ||
53 | |||
54 | for (i = 0; i < _xin_scr_num; i++) | ||
55 | { | ||
56 | if (_xin_info[i].screen_number == screen) | ||
57 | { | ||
58 | if (x) | ||
59 | *x = _xin_info[i].x_org; | ||
60 | |||
61 | if (y) | ||
62 | *y = _xin_info[i].y_org; | ||
63 | |||
64 | if (w) | ||
65 | *w = _xin_info[i].width; | ||
66 | |||
67 | if (h) | ||
68 | *h = _xin_info[i].height; | ||
69 | |||
70 | return EINA_TRUE; | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | #endif /* ifdef ECORE_XINERAMA */ | ||
76 | if (x) | ||
77 | *x = 0; | ||
78 | |||
79 | if (y) | ||
80 | *y = 0; | ||
81 | |||
82 | if (w) | ||
83 | *w = DisplayWidth(_ecore_x_disp, 0); | ||
84 | |||
85 | if (h) | ||
86 | *h = DisplayHeight(_ecore_x_disp, 0); | ||
87 | |||
88 | return EINA_FALSE; | ||
89 | screen = 0; | ||
90 | } /* ecore_x_xinerama_screen_geometry_get */ | ||
91 | |||