Tizen 2.1 base
[framework/uifw/ecore.git] / src / lib / ecore_x / xcb / ecore_xcb_shape.c
1 #include "ecore_xcb_private.h"
2 #ifdef ECORE_XCB_SHAPE
3 # include <xcb/shape.h>
4 #endif
5
6 /* external variables */
7 int _ecore_xcb_event_shape = -1;
8
9 void
10 _ecore_xcb_shape_init(void)
11 {
12    LOGFN(__FILE__, __LINE__, __FUNCTION__);
13
14 #ifdef ECORE_XCB_SHAPE
15    xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_shape_id);
16 #endif
17 }
18
19 void
20 _ecore_xcb_shape_finalize(void)
21 {
22 #ifdef ECORE_XCB_SHAPE
23    const xcb_query_extension_reply_t *ext_reply;
24 #endif
25
26    LOGFN(__FILE__, __LINE__, __FUNCTION__);
27
28 #ifdef ECORE_XCB_SHAPE
29    ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_shape_id);
30    if ((ext_reply) && (ext_reply->present))
31      {
32         xcb_shape_query_version_cookie_t cookie;
33         xcb_shape_query_version_reply_t *reply;
34         Eina_Bool _shape_avail;
35
36         _shape_avail = EINA_FALSE;
37         cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn);
38         reply = xcb_shape_query_version_reply(_ecore_xcb_conn, cookie, NULL);
39         if (reply)
40           {
41              _shape_avail = EINA_TRUE;
42              free(reply);
43           }
44
45         if (_shape_avail)
46           _ecore_xcb_event_shape = ext_reply->first_event;
47      }
48 #endif
49 }
50