diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c new file mode 100644 index 0000000..263dade --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c | |||
@@ -0,0 +1,203 @@ | |||
1 | #include "ecore_xcb_private.h" | ||
2 | #ifdef ECORE_XCB_XGESTURE | ||
3 | # include <xcb/gesture.h> | ||
4 | # include <xcb/xcb_event.h> | ||
5 | #endif | ||
6 | |||
7 | /* local variables */ | ||
8 | static Eina_Bool _gesture_available = EINA_FALSE; | ||
9 | |||
10 | /* external variables */ | ||
11 | int _ecore_xcb_event_gesture = -1; | ||
12 | |||
13 | void | ||
14 | _ecore_xcb_gesture_init(void) | ||
15 | { | ||
16 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
17 | |||
18 | #ifdef ECORE_XCB_XGESTURE | ||
19 | xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_gesture_id); | ||
20 | #endif | ||
21 | } | ||
22 | |||
23 | void | ||
24 | _ecore_xcb_gesture_finalize(void) | ||
25 | { | ||
26 | #ifdef ECORE_XCB_XGESTURE | ||
27 | xcb_gesture_query_version_cookie_t cookie; | ||
28 | xcb_gesture_query_version_reply_t *reply; | ||
29 | #endif | ||
30 | |||
31 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
32 | |||
33 | #ifdef ECORE_XCB_XGESTURE | ||
34 | cookie = | ||
35 | xcb_gesture_query_version_unchecked(_ecore_xcb_conn); | ||
36 | reply = | ||
37 | xcb_gesture_query_version_reply(_ecore_xcb_conn, cookie, NULL); | ||
38 | if (reply) | ||
39 | { | ||
40 | _gesture_available = EINA_TRUE; | ||
41 | free(reply); | ||
42 | } | ||
43 | |||
44 | if (_gesture_available) | ||
45 | { | ||
46 | const xcb_query_extension_reply_t *ext_reply; | ||
47 | |||
48 | ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_gesture_id); | ||
49 | if (ext_reply) | ||
50 | _ecore_xcb_event_gesture = ext_reply->first_event; | ||
51 | } | ||
52 | #endif | ||
53 | } | ||
54 | |||
55 | void | ||
56 | _ecore_xcb_gesture_shutdown(void) | ||
57 | { | ||
58 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
59 | } | ||
60 | |||
61 | EAPI Eina_Bool | ||
62 | ecore_x_gesture_supported(void) | ||
63 | { | ||
64 | return _gesture_available; | ||
65 | } | ||
66 | |||
67 | #ifdef ECORE_XCB_XGESTURE | ||
68 | EAPI Eina_Bool | ||
69 | ecore_x_gesture_events_select(Ecore_X_Window win, | ||
70 | Ecore_X_Gesture_Event_Mask mask) | ||
71 | #else | ||
72 | EAPI Eina_Bool | ||
73 | ecore_x_gesture_events_select(Ecore_X_Window win __UNUSED__, | ||
74 | Ecore_X_Gesture_Event_Mask mask __UNUSED__) | ||
75 | #endif | ||
76 | |||
77 | { | ||
78 | #ifdef ECORE_XCB_XGESTURE | ||
79 | if (!_gesture_available) return EINA_FALSE; | ||
80 | |||
81 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
82 | CHECK_XCB_CONN | ||
83 | |||
84 | xcb_gesture_select_events(_ecore_xcb_conn, win, mask); | ||
85 | |||
86 | return EINA_TRUE; | ||
87 | #else | ||
88 | return EINA_FALSE; | ||
89 | #endif | ||
90 | } | ||
91 | |||
92 | #ifdef ECORE_XCB_XGESTURE | ||
93 | EAPI Ecore_X_Gesture_Event_Mask | ||
94 | ecore_x_gesture_events_selected_get(Ecore_X_Window win) | ||
95 | #else | ||
96 | EAPI Ecore_X_Gesture_Event_Mask | ||
97 | ecore_x_gesture_events_selected_get(Ecore_X_Window win __UNUSED__) | ||
98 | #endif | ||
99 | { | ||
100 | #ifdef ECORE_XCB_XGESTURE | ||
101 | xcb_gesture_get_selected_events_cookie_t ecookie; | ||
102 | xcb_gesture_get_selected_events_reply_t *ereply; | ||
103 | Ecore_X_Gesture_Event_Mask mask = ECORE_X_GESTURE_EVENT_MASK_NONE; | ||
104 | |||
105 | if (!_gesture_available) return mask; | ||
106 | |||
107 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
108 | CHECK_XCB_CONN | ||
109 | |||
110 | ecookie = xcb_gesture_get_selected_events(_ecore_xcb_conn, win); | ||
111 | ereply = | ||
112 | xcb_gesture_get_selected_events_reply(_ecore_xcb_conn, ecookie, NULL); | ||
113 | if (ereply) | ||
114 | { | ||
115 | mask = ereply->mask; | ||
116 | free(ereply); | ||
117 | } | ||
118 | |||
119 | return mask; | ||
120 | #else | ||
121 | return ECORE_X_GESTURE_EVENT_MASK_NONE; | ||
122 | #endif | ||
123 | } | ||
124 | |||
125 | #ifdef ECORE_XCB_XGESTURE | ||
126 | EAPI Eina_Bool | ||
127 | ecore_x_gesture_event_grab(Ecore_X_Window win, | ||
128 | Ecore_X_Gesture_Event_Type type, | ||
129 | int num_fingers) | ||
130 | #else | ||
131 | EAPI Eina_Bool | ||
132 | ecore_x_gesture_event_grab(Ecore_X_Window win __UNUSED__, | ||
133 | Ecore_X_Gesture_Event_Type type __UNUSED__, | ||
134 | int num_fingers __UNUSED__) | ||
135 | #endif | ||
136 | { | ||
137 | #ifdef ECORE_XCB_XGESTURE | ||
138 | Eina_Bool status = EINA_TRUE; | ||
139 | xcb_gesture_grab_event_cookie_t ecookie; | ||
140 | xcb_gesture_grab_event_reply_t *ereply; | ||
141 | |||
142 | if (!_gesture_available) return EINA_FALSE; | ||
143 | |||
144 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
145 | CHECK_XCB_CONN | ||
146 | |||
147 | ecookie = | ||
148 | xcb_gesture_grab_event(_ecore_xcb_conn, win, type, num_fingers, 0L); | ||
149 | ereply = xcb_gesture_grab_event_reply(_ecore_xcb_conn, ecookie, NULL); | ||
150 | |||
151 | if (ereply) | ||
152 | { | ||
153 | if (ereply->status) status = EINA_FALSE; | ||
154 | free(ereply); | ||
155 | } | ||
156 | else | ||
157 | status = EINA_FALSE; | ||
158 | |||
159 | return status; | ||
160 | #else | ||
161 | return EINA_FALSE; | ||
162 | #endif | ||
163 | } | ||
164 | |||
165 | #ifdef ECORE_XCB_XGESTURE | ||
166 | EAPI Eina_Bool | ||
167 | ecore_x_gesture_event_ungrab(Ecore_X_Window win, | ||
168 | Ecore_X_Gesture_Event_Type type, | ||
169 | int num_fingers) | ||
170 | #else | ||
171 | EAPI Eina_Bool | ||
172 | ecore_x_gesture_event_ungrab(Ecore_X_Window win __UNUSED__, | ||
173 | Ecore_X_Gesture_Event_Type type __UNUSED__, | ||
174 | int num_fingers __UNUSED__) | ||
175 | #endif | ||
176 | { | ||
177 | #ifdef ECORE_XCB_XGESTURE | ||
178 | Eina_Bool status = EINA_TRUE; | ||
179 | xcb_gesture_ungrab_event_cookie_t ecookie; | ||
180 | xcb_gesture_ungrab_event_reply_t *ereply; | ||
181 | |||
182 | if (!_gesture_available) return EINA_FALSE; | ||
183 | |||
184 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
185 | CHECK_XCB_CONN | ||
186 | |||
187 | ecookie = | ||
188 | xcb_gesture_ungrab_event(_ecore_xcb_conn, win, type, num_fingers, 0L); | ||
189 | ereply = xcb_gesture_ungrab_event_reply(_ecore_xcb_conn, ecookie, NULL); | ||
190 | |||
191 | if (ereply) | ||
192 | { | ||
193 | if (ereply->status) status = EINA_FALSE; | ||
194 | free(ereply); | ||
195 | } | ||
196 | else | ||
197 | status = EINA_FALSE; | ||
198 | |||
199 | return status; | ||
200 | #else | ||
201 | return EINA_FALSE; | ||
202 | #endif | ||
203 | } | ||