1 #include "ecore_xcb_private.h"
2 #ifdef ECORE_XCB_XINERAMA
3 # include <xcb/xinerama.h>
7 static Eina_Bool _xinerama_avail = EINA_FALSE;
8 static Eina_Bool _xinerama_active = EINA_FALSE;
11 _ecore_xcb_xinerama_init(void)
13 LOGFN(__FILE__, __LINE__, __FUNCTION__);
15 #ifdef ECORE_XCB_XINERAMA
16 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_xinerama_id);
21 _ecore_xcb_xinerama_finalize(void)
23 #ifdef ECORE_XCB_XINERAMA
24 const xcb_query_extension_reply_t *ext_reply;
27 LOGFN(__FILE__, __LINE__, __FUNCTION__);
29 #ifdef ECORE_XCB_XINERAMA
30 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xinerama_id);
31 if ((ext_reply) && (ext_reply->present))
33 xcb_xinerama_query_version_cookie_t cookie;
34 xcb_xinerama_query_version_reply_t *reply;
37 xcb_xinerama_query_version_unchecked(_ecore_xcb_conn,
38 XCB_XINERAMA_MAJOR_VERSION,
39 XCB_XINERAMA_MINOR_VERSION);
41 xcb_xinerama_query_version_reply(_ecore_xcb_conn, cookie, NULL);
44 _xinerama_avail = EINA_TRUE;
45 // NB: Do we need to compare version numbers here ?
51 xcb_xinerama_is_active_cookie_t acookie;
52 xcb_xinerama_is_active_reply_t *areply;
54 acookie = xcb_xinerama_is_active_unchecked(_ecore_xcb_conn);
56 xcb_xinerama_is_active_reply(_ecore_xcb_conn, acookie, NULL);
59 _xinerama_active = areply->state;
68 ecore_x_xinerama_screen_count_get(void)
71 #ifdef ECORE_XCB_XINERAMA
72 xcb_xinerama_query_screens_cookie_t cookie;
73 xcb_xinerama_query_screens_reply_t *reply;
76 LOGFN(__FILE__, __LINE__, __FUNCTION__);
79 if (!_xinerama_avail) return 0;
81 #ifdef ECORE_XCB_XINERAMA
82 cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
84 xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
86 count = reply->number;
93 ecore_x_xinerama_screen_geometry_get(int screen,
99 #ifdef ECORE_XCB_XINERAMA
100 xcb_xinerama_query_screens_cookie_t cookie;
101 xcb_xinerama_query_screens_reply_t *reply;
102 xcb_xinerama_screen_info_t *info;
105 LOGFN(__FILE__, __LINE__, __FUNCTION__);
110 if (w) *w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
111 if (h) *h = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
113 if (!_xinerama_avail) return EINA_FALSE;
115 #ifdef ECORE_XCB_XINERAMA
116 cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
118 xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
119 if (!reply) return EINA_FALSE;
121 info = xcb_xinerama_query_screens_screen_info(reply);
128 if (x) *x = info[screen].x_org;
129 if (y) *y = info[screen].y_org;
130 if (w) *w = info[screen].width;
131 if (h) *h = info[screen].height;