diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c | 2487 |
1 files changed, 0 insertions, 2487 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c deleted file mode 100644 index 0b06a79..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c +++ /dev/null | |||
@@ -1,2487 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif /* ifdef HAVE_CONFIG_H */ | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <stdio.h> | ||
7 | #include <string.h> | ||
8 | |||
9 | #include <langinfo.h> | ||
10 | |||
11 | #include "Ecore.h" | ||
12 | #include "ecore_private.h" | ||
13 | #include "ecore_x_private.h" | ||
14 | #include "Ecore_X.h" | ||
15 | #include "Ecore_X_Atoms.h" | ||
16 | |||
17 | /** OpenBSD does not define CODESET | ||
18 | * FIXME ?? | ||
19 | */ | ||
20 | |||
21 | #ifndef CODESET | ||
22 | #define CODESET "INVALID" | ||
23 | #endif /* ifndef CODESET */ | ||
24 | |||
25 | typedef struct _Ecore_X_Mouse_Down_Info | ||
26 | { | ||
27 | EINA_INLIST; | ||
28 | int dev; | ||
29 | Window last_win; | ||
30 | Window last_last_win; | ||
31 | Window last_event_win; | ||
32 | Window last_last_event_win; | ||
33 | Time last_time; | ||
34 | Time last_last_time; | ||
35 | Eina_Bool did_double : 1; | ||
36 | Eina_Bool did_triple : 1; | ||
37 | } Ecore_X_Mouse_Down_Info; | ||
38 | |||
39 | static int _ecore_x_last_event_mouse_move = 0; | ||
40 | static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL; | ||
41 | static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL; | ||
42 | |||
43 | static void | ||
44 | _ecore_x_mouse_down_info_clear(void) | ||
45 | { | ||
46 | Eina_Inlist *l = _ecore_x_mouse_down_info_list; | ||
47 | Ecore_X_Mouse_Down_Info *info = NULL; | ||
48 | while (l) | ||
49 | { | ||
50 | info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info); | ||
51 | l = eina_inlist_remove(l, l); | ||
52 | free(info); | ||
53 | } | ||
54 | _ecore_x_mouse_down_info_list = NULL; | ||
55 | } | ||
56 | |||
57 | void | ||
58 | _ecore_x_events_init(void) | ||
59 | { | ||
60 | //Actually, Nothing to do. | ||
61 | } | ||
62 | |||
63 | void | ||
64 | _ecore_x_events_shutdown(void) | ||
65 | { | ||
66 | _ecore_x_mouse_down_info_clear(); | ||
67 | } | ||
68 | |||
69 | static Ecore_X_Mouse_Down_Info * | ||
70 | _ecore_x_mouse_down_info_get(int dev) | ||
71 | { | ||
72 | Eina_Inlist *l = _ecore_x_mouse_down_info_list; | ||
73 | Ecore_X_Mouse_Down_Info *info = NULL; | ||
74 | |||
75 | //Return the exist info | ||
76 | EINA_INLIST_FOREACH(l, info) | ||
77 | if (info->dev == dev) return info; | ||
78 | |||
79 | //New Device. Add it. | ||
80 | info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info)); | ||
81 | if (!info) return NULL; | ||
82 | |||
83 | info->dev = dev; | ||
84 | l = eina_inlist_append(l, (Eina_Inlist *)info); | ||
85 | _ecore_x_mouse_down_info_list = l; | ||
86 | return info; | ||
87 | } | ||
88 | |||
89 | static void | ||
90 | _ecore_x_event_free_mouse_move(void *data __UNUSED__, | ||
91 | void *ev) | ||
92 | { | ||
93 | Ecore_Event_Mouse_Move *e; | ||
94 | |||
95 | e = ev; | ||
96 | if (_ecore_x_last_event_mouse_move) | ||
97 | { | ||
98 | _ecore_x_last_event_mouse_move_event = NULL; | ||
99 | _ecore_x_last_event_mouse_move = 0; | ||
100 | } | ||
101 | |||
102 | free(e); | ||
103 | } | ||
104 | |||
105 | EAPI void | ||
106 | ecore_x_event_mask_set(Ecore_X_Window w, | ||
107 | Ecore_X_Event_Mask mask) | ||
108 | { | ||
109 | XWindowAttributes attr; | ||
110 | XSetWindowAttributes s_attr; | ||
111 | |||
112 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
113 | if (!w) | ||
114 | w = DefaultRootWindow(_ecore_x_disp); | ||
115 | |||
116 | memset(&attr, 0, sizeof(XWindowAttributes)); | ||
117 | XGetWindowAttributes(_ecore_x_disp, w, &attr); | ||
118 | s_attr.event_mask = mask | attr.your_event_mask; | ||
119 | XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); | ||
120 | } | ||
121 | |||
122 | EAPI void | ||
123 | ecore_x_event_mask_unset(Ecore_X_Window w, | ||
124 | Ecore_X_Event_Mask mask) | ||
125 | { | ||
126 | XWindowAttributes attr; | ||
127 | XSetWindowAttributes s_attr; | ||
128 | |||
129 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
130 | if (!w) | ||
131 | w = DefaultRootWindow(_ecore_x_disp); | ||
132 | |||
133 | memset(&attr, 0, sizeof(XWindowAttributes)); | ||
134 | XGetWindowAttributes(_ecore_x_disp, w, &attr); | ||
135 | s_attr.event_mask = attr.your_event_mask & ~mask; | ||
136 | XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); | ||
137 | } | ||
138 | |||
139 | static void | ||
140 | _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, | ||
141 | void *ev) | ||
142 | { | ||
143 | Ecore_X_Event_Xdnd_Enter *e; | ||
144 | int i; | ||
145 | |||
146 | e = ev; | ||
147 | for (i = 0; i < e->num_types; i++) | ||
148 | XFree(e->types[i]); | ||
149 | free(e->types); | ||
150 | free(e); | ||
151 | } | ||
152 | |||
153 | static void | ||
154 | _ecore_x_event_free_selection_notify(void *data __UNUSED__, | ||
155 | void *ev) | ||
156 | { | ||
157 | Ecore_X_Event_Selection_Notify *e; | ||
158 | Ecore_X_Selection_Data *sel; | ||
159 | |||
160 | e = ev; | ||
161 | sel = e->data; | ||
162 | if (sel->free) | ||
163 | sel->free(sel); | ||
164 | |||
165 | free(e->target); | ||
166 | free(e); | ||
167 | } | ||
168 | |||
169 | static unsigned int | ||
170 | _ecore_x_event_modifiers(unsigned int state) | ||
171 | { | ||
172 | unsigned int modifiers = 0; | ||
173 | |||
174 | if (state & ECORE_X_MODIFIER_SHIFT) | ||
175 | modifiers |= ECORE_EVENT_MODIFIER_SHIFT; | ||
176 | |||
177 | if (state & ECORE_X_MODIFIER_CTRL) | ||
178 | modifiers |= ECORE_EVENT_MODIFIER_CTRL; | ||
179 | |||
180 | if (state & ECORE_X_MODIFIER_ALT) | ||
181 | modifiers |= ECORE_EVENT_MODIFIER_ALT; | ||
182 | |||
183 | if (state & ECORE_X_MODIFIER_WIN) | ||
184 | modifiers |= ECORE_EVENT_MODIFIER_WIN; | ||
185 | |||
186 | if (state & ECORE_X_LOCK_SCROLL) | ||
187 | modifiers |= ECORE_EVENT_LOCK_SCROLL; | ||
188 | |||
189 | if (state & ECORE_X_LOCK_NUM) | ||
190 | modifiers |= ECORE_EVENT_LOCK_NUM; | ||
191 | |||
192 | if (state & ECORE_X_LOCK_CAPS) | ||
193 | modifiers |= ECORE_EVENT_LOCK_CAPS; | ||
194 | |||
195 | if (state & ECORE_X_LOCK_SHIFT) | ||
196 | modifiers |= ECORE_EVENT_LOCK_SHIFT; | ||
197 | |||
198 | return modifiers; | ||
199 | } | ||
200 | |||
201 | void | ||
202 | _ecore_mouse_move(unsigned int timestamp, | ||
203 | unsigned int xmodifiers, | ||
204 | int x, | ||
205 | int y, | ||
206 | int x_root, | ||
207 | int y_root, | ||
208 | unsigned int event_window, | ||
209 | unsigned int window, | ||
210 | unsigned int root_win, | ||
211 | int same_screen, | ||
212 | int dev, | ||
213 | double radx, | ||
214 | double rady, | ||
215 | double pressure, | ||
216 | double angle, | ||
217 | double mx, | ||
218 | double my, | ||
219 | double mrx, | ||
220 | double mry) | ||
221 | { | ||
222 | Ecore_Event_Mouse_Move *e; | ||
223 | Ecore_Event *event; | ||
224 | |||
225 | e = malloc(sizeof(Ecore_Event_Mouse_Move)); | ||
226 | if (!e) | ||
227 | return; | ||
228 | |||
229 | e->window = window; | ||
230 | e->root_window = root_win; | ||
231 | e->timestamp = timestamp; | ||
232 | e->same_screen = same_screen; | ||
233 | e->event_window = event_window; | ||
234 | |||
235 | e->modifiers = _ecore_x_event_modifiers(xmodifiers); | ||
236 | e->x = x; | ||
237 | e->y = y; | ||
238 | e->root.x = x_root; | ||
239 | e->root.y = y_root; | ||
240 | |||
241 | e->multi.device = dev; | ||
242 | e->multi.radius = (radx + rady) / 2; | ||
243 | e->multi.radius_x = radx; | ||
244 | e->multi.radius_y = rady; | ||
245 | e->multi.pressure = pressure; | ||
246 | e->multi.angle = angle; | ||
247 | e->multi.x = mx; | ||
248 | e->multi.y = my; | ||
249 | e->multi.root.x = mrx; | ||
250 | e->multi.root.y = mry; | ||
251 | |||
252 | event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, | ||
253 | e, | ||
254 | _ecore_x_event_free_mouse_move, | ||
255 | NULL); | ||
256 | |||
257 | _ecore_x_event_last_time = timestamp; | ||
258 | _ecore_x_event_last_win = window; | ||
259 | _ecore_x_event_last_root_x = x_root; | ||
260 | _ecore_x_event_last_root_y = y_root; | ||
261 | |||
262 | _ecore_x_last_event_mouse_move_event = event; | ||
263 | } | ||
264 | |||
265 | static void | ||
266 | _ecore_key_press(int event, | ||
267 | XKeyEvent *xevent) | ||
268 | { | ||
269 | Ecore_Event_Key *e; | ||
270 | char *compose = NULL; | ||
271 | char *tmp = NULL; | ||
272 | char *keyname; | ||
273 | char *key; | ||
274 | char keyname_buffer[256]; | ||
275 | char compose_buffer[256]; | ||
276 | KeySym sym; | ||
277 | XComposeStatus status; | ||
278 | int val; | ||
279 | |||
280 | _ecore_x_last_event_mouse_move = 0; | ||
281 | keyname = XKeysymToString(XKeycodeToKeysym(xevent->display, | ||
282 | xevent->keycode, 0)); | ||
283 | if (!keyname) | ||
284 | { | ||
285 | snprintf(keyname_buffer, | ||
286 | sizeof(keyname_buffer), | ||
287 | "Keycode-%i", | ||
288 | xevent->keycode); | ||
289 | keyname = keyname_buffer; | ||
290 | } | ||
291 | |||
292 | sym = 0; | ||
293 | key = NULL; | ||
294 | compose = NULL; | ||
295 | val = XLookupString(xevent, | ||
296 | compose_buffer, | ||
297 | sizeof(compose_buffer), | ||
298 | &sym, | ||
299 | &status); | ||
300 | if (val > 0) | ||
301 | { | ||
302 | compose_buffer[val] = 0; | ||
303 | compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", | ||
304 | compose_buffer); | ||
305 | if (!compose) | ||
306 | ERR("Ecore_X cannot convert input key string '%s' to UTF-8. " | ||
307 | "Is Eina built with iconv support?", compose_buffer); | ||
308 | tmp = compose; | ||
309 | } | ||
310 | |||
311 | key = XKeysymToString(sym); | ||
312 | if (!key) | ||
313 | key = keyname; | ||
314 | |||
315 | e = | ||
316 | malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + | ||
317 | (compose ? strlen(compose) : 0) + 3); | ||
318 | if (!e) | ||
319 | goto on_error; | ||
320 | |||
321 | e->keyname = (char *)(e + 1); | ||
322 | e->key = e->keyname + strlen(keyname) + 1; | ||
323 | e->compose = (compose) ? e->key + strlen(key) + 1 : NULL; | ||
324 | e->string = e->compose; | ||
325 | |||
326 | strcpy((char *)e->keyname, keyname); | ||
327 | strcpy((char *)e->key, key); | ||
328 | if (compose) | ||
329 | strcpy((char *)e->compose, compose); | ||
330 | |||
331 | e->modifiers = _ecore_x_event_modifiers(xevent->state); | ||
332 | |||
333 | e->timestamp = xevent->time; | ||
334 | e->window = xevent->subwindow ? xevent->subwindow : xevent->window; | ||
335 | e->event_window = xevent->window; | ||
336 | e->same_screen = xevent->same_screen; | ||
337 | e->root_window = xevent->root; | ||
338 | |||
339 | ecore_event_add(event, e, NULL, NULL); | ||
340 | |||
341 | _ecore_x_event_last_time = e->timestamp; | ||
342 | |||
343 | on_error: | ||
344 | if (tmp) | ||
345 | free(tmp); | ||
346 | } | ||
347 | |||
348 | Ecore_Event_Mouse_Button * | ||
349 | _ecore_mouse_button(int event, | ||
350 | unsigned int timestamp, | ||
351 | unsigned int xmodifiers, | ||
352 | unsigned int buttons, | ||
353 | int x, | ||
354 | int y, | ||
355 | int x_root, | ||
356 | int y_root, | ||
357 | unsigned int event_window, | ||
358 | unsigned int window, | ||
359 | unsigned int root_win, | ||
360 | int same_screen, | ||
361 | int dev, | ||
362 | double radx, | ||
363 | double rady, | ||
364 | double pressure, | ||
365 | double angle, | ||
366 | double mx, | ||
367 | double my, | ||
368 | double mrx, | ||
369 | double mry) | ||
370 | { | ||
371 | Ecore_Event_Mouse_Button *e; | ||
372 | |||
373 | e = malloc(sizeof(Ecore_Event_Mouse_Button)); | ||
374 | if (!e) | ||
375 | return NULL; | ||
376 | |||
377 | e->window = window; | ||
378 | e->root_window = root_win; | ||
379 | e->timestamp = timestamp; | ||
380 | e->same_screen = same_screen; | ||
381 | e->event_window = event_window; | ||
382 | |||
383 | e->buttons = buttons; | ||
384 | e->modifiers = _ecore_x_event_modifiers(xmodifiers); | ||
385 | e->double_click = 0; | ||
386 | e->triple_click = 0; | ||
387 | e->x = x; | ||
388 | e->y = y; | ||
389 | e->root.x = x_root; | ||
390 | e->root.y = y_root; | ||
391 | |||
392 | Ecore_X_Mouse_Down_Info *down_info = _ecore_x_mouse_down_info_get(dev); | ||
393 | |||
394 | if (down_info) | ||
395 | { | ||
396 | if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && | ||
397 | down_info->did_triple) | ||
398 | { | ||
399 | down_info->last_win = 0; | ||
400 | down_info->last_last_win = 0; | ||
401 | down_info->last_event_win = 0; | ||
402 | down_info->last_last_event_win = 0; | ||
403 | down_info->last_time = 0; | ||
404 | down_info->last_last_time = 0; | ||
405 | } | ||
406 | if (event_window == window) | ||
407 | { | ||
408 | if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) | ||
409 | { | ||
410 | //Check Double Clicked | ||
411 | if (((int)(timestamp - down_info->last_time) <= | ||
412 | (int)(1000 * _ecore_x_double_click_time)) && | ||
413 | (window == down_info->last_win) && | ||
414 | (event_window == down_info->last_event_win)) | ||
415 | { | ||
416 | e->double_click = 1; | ||
417 | down_info->did_double = EINA_TRUE; | ||
418 | } | ||
419 | else | ||
420 | { | ||
421 | down_info->did_double = EINA_FALSE; | ||
422 | down_info->did_triple = EINA_FALSE; | ||
423 | } | ||
424 | |||
425 | //Check Triple Clicked | ||
426 | if (((int)(timestamp - down_info->last_last_time) <= | ||
427 | (int)(2 * 1000 * _ecore_x_double_click_time)) && | ||
428 | (window == down_info->last_win) && | ||
429 | (window == down_info->last_last_win) && | ||
430 | (event_window == down_info->last_event_win) && | ||
431 | (event_window == down_info->last_last_event_win) | ||
432 | ) | ||
433 | { | ||
434 | e->triple_click = 1; | ||
435 | down_info->did_triple = EINA_TRUE; | ||
436 | } | ||
437 | else | ||
438 | { | ||
439 | down_info->did_triple = EINA_FALSE; | ||
440 | } | ||
441 | } | ||
442 | else | ||
443 | { | ||
444 | if (down_info->did_double) | ||
445 | e->double_click = 1; | ||
446 | if (down_info->did_triple) | ||
447 | e->triple_click = 1; | ||
448 | } | ||
449 | } | ||
450 | } | ||
451 | |||
452 | /* NB: Block commented out as _ecore_x_mouse_up_count appears to have | ||
453 | * no use. The variable is also commented out above. This code block is | ||
454 | * the only place that this variable is used, and appears to serve no | ||
455 | * purpose. - dh | ||
456 | if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN | ||
457 | && !e->double_click | ||
458 | && !e->triple_click) | ||
459 | _ecore_x_mouse_up_count = 0; | ||
460 | */ | ||
461 | |||
462 | e->multi.device = dev; | ||
463 | e->multi.radius = (radx + rady) / 2; | ||
464 | e->multi.radius_x = radx; | ||
465 | e->multi.radius_y = rady; | ||
466 | e->multi.pressure = pressure; | ||
467 | e->multi.angle = angle; | ||
468 | e->multi.x = mx; | ||
469 | e->multi.y = my; | ||
470 | e->multi.root.x = mrx; | ||
471 | e->multi.root.y = mry; | ||
472 | |||
473 | _ecore_x_event_last_time = e->timestamp; | ||
474 | _ecore_x_event_last_win = e->window; | ||
475 | _ecore_x_event_last_root_x = x_root; | ||
476 | _ecore_x_event_last_root_y = y_root; | ||
477 | |||
478 | ecore_event_add(event, e, NULL, NULL); | ||
479 | |||
480 | if ((down_info) && | ||
481 | (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && | ||
482 | (window == event_window) && | ||
483 | (!down_info->did_triple)) | ||
484 | { | ||
485 | down_info->last_last_win = down_info->last_win; | ||
486 | down_info->last_win = window; | ||
487 | down_info->last_last_event_win = down_info->last_event_win; | ||
488 | down_info->last_event_win = event_window; | ||
489 | down_info->last_last_time = down_info->last_time; | ||
490 | down_info->last_time = timestamp; | ||
491 | } | ||
492 | |||
493 | return e; | ||
494 | } | ||
495 | |||
496 | void | ||
497 | _ecore_x_event_handle_any_event(XEvent *xevent) | ||
498 | { | ||
499 | XEvent *ev = malloc(sizeof(XEvent)); | ||
500 | if (!ev) return; | ||
501 | memcpy(ev, xevent, sizeof(XEvent)); | ||
502 | ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL); | ||
503 | } | ||
504 | |||
505 | void | ||
506 | _ecore_x_event_handle_key_press(XEvent *xevent) | ||
507 | { | ||
508 | _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent); | ||
509 | } | ||
510 | |||
511 | void | ||
512 | _ecore_x_event_handle_key_release(XEvent *xevent) | ||
513 | { | ||
514 | _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent); | ||
515 | } | ||
516 | |||
517 | void | ||
518 | _ecore_x_event_handle_button_press(XEvent *xevent) | ||
519 | { | ||
520 | int i; | ||
521 | |||
522 | _ecore_x_last_event_mouse_move = 0; | ||
523 | if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8)) | ||
524 | { | ||
525 | Ecore_Event_Mouse_Wheel *e; | ||
526 | |||
527 | e = malloc(sizeof(Ecore_Event_Mouse_Wheel)); | ||
528 | if (!e) | ||
529 | return; | ||
530 | |||
531 | e->timestamp = xevent->xbutton.time; | ||
532 | e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state); | ||
533 | switch (xevent->xbutton.button) | ||
534 | { | ||
535 | case 4: e->direction = 0; e->z = -1; break; | ||
536 | |||
537 | case 5: e->direction = 0; e->z = 1; break; | ||
538 | |||
539 | case 6: e->direction = 1; e->z = -1; break; | ||
540 | |||
541 | case 7: e->direction = 1; e->z = 1; break; | ||
542 | |||
543 | default: e->direction = 0; e->z = 0; break; | ||
544 | } | ||
545 | |||
546 | e->x = xevent->xbutton.x; | ||
547 | e->y = xevent->xbutton.y; | ||
548 | e->root.x = xevent->xbutton.x_root; | ||
549 | e->root.y = xevent->xbutton.y_root; | ||
550 | |||
551 | if (xevent->xbutton.subwindow) | ||
552 | e->window = xevent->xbutton.subwindow; | ||
553 | else | ||
554 | e->window = xevent->xbutton.window; | ||
555 | |||
556 | e->event_window = xevent->xbutton.window; | ||
557 | e->same_screen = xevent->xbutton.same_screen; | ||
558 | e->root_window = xevent->xbutton.root; | ||
559 | |||
560 | _ecore_x_event_last_time = e->timestamp; | ||
561 | _ecore_x_event_last_win = e->window; | ||
562 | _ecore_x_event_last_root_x = xevent->xbutton.x_root; | ||
563 | _ecore_x_event_last_root_y = xevent->xbutton.y_root; | ||
564 | ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); | ||
565 | |||
566 | for (i = 0; i < _ecore_window_grabs_num; i++) | ||
567 | { | ||
568 | if ((_ecore_window_grabs[i] == xevent->xbutton.window) || | ||
569 | (_ecore_window_grabs[i] == xevent->xbutton.subwindow)) | ||
570 | { | ||
571 | Eina_Bool replay = EINA_FALSE; | ||
572 | |||
573 | if (_ecore_window_grab_replay_func) | ||
574 | replay = _ecore_window_grab_replay_func( | ||
575 | _ecore_window_grab_replay_data, | ||
576 | ECORE_EVENT_MOUSE_WHEEL, | ||
577 | e); | ||
578 | |||
579 | if (replay) | ||
580 | XAllowEvents(xevent->xbutton.display, | ||
581 | ReplayPointer, xevent->xbutton.time); | ||
582 | else | ||
583 | XAllowEvents(xevent->xbutton.display, | ||
584 | AsyncPointer, xevent->xbutton.time); | ||
585 | |||
586 | break; | ||
587 | } | ||
588 | } | ||
589 | } | ||
590 | else | ||
591 | { | ||
592 | { | ||
593 | _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, | ||
594 | xevent->xbutton.x, xevent->xbutton.y, | ||
595 | xevent->xbutton.x_root, xevent->xbutton.y_root, | ||
596 | xevent->xbutton.window, | ||
597 | (xevent->xbutton.subwindow ? xevent->xbutton. | ||
598 | subwindow : xevent->xbutton.window), | ||
599 | xevent->xbutton.root, | ||
600 | xevent->xbutton.same_screen, | ||
601 | 0, 1, 1, | ||
602 | 1.0, // pressure | ||
603 | 0.0, // angle | ||
604 | xevent->xbutton.x, xevent->xbutton.y, | ||
605 | xevent->xbutton.x_root, xevent->xbutton.y_root); | ||
606 | } | ||
607 | { | ||
608 | Ecore_Event_Mouse_Button *e; | ||
609 | int event_window; | ||
610 | int window; | ||
611 | |||
612 | window = | ||
613 | (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent-> | ||
614 | xbutton.window); | ||
615 | event_window = xevent->xbutton.window; | ||
616 | |||
617 | e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, | ||
618 | xevent->xbutton.time, | ||
619 | xevent->xbutton.state, | ||
620 | xevent->xbutton.button, | ||
621 | xevent->xbutton.x, | ||
622 | xevent->xbutton.y, | ||
623 | xevent->xbutton.x_root, | ||
624 | xevent->xbutton.y_root, | ||
625 | event_window, | ||
626 | window, | ||
627 | xevent->xbutton.root, | ||
628 | xevent->xbutton.same_screen, | ||
629 | 0, | ||
630 | 1, | ||
631 | 1, | ||
632 | 1.0, | ||
633 | // pressure | ||
634 | 0.0, | ||
635 | // angle | ||
636 | xevent->xbutton.x, | ||
637 | xevent->xbutton.y, | ||
638 | xevent->xbutton.x_root, | ||
639 | xevent->xbutton.y_root); | ||
640 | if (e) | ||
641 | for (i = 0; i < _ecore_window_grabs_num; i++) | ||
642 | { | ||
643 | if ((_ecore_window_grabs[i] == xevent->xbutton.window) || | ||
644 | (_ecore_window_grabs[i] == xevent->xbutton.subwindow)) | ||
645 | { | ||
646 | Eina_Bool replay = EINA_FALSE; | ||
647 | |||
648 | if (_ecore_window_grab_replay_func) | ||
649 | replay = _ecore_window_grab_replay_func( | ||
650 | _ecore_window_grab_replay_data, | ||
651 | ECORE_EVENT_MOUSE_BUTTON_DOWN, | ||
652 | e); | ||
653 | |||
654 | if (replay) | ||
655 | XAllowEvents(xevent->xbutton.display, | ||
656 | ReplayPointer, xevent->xbutton.time); | ||
657 | else | ||
658 | XAllowEvents(xevent->xbutton.display, | ||
659 | AsyncPointer, xevent->xbutton.time); | ||
660 | |||
661 | break; | ||
662 | } | ||
663 | } | ||
664 | } | ||
665 | } | ||
666 | } | ||
667 | |||
668 | void | ||
669 | _ecore_x_event_handle_button_release(XEvent *xevent) | ||
670 | { | ||
671 | _ecore_x_last_event_mouse_move = 0; | ||
672 | /* filter out wheel buttons */ | ||
673 | if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7)) | ||
674 | { | ||
675 | _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, | ||
676 | xevent->xbutton.x, xevent->xbutton.y, | ||
677 | xevent->xbutton.x_root, xevent->xbutton.y_root, | ||
678 | xevent->xbutton.window, | ||
679 | (xevent->xbutton.subwindow ? xevent->xbutton. | ||
680 | subwindow : xevent->xbutton.window), | ||
681 | xevent->xbutton.root, | ||
682 | xevent->xbutton.same_screen, | ||
683 | 0, 1, 1, | ||
684 | 1.0, // pressure | ||
685 | 0.0, // angle | ||
686 | xevent->xbutton.x, xevent->xbutton.y, | ||
687 | xevent->xbutton.x_root, xevent->xbutton.y_root); | ||
688 | |||
689 | _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, | ||
690 | xevent->xbutton.time, xevent->xbutton.state, | ||
691 | xevent->xbutton.button, | ||
692 | xevent->xbutton.x, xevent->xbutton.y, | ||
693 | xevent->xbutton.x_root, xevent->xbutton.y_root, | ||
694 | xevent->xbutton.window, | ||
695 | (xevent->xbutton.subwindow ? xevent->xbutton. | ||
696 | subwindow : xevent->xbutton.window), | ||
697 | xevent->xbutton.root, | ||
698 | xevent->xbutton.same_screen, | ||
699 | 0, 1, 1, | ||
700 | 1.0, // pressure | ||
701 | 0.0, // angle | ||
702 | xevent->xbutton.x, xevent->xbutton.y, | ||
703 | xevent->xbutton.x_root, xevent->xbutton.y_root); | ||
704 | } | ||
705 | } | ||
706 | |||
707 | void | ||
708 | _ecore_x_event_handle_motion_notify(XEvent *xevent) | ||
709 | { | ||
710 | /* | ||
711 | if (_ecore_x_last_event_mouse_move) | ||
712 | { | ||
713 | ecore_event_del(_ecore_x_last_event_mouse_move_event); | ||
714 | _ecore_x_last_event_mouse_move = 0; | ||
715 | _ecore_x_last_event_mouse_move_event = NULL; | ||
716 | } | ||
717 | */ | ||
718 | _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state, | ||
719 | xevent->xmotion.x, xevent->xmotion.y, | ||
720 | xevent->xmotion.x_root, xevent->xmotion.y_root, | ||
721 | xevent->xmotion.window, | ||
722 | (xevent->xmotion.subwindow ? xevent->xmotion.subwindow : | ||
723 | xevent->xmotion.window), | ||
724 | xevent->xmotion.root, | ||
725 | xevent->xmotion.same_screen, | ||
726 | 0, 1, 1, | ||
727 | 1.0, // pressure | ||
728 | 0.0, // angle | ||
729 | xevent->xmotion.x, xevent->xmotion.y, | ||
730 | xevent->xmotion.x_root, xevent->xmotion.y_root); | ||
731 | |||
732 | _ecore_x_last_event_mouse_move = 1; | ||
733 | |||
734 | /* Xdnd handling */ | ||
735 | _ecore_x_dnd_drag(xevent->xmotion.root, | ||
736 | xevent->xmotion.x_root, | ||
737 | xevent->xmotion.y_root); | ||
738 | } | ||
739 | |||
740 | void | ||
741 | _ecore_x_event_handle_enter_notify(XEvent *xevent) | ||
742 | { | ||
743 | _ecore_x_last_event_mouse_move = 0; | ||
744 | { | ||
745 | _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state, | ||
746 | xevent->xcrossing.x, xevent->xcrossing.y, | ||
747 | xevent->xcrossing.x_root, xevent->xcrossing.y_root, | ||
748 | xevent->xcrossing.window, | ||
749 | (xevent->xcrossing.subwindow ? xevent->xcrossing. | ||
750 | subwindow : xevent->xcrossing.window), | ||
751 | xevent->xcrossing.root, | ||
752 | xevent->xcrossing.same_screen, | ||
753 | 0, 1, 1, | ||
754 | 1.0, // pressure | ||
755 | 0.0, // angle | ||
756 | xevent->xcrossing.x, xevent->xcrossing.y, | ||
757 | xevent->xcrossing.x_root, xevent->xcrossing.y_root); | ||
758 | } | ||
759 | { | ||
760 | Ecore_X_Event_Mouse_In *e; | ||
761 | |||
762 | e = calloc(1, sizeof(Ecore_X_Event_Mouse_In)); | ||
763 | if (!e) | ||
764 | return; | ||
765 | |||
766 | e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); | ||
767 | e->x = xevent->xcrossing.x; | ||
768 | e->y = xevent->xcrossing.y; | ||
769 | e->root.x = xevent->xcrossing.x_root; | ||
770 | e->root.y = xevent->xcrossing.y_root; | ||
771 | if (xevent->xcrossing.subwindow) | ||
772 | e->win = xevent->xcrossing.subwindow; | ||
773 | else | ||
774 | e->win = xevent->xcrossing.window; | ||
775 | |||
776 | e->same_screen = xevent->xcrossing.same_screen; | ||
777 | e->root_win = xevent->xcrossing.root; | ||
778 | e->event_win = xevent->xcrossing.window; | ||
779 | |||
780 | if (xevent->xcrossing.mode == NotifyNormal) | ||
781 | e->mode = ECORE_X_EVENT_MODE_NORMAL; | ||
782 | else if (xevent->xcrossing.mode == NotifyGrab) | ||
783 | e->mode = ECORE_X_EVENT_MODE_GRAB; | ||
784 | else if (xevent->xcrossing.mode == NotifyUngrab) | ||
785 | e->mode = ECORE_X_EVENT_MODE_UNGRAB; | ||
786 | |||
787 | if (xevent->xcrossing.detail == NotifyAncestor) | ||
788 | e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; | ||
789 | else if (xevent->xcrossing.detail == NotifyVirtual) | ||
790 | e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; | ||
791 | else if (xevent->xcrossing.detail == NotifyInferior) | ||
792 | e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; | ||
793 | else if (xevent->xcrossing.detail == NotifyNonlinear) | ||
794 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; | ||
795 | else if (xevent->xcrossing.detail == NotifyNonlinearVirtual) | ||
796 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; | ||
797 | |||
798 | e->time = xevent->xcrossing.time; | ||
799 | _ecore_x_event_last_time = e->time; | ||
800 | ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL); | ||
801 | } | ||
802 | } | ||
803 | |||
804 | void | ||
805 | _ecore_x_event_handle_leave_notify(XEvent *xevent) | ||
806 | { | ||
807 | _ecore_x_last_event_mouse_move = 0; | ||
808 | { | ||
809 | _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state, | ||
810 | xevent->xcrossing.x, xevent->xcrossing.y, | ||
811 | xevent->xcrossing.x_root, xevent->xcrossing.y_root, | ||
812 | xevent->xcrossing.window, | ||
813 | (xevent->xcrossing.subwindow ? xevent->xcrossing. | ||
814 | subwindow : xevent->xcrossing.window), | ||
815 | xevent->xcrossing.root, | ||
816 | xevent->xcrossing.same_screen, | ||
817 | 0, 1, 1, | ||
818 | 1.0, // pressure | ||
819 | 0.0, // angle | ||
820 | xevent->xcrossing.x, xevent->xcrossing.y, | ||
821 | xevent->xcrossing.x_root, xevent->xcrossing.y_root); | ||
822 | } | ||
823 | { | ||
824 | Ecore_X_Event_Mouse_Out *e; | ||
825 | |||
826 | e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out)); | ||
827 | if (!e) | ||
828 | return; | ||
829 | |||
830 | e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); | ||
831 | e->x = xevent->xcrossing.x; | ||
832 | e->y = xevent->xcrossing.y; | ||
833 | e->root.x = xevent->xcrossing.x_root; | ||
834 | e->root.y = xevent->xcrossing.y_root; | ||
835 | if (xevent->xcrossing.subwindow) | ||
836 | e->win = xevent->xcrossing.subwindow; | ||
837 | else | ||
838 | e->win = xevent->xcrossing.window; | ||
839 | |||
840 | e->same_screen = xevent->xcrossing.same_screen; | ||
841 | e->root_win = xevent->xcrossing.root; | ||
842 | e->event_win = xevent->xcrossing.window; | ||
843 | |||
844 | if (xevent->xcrossing.mode == NotifyNormal) | ||
845 | e->mode = ECORE_X_EVENT_MODE_NORMAL; | ||
846 | else if (xevent->xcrossing.mode == NotifyGrab) | ||
847 | e->mode = ECORE_X_EVENT_MODE_GRAB; | ||
848 | else if (xevent->xcrossing.mode == NotifyUngrab) | ||
849 | e->mode = ECORE_X_EVENT_MODE_UNGRAB; | ||
850 | |||
851 | if (xevent->xcrossing.detail == NotifyAncestor) | ||
852 | e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; | ||
853 | else if (xevent->xcrossing.detail == NotifyVirtual) | ||
854 | e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; | ||
855 | else if (xevent->xcrossing.detail == NotifyInferior) | ||
856 | e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; | ||
857 | else if (xevent->xcrossing.detail == NotifyNonlinear) | ||
858 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; | ||
859 | else if (xevent->xcrossing.detail == NotifyNonlinearVirtual) | ||
860 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; | ||
861 | |||
862 | e->time = xevent->xcrossing.time; | ||
863 | _ecore_x_event_last_time = e->time; | ||
864 | _ecore_x_event_last_win = e->win; | ||
865 | _ecore_x_event_last_root_x = e->root.x; | ||
866 | _ecore_x_event_last_root_y = e->root.y; | ||
867 | ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL); | ||
868 | } | ||
869 | } | ||
870 | |||
871 | void | ||
872 | _ecore_x_event_handle_focus_in(XEvent *xevent) | ||
873 | { | ||
874 | Ecore_X_Event_Window_Focus_In *e; | ||
875 | |||
876 | _ecore_x_last_event_mouse_move = 0; | ||
877 | |||
878 | e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In)); | ||
879 | if (!e) | ||
880 | return; | ||
881 | |||
882 | e->win = xevent->xfocus.window; | ||
883 | |||
884 | if (xevent->xfocus.mode == NotifyNormal) | ||
885 | e->mode = ECORE_X_EVENT_MODE_NORMAL; | ||
886 | else if (xevent->xfocus.mode == NotifyWhileGrabbed) | ||
887 | e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED; | ||
888 | else if (xevent->xfocus.mode == NotifyGrab) | ||
889 | e->mode = ECORE_X_EVENT_MODE_GRAB; | ||
890 | else if (xevent->xfocus.mode == NotifyUngrab) | ||
891 | e->mode = ECORE_X_EVENT_MODE_UNGRAB; | ||
892 | |||
893 | if (xevent->xfocus.detail == NotifyAncestor) | ||
894 | e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; | ||
895 | else if (xevent->xfocus.detail == NotifyVirtual) | ||
896 | e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; | ||
897 | else if (xevent->xfocus.detail == NotifyInferior) | ||
898 | e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; | ||
899 | else if (xevent->xfocus.detail == NotifyNonlinear) | ||
900 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; | ||
901 | else if (xevent->xfocus.detail == NotifyNonlinearVirtual) | ||
902 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; | ||
903 | else if (xevent->xfocus.detail == NotifyPointer) | ||
904 | e->detail = ECORE_X_EVENT_DETAIL_POINTER; | ||
905 | else if (xevent->xfocus.detail == NotifyPointerRoot) | ||
906 | e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT; | ||
907 | else if (xevent->xfocus.detail == NotifyDetailNone) | ||
908 | e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE; | ||
909 | |||
910 | e->time = _ecore_x_event_last_time; | ||
911 | _ecore_x_event_last_time = e->time; | ||
912 | ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); | ||
913 | } | ||
914 | |||
915 | void | ||
916 | _ecore_x_event_handle_focus_out(XEvent *xevent) | ||
917 | { | ||
918 | Ecore_X_Event_Window_Focus_Out *e; | ||
919 | |||
920 | _ecore_x_last_event_mouse_move = 0; | ||
921 | |||
922 | e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out)); | ||
923 | if (!e) | ||
924 | return; | ||
925 | |||
926 | e->win = xevent->xfocus.window; | ||
927 | |||
928 | if (xevent->xfocus.mode == NotifyNormal) | ||
929 | e->mode = ECORE_X_EVENT_MODE_NORMAL; | ||
930 | else if (xevent->xfocus.mode == NotifyWhileGrabbed) | ||
931 | e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED; | ||
932 | else if (xevent->xfocus.mode == NotifyGrab) | ||
933 | e->mode = ECORE_X_EVENT_MODE_GRAB; | ||
934 | else if (xevent->xfocus.mode == NotifyUngrab) | ||
935 | e->mode = ECORE_X_EVENT_MODE_UNGRAB; | ||
936 | |||
937 | if (xevent->xfocus.detail == NotifyAncestor) | ||
938 | e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; | ||
939 | else if (xevent->xfocus.detail == NotifyVirtual) | ||
940 | e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; | ||
941 | else if (xevent->xfocus.detail == NotifyInferior) | ||
942 | e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; | ||
943 | else if (xevent->xfocus.detail == NotifyNonlinear) | ||
944 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; | ||
945 | else if (xevent->xfocus.detail == NotifyNonlinearVirtual) | ||
946 | e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; | ||
947 | else if (xevent->xfocus.detail == NotifyPointer) | ||
948 | e->detail = ECORE_X_EVENT_DETAIL_POINTER; | ||
949 | else if (xevent->xfocus.detail == NotifyPointerRoot) | ||
950 | e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT; | ||
951 | else if (xevent->xfocus.detail == NotifyDetailNone) | ||
952 | e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE; | ||
953 | |||
954 | e->time = _ecore_x_event_last_time; | ||
955 | _ecore_x_event_last_time = e->time; | ||
956 | ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); | ||
957 | } | ||
958 | |||
959 | void | ||
960 | _ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__) | ||
961 | { | ||
962 | _ecore_x_last_event_mouse_move = 0; | ||
963 | /* FIXME: handle this event type */ | ||
964 | } | ||
965 | |||
966 | void | ||
967 | _ecore_x_event_handle_expose(XEvent *xevent) | ||
968 | { | ||
969 | Ecore_X_Event_Window_Damage *e; | ||
970 | |||
971 | _ecore_x_last_event_mouse_move = 0; | ||
972 | e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)); | ||
973 | if (!e) | ||
974 | return; | ||
975 | |||
976 | e->win = xevent->xexpose.window; | ||
977 | e->time = _ecore_x_event_last_time; | ||
978 | e->x = xevent->xexpose.x; | ||
979 | e->y = xevent->xexpose.y; | ||
980 | e->w = xevent->xexpose.width; | ||
981 | e->h = xevent->xexpose.height; | ||
982 | e->count = xevent->xexpose.count; | ||
983 | ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); | ||
984 | } | ||
985 | |||
986 | void | ||
987 | _ecore_x_event_handle_graphics_expose(XEvent *xevent) | ||
988 | { | ||
989 | Ecore_X_Event_Window_Damage *e; | ||
990 | |||
991 | _ecore_x_last_event_mouse_move = 0; | ||
992 | e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)); | ||
993 | if (!e) | ||
994 | return; | ||
995 | |||
996 | e->win = xevent->xgraphicsexpose.drawable; | ||
997 | e->time = _ecore_x_event_last_time; | ||
998 | e->x = xevent->xgraphicsexpose.x; | ||
999 | e->y = xevent->xgraphicsexpose.y; | ||
1000 | e->w = xevent->xgraphicsexpose.width; | ||
1001 | e->h = xevent->xgraphicsexpose.height; | ||
1002 | e->count = xevent->xgraphicsexpose.count; | ||
1003 | ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); | ||
1004 | } | ||
1005 | |||
1006 | void | ||
1007 | _ecore_x_event_handle_visibility_notify(XEvent *xevent) | ||
1008 | { | ||
1009 | _ecore_x_last_event_mouse_move = 0; | ||
1010 | // if (xevent->xvisibility.state != VisibilityPartiallyObscured) | ||
1011 | { | ||
1012 | Ecore_X_Event_Window_Visibility_Change *e; | ||
1013 | |||
1014 | e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change)); | ||
1015 | if (!e) | ||
1016 | return; | ||
1017 | |||
1018 | e->win = xevent->xvisibility.window; | ||
1019 | e->time = _ecore_x_event_last_time; | ||
1020 | if (xevent->xvisibility.state == VisibilityFullyObscured) | ||
1021 | e->fully_obscured = 1; | ||
1022 | else | ||
1023 | e->fully_obscured = 0; | ||
1024 | |||
1025 | ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL); | ||
1026 | } | ||
1027 | } | ||
1028 | |||
1029 | void | ||
1030 | _ecore_x_event_handle_create_notify(XEvent *xevent) | ||
1031 | { | ||
1032 | Ecore_X_Event_Window_Create *e; | ||
1033 | |||
1034 | _ecore_x_last_event_mouse_move = 0; | ||
1035 | e = calloc(1, sizeof(Ecore_X_Event_Window_Create)); | ||
1036 | if (!e) | ||
1037 | return; | ||
1038 | |||
1039 | e->win = xevent->xcreatewindow.window; | ||
1040 | e->parent = xevent->xcreatewindow.parent; | ||
1041 | if (xevent->xcreatewindow.override_redirect) | ||
1042 | e->override = 1; | ||
1043 | else | ||
1044 | e->override = 0; | ||
1045 | |||
1046 | e->x = xevent->xcreatewindow.x; | ||
1047 | e->y = xevent->xcreatewindow.y; | ||
1048 | e->w = xevent->xcreatewindow.width; | ||
1049 | e->h = xevent->xcreatewindow.height; | ||
1050 | e->border = xevent->xcreatewindow.border_width; | ||
1051 | e->time = _ecore_x_event_last_time; | ||
1052 | ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL); | ||
1053 | } | ||
1054 | |||
1055 | void | ||
1056 | _ecore_x_event_handle_destroy_notify(XEvent *xevent) | ||
1057 | { | ||
1058 | Ecore_X_Event_Window_Destroy *e; | ||
1059 | |||
1060 | _ecore_x_last_event_mouse_move = 0; | ||
1061 | e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy)); | ||
1062 | if (!e) | ||
1063 | return; | ||
1064 | |||
1065 | e->win = xevent->xdestroywindow.window; | ||
1066 | e->event_win = xevent->xdestroywindow.event; | ||
1067 | e->time = _ecore_x_event_last_time; | ||
1068 | if (e->win == _ecore_x_event_last_win) | ||
1069 | _ecore_x_event_last_win = 0; | ||
1070 | |||
1071 | ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL); | ||
1072 | } | ||
1073 | |||
1074 | void | ||
1075 | _ecore_x_event_handle_unmap_notify(XEvent *xevent) | ||
1076 | { | ||
1077 | Ecore_X_Event_Window_Hide *e; | ||
1078 | |||
1079 | _ecore_x_last_event_mouse_move = 0; | ||
1080 | e = calloc(1, sizeof(Ecore_X_Event_Window_Hide)); | ||
1081 | if (!e) | ||
1082 | return; | ||
1083 | |||
1084 | e->win = xevent->xunmap.window; | ||
1085 | e->event_win = xevent->xunmap.event; | ||
1086 | e->time = _ecore_x_event_last_time; | ||
1087 | ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); | ||
1088 | } | ||
1089 | |||
1090 | void | ||
1091 | _ecore_x_event_handle_map_notify(XEvent *xevent) | ||
1092 | { | ||
1093 | Ecore_X_Event_Window_Show *e; | ||
1094 | |||
1095 | _ecore_x_last_event_mouse_move = 0; | ||
1096 | e = calloc(1, sizeof(Ecore_X_Event_Window_Show)); | ||
1097 | if (!e) | ||
1098 | return; | ||
1099 | |||
1100 | e->win = xevent->xmap.window; | ||
1101 | e->event_win = xevent->xmap.event; | ||
1102 | e->time = _ecore_x_event_last_time; | ||
1103 | ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL); | ||
1104 | } | ||
1105 | |||
1106 | void | ||
1107 | _ecore_x_event_handle_map_request(XEvent *xevent) | ||
1108 | { | ||
1109 | Ecore_X_Event_Window_Show_Request *e; | ||
1110 | |||
1111 | _ecore_x_last_event_mouse_move = 0; | ||
1112 | e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request)); | ||
1113 | if (!e) | ||
1114 | return; | ||
1115 | |||
1116 | e->win = xevent->xmaprequest.window; | ||
1117 | e->time = _ecore_x_event_last_time; | ||
1118 | e->parent = xevent->xmaprequest.parent; | ||
1119 | ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL); | ||
1120 | } | ||
1121 | |||
1122 | void | ||
1123 | _ecore_x_event_handle_reparent_notify(XEvent *xevent) | ||
1124 | { | ||
1125 | Ecore_X_Event_Window_Reparent *e; | ||
1126 | |||
1127 | _ecore_x_last_event_mouse_move = 0; | ||
1128 | e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent)); | ||
1129 | if (!e) | ||
1130 | return; | ||
1131 | |||
1132 | e->win = xevent->xreparent.window; | ||
1133 | e->event_win = xevent->xreparent.event; | ||
1134 | e->parent = xevent->xreparent.parent; | ||
1135 | e->time = _ecore_x_event_last_time; | ||
1136 | ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL); | ||
1137 | } | ||
1138 | |||
1139 | void | ||
1140 | _ecore_x_event_handle_configure_notify(XEvent *xevent) | ||
1141 | { | ||
1142 | Ecore_X_Event_Window_Configure *e; | ||
1143 | |||
1144 | _ecore_x_last_event_mouse_move = 0; | ||
1145 | e = calloc(1, sizeof(Ecore_X_Event_Window_Configure)); | ||
1146 | if (!e) | ||
1147 | return; | ||
1148 | |||
1149 | e->win = xevent->xconfigure.window; | ||
1150 | e->event_win = xevent->xconfigure.event; | ||
1151 | e->abovewin = xevent->xconfigure.above; | ||
1152 | e->x = xevent->xconfigure.x; | ||
1153 | e->y = xevent->xconfigure.y; | ||
1154 | e->w = xevent->xconfigure.width; | ||
1155 | e->h = xevent->xconfigure.height; | ||
1156 | e->border = xevent->xconfigure.border_width; | ||
1157 | e->override = xevent->xconfigure.override_redirect; | ||
1158 | e->from_wm = xevent->xconfigure.send_event; | ||
1159 | e->time = _ecore_x_event_last_time; | ||
1160 | ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); | ||
1161 | } | ||
1162 | |||
1163 | void | ||
1164 | _ecore_x_event_handle_configure_request(XEvent *xevent) | ||
1165 | { | ||
1166 | Ecore_X_Event_Window_Configure_Request *e; | ||
1167 | |||
1168 | _ecore_x_last_event_mouse_move = 0; | ||
1169 | e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request)); | ||
1170 | if (!e) | ||
1171 | return; | ||
1172 | |||
1173 | e->win = xevent->xconfigurerequest.window; | ||
1174 | e->parent_win = xevent->xconfigurerequest.parent; | ||
1175 | e->abovewin = xevent->xconfigurerequest.above; | ||
1176 | e->x = xevent->xconfigurerequest.x; | ||
1177 | e->y = xevent->xconfigurerequest.y; | ||
1178 | e->w = xevent->xconfigurerequest.width; | ||
1179 | e->h = xevent->xconfigurerequest.height; | ||
1180 | e->border = xevent->xconfigurerequest.border_width; | ||
1181 | e->value_mask = xevent->xconfigurerequest.value_mask; | ||
1182 | e->time = _ecore_x_event_last_time; | ||
1183 | |||
1184 | if (xevent->xconfigurerequest.detail == Above) | ||
1185 | e->detail = ECORE_X_WINDOW_STACK_ABOVE; | ||
1186 | else if (xevent->xconfigurerequest.detail == Below) | ||
1187 | e->detail = ECORE_X_WINDOW_STACK_BELOW; | ||
1188 | else if (xevent->xconfigurerequest.detail == TopIf) | ||
1189 | e->detail = ECORE_X_WINDOW_STACK_TOP_IF; | ||
1190 | else if (xevent->xconfigurerequest.detail == BottomIf) | ||
1191 | e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF; | ||
1192 | else if (xevent->xconfigurerequest.detail == Opposite) | ||
1193 | e->detail = ECORE_X_WINDOW_STACK_OPPOSITE; | ||
1194 | |||
1195 | ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL); | ||
1196 | } | ||
1197 | |||
1198 | void | ||
1199 | _ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__) | ||
1200 | { | ||
1201 | _ecore_x_last_event_mouse_move = 0; | ||
1202 | /* FIXME: handle this event type */ | ||
1203 | } | ||
1204 | |||
1205 | void | ||
1206 | _ecore_x_event_handle_resize_request(XEvent *xevent) | ||
1207 | { | ||
1208 | Ecore_X_Event_Window_Resize_Request *e; | ||
1209 | |||
1210 | _ecore_x_last_event_mouse_move = 0; | ||
1211 | e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request)); | ||
1212 | if (!e) | ||
1213 | return; | ||
1214 | |||
1215 | e->win = xevent->xresizerequest.window; | ||
1216 | e->w = xevent->xresizerequest.width; | ||
1217 | e->h = xevent->xresizerequest.height; | ||
1218 | e->time = _ecore_x_event_last_time; | ||
1219 | ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL); | ||
1220 | } | ||
1221 | |||
1222 | void | ||
1223 | _ecore_x_event_handle_circulate_notify(XEvent *xevent) | ||
1224 | { | ||
1225 | Ecore_X_Event_Window_Stack *e; | ||
1226 | |||
1227 | _ecore_x_last_event_mouse_move = 0; | ||
1228 | e = calloc(1, sizeof(Ecore_X_Event_Window_Stack)); | ||
1229 | if (!e) | ||
1230 | return; | ||
1231 | |||
1232 | e->win = xevent->xcirculate.window; | ||
1233 | e->event_win = xevent->xcirculate.event; | ||
1234 | if (xevent->xcirculate.place == PlaceOnTop) | ||
1235 | e->detail = ECORE_X_WINDOW_STACK_ABOVE; | ||
1236 | else | ||
1237 | e->detail = ECORE_X_WINDOW_STACK_BELOW; | ||
1238 | |||
1239 | e->time = _ecore_x_event_last_time; | ||
1240 | ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL); | ||
1241 | } | ||
1242 | |||
1243 | void | ||
1244 | _ecore_x_event_handle_circulate_request(XEvent *xevent) | ||
1245 | { | ||
1246 | Ecore_X_Event_Window_Stack_Request *e; | ||
1247 | |||
1248 | _ecore_x_last_event_mouse_move = 0; | ||
1249 | e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request)); | ||
1250 | if (!e) | ||
1251 | return; | ||
1252 | |||
1253 | e->win = xevent->xcirculaterequest.window; | ||
1254 | e->parent = xevent->xcirculaterequest.parent; | ||
1255 | if (xevent->xcirculaterequest.place == PlaceOnTop) | ||
1256 | e->detail = ECORE_X_WINDOW_STACK_ABOVE; | ||
1257 | else | ||
1258 | e->detail = ECORE_X_WINDOW_STACK_BELOW; | ||
1259 | |||
1260 | e->time = _ecore_x_event_last_time; | ||
1261 | ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL); | ||
1262 | } | ||
1263 | |||
1264 | void | ||
1265 | _ecore_x_event_handle_property_notify(XEvent *xevent) | ||
1266 | { | ||
1267 | _ecore_x_last_event_mouse_move = 0; | ||
1268 | { | ||
1269 | Ecore_X_Event_Window_Property *e; | ||
1270 | |||
1271 | e = calloc(1, sizeof(Ecore_X_Event_Window_Property)); | ||
1272 | if (!e) | ||
1273 | return; | ||
1274 | |||
1275 | e->win = xevent->xproperty.window; | ||
1276 | e->atom = xevent->xproperty.atom; | ||
1277 | e->time = xevent->xproperty.time; | ||
1278 | _ecore_x_event_last_time = e->time; | ||
1279 | ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL); | ||
1280 | } | ||
1281 | } | ||
1282 | |||
1283 | void | ||
1284 | _ecore_x_event_handle_selection_clear(XEvent *xevent) | ||
1285 | { | ||
1286 | // Ecore_X_Selection_Intern *d; | ||
1287 | Ecore_X_Event_Selection_Clear *e; | ||
1288 | Ecore_X_Atom sel; | ||
1289 | |||
1290 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1291 | _ecore_x_last_event_mouse_move = 0; | ||
1292 | /* errr..... why? paranoia. | ||
1293 | d = _ecore_x_selection_get(xevent->xselectionclear.selection); | ||
1294 | if (d && (xevent->xselectionclear.time > d->time)) | ||
1295 | { | ||
1296 | _ecore_x_selection_set(None, NULL, 0, | ||
1297 | xevent->xselectionclear.selection); | ||
1298 | } | ||
1299 | */ | ||
1300 | /* Generate event for app cleanup */ | ||
1301 | e = malloc(sizeof(Ecore_X_Event_Selection_Clear)); | ||
1302 | e->win = xevent->xselectionclear.window; | ||
1303 | e->time = xevent->xselectionclear.time; | ||
1304 | e->atom = sel = xevent->xselectionclear.selection; | ||
1305 | if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) | ||
1306 | e->selection = ECORE_X_SELECTION_PRIMARY; | ||
1307 | else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) | ||
1308 | e->selection = ECORE_X_SELECTION_SECONDARY; | ||
1309 | else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) | ||
1310 | e->selection = ECORE_X_SELECTION_CLIPBOARD; | ||
1311 | else | ||
1312 | e->selection = ECORE_X_SELECTION_OTHER; | ||
1313 | |||
1314 | ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL); | ||
1315 | } | ||
1316 | |||
1317 | void | ||
1318 | _ecore_x_event_handle_selection_request(XEvent *xevent) | ||
1319 | { | ||
1320 | Ecore_X_Event_Selection_Request *e; | ||
1321 | Ecore_X_Selection_Intern *sd; | ||
1322 | void *data = NULL; | ||
1323 | int len; | ||
1324 | int typesize; | ||
1325 | |||
1326 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1327 | _ecore_x_last_event_mouse_move = 0; | ||
1328 | /* | ||
1329 | * Generate a selection request event. | ||
1330 | */ | ||
1331 | e = malloc(sizeof(Ecore_X_Event_Selection_Request)); | ||
1332 | e->owner = xevent->xselectionrequest.owner; | ||
1333 | e->requestor = xevent->xselectionrequest.requestor; | ||
1334 | e->time = xevent->xselectionrequest.time; | ||
1335 | e->selection = xevent->xselectionrequest.selection; | ||
1336 | e->target = xevent->xselectionrequest.target; | ||
1337 | e->property = xevent->xselectionrequest.property; | ||
1338 | ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL); | ||
1339 | |||
1340 | if ((sd = _ecore_x_selection_get(xevent->xselectionrequest.selection)) && | ||
1341 | (sd->win == xevent->xselectionrequest.owner)) | ||
1342 | { | ||
1343 | Ecore_X_Selection_Intern *si; | ||
1344 | |||
1345 | si = _ecore_x_selection_get(xevent->xselectionrequest.selection); | ||
1346 | if (si->data) | ||
1347 | { | ||
1348 | Ecore_X_Atom property = None; | ||
1349 | Ecore_X_Atom type; | ||
1350 | |||
1351 | /* Set up defaults for strings first */ | ||
1352 | type = xevent->xselectionrequest.target; | ||
1353 | typesize = 8; | ||
1354 | len = sd->length; | ||
1355 | |||
1356 | if (!ecore_x_selection_convert(xevent->xselectionrequest.selection, | ||
1357 | xevent->xselectionrequest.target, | ||
1358 | &data, &len, &type, &typesize)) | ||
1359 | /* Refuse selection, conversion to requested target failed */ | ||
1360 | property = None; | ||
1361 | else if (data) | ||
1362 | { | ||
1363 | /* FIXME: This does not properly handle large data transfers */ | ||
1364 | ecore_x_window_prop_property_set( | ||
1365 | xevent->xselectionrequest.requestor, | ||
1366 | xevent->xselectionrequest. | ||
1367 | property, | ||
1368 | type, | ||
1369 | typesize, | ||
1370 | data, | ||
1371 | len); | ||
1372 | property = xevent->xselectionrequest.property; | ||
1373 | free(data); | ||
1374 | } | ||
1375 | |||
1376 | ecore_x_selection_notify_send(xevent->xselectionrequest.requestor, | ||
1377 | xevent->xselectionrequest.selection, | ||
1378 | xevent->xselectionrequest.target, | ||
1379 | property, | ||
1380 | xevent->xselectionrequest.time); | ||
1381 | } | ||
1382 | } | ||
1383 | } | ||
1384 | |||
1385 | void | ||
1386 | _ecore_x_event_handle_selection_notify(XEvent *xevent) | ||
1387 | { | ||
1388 | Ecore_X_Event_Selection_Notify *e; | ||
1389 | unsigned char *data = NULL; | ||
1390 | Ecore_X_Atom selection; | ||
1391 | int num_ret, format; | ||
1392 | |||
1393 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1394 | _ecore_x_last_event_mouse_move = 0; | ||
1395 | selection = xevent->xselection.selection; | ||
1396 | |||
1397 | if (xevent->xselection.target == ECORE_X_ATOM_SELECTION_TARGETS) | ||
1398 | { | ||
1399 | format = ecore_x_window_prop_property_get(xevent->xselection.requestor, | ||
1400 | xevent->xselection.property, | ||
1401 | XA_ATOM, 32, &data, &num_ret); | ||
1402 | if (!format) | ||
1403 | return; | ||
1404 | } | ||
1405 | else | ||
1406 | { | ||
1407 | format = ecore_x_window_prop_property_get(xevent->xselection.requestor, | ||
1408 | xevent->xselection.property, | ||
1409 | AnyPropertyType, 8, &data, | ||
1410 | &num_ret); | ||
1411 | if (!format) | ||
1412 | return; | ||
1413 | } | ||
1414 | |||
1415 | e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify)); | ||
1416 | if (!e) | ||
1417 | return; | ||
1418 | |||
1419 | e->win = xevent->xselection.requestor; | ||
1420 | e->time = xevent->xselection.time; | ||
1421 | e->atom = selection; | ||
1422 | e->target = _ecore_x_selection_target_get(xevent->xselection.target); | ||
1423 | |||
1424 | if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) | ||
1425 | e->selection = ECORE_X_SELECTION_PRIMARY; | ||
1426 | else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) | ||
1427 | e->selection = ECORE_X_SELECTION_SECONDARY; | ||
1428 | else if (selection == ECORE_X_ATOM_SELECTION_XDND) | ||
1429 | e->selection = ECORE_X_SELECTION_XDND; | ||
1430 | else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) | ||
1431 | e->selection = ECORE_X_SELECTION_CLIPBOARD; | ||
1432 | else | ||
1433 | e->selection = ECORE_X_SELECTION_OTHER; | ||
1434 | |||
1435 | e->data = _ecore_x_selection_parse(e->target, data, num_ret, format); | ||
1436 | |||
1437 | ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, | ||
1438 | _ecore_x_event_free_selection_notify, NULL); | ||
1439 | } | ||
1440 | |||
1441 | void | ||
1442 | _ecore_x_event_handle_colormap_notify(XEvent *xevent) | ||
1443 | { | ||
1444 | Ecore_X_Event_Window_Colormap *e; | ||
1445 | |||
1446 | _ecore_x_last_event_mouse_move = 0; | ||
1447 | e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap)); | ||
1448 | if (!e) | ||
1449 | return; | ||
1450 | |||
1451 | e->win = xevent->xcolormap.window; | ||
1452 | e->cmap = xevent->xcolormap.colormap; | ||
1453 | e->time = _ecore_x_event_last_time; | ||
1454 | if (xevent->xcolormap.state == ColormapInstalled) | ||
1455 | e->installed = EINA_TRUE; | ||
1456 | else | ||
1457 | e->installed = EINA_FALSE; | ||
1458 | |||
1459 | ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL); | ||
1460 | } | ||
1461 | |||
1462 | void | ||
1463 | _ecore_x_event_handle_client_message(XEvent *xevent) | ||
1464 | { | ||
1465 | _ecore_x_last_event_mouse_move = 0; | ||
1466 | /* Special client message event handling here. need to put LOTS of if */ | ||
1467 | /* checks here and generate synthetic events per special message known */ | ||
1468 | /* otherwise generate generic client message event. this would handle*/ | ||
1469 | /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */ | ||
1470 | if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) && | ||
1471 | (xevent->xclient.format == 32) && | ||
1472 | (xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW)) | ||
1473 | { | ||
1474 | Ecore_X_Event_Window_Delete_Request *e; | ||
1475 | |||
1476 | e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request)); | ||
1477 | if (!e) | ||
1478 | return; | ||
1479 | |||
1480 | e->win = xevent->xclient.window; | ||
1481 | e->time = _ecore_x_event_last_time; | ||
1482 | ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); | ||
1483 | } | ||
1484 | else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_MOVERESIZE) && | ||
1485 | (xevent->xclient.format == 32) && | ||
1486 | /* Ignore move and resize with keyboard */ | ||
1487 | (xevent->xclient.data.l[2] < 9)) | ||
1488 | { | ||
1489 | Ecore_X_Event_Window_Move_Resize_Request *e; | ||
1490 | |||
1491 | e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request)); | ||
1492 | if (!e) | ||
1493 | return; | ||
1494 | |||
1495 | e->win = xevent->xclient.window; | ||
1496 | e->x = xevent->xclient.data.l[0]; | ||
1497 | e->y = xevent->xclient.data.l[1]; | ||
1498 | e->direction = xevent->xclient.data.l[2]; | ||
1499 | e->button = xevent->xclient.data.l[3]; | ||
1500 | e->source = xevent->xclient.data.l[4]; | ||
1501 | ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL); | ||
1502 | } | ||
1503 | /* Xdnd Client Message Handling Begin */ | ||
1504 | /* Message Type: XdndEnter target */ | ||
1505 | else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_ENTER) | ||
1506 | { | ||
1507 | Ecore_X_Event_Xdnd_Enter *e; | ||
1508 | Ecore_X_DND_Target *target; | ||
1509 | |||
1510 | e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter)); | ||
1511 | if (!e) return; | ||
1512 | |||
1513 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1514 | |||
1515 | target = _ecore_x_dnd_target_get(); | ||
1516 | target->state = ECORE_X_DND_TARGET_ENTERED; | ||
1517 | target->source = xevent->xclient.data.l[0]; | ||
1518 | target->win = xevent->xclient.window; | ||
1519 | target->version = (int)(xevent->xclient.data.l[1] >> 24); | ||
1520 | if (target->version > ECORE_X_DND_VERSION) | ||
1521 | { | ||
1522 | WRN("DND: Requested version %d, we only support up to %d", | ||
1523 | target->version, ECORE_X_DND_VERSION); | ||
1524 | free(e); | ||
1525 | return; | ||
1526 | } | ||
1527 | |||
1528 | if (xevent->xclient.data.l[1] & 0x1UL) | ||
1529 | { | ||
1530 | /* source supports more than 3 types, fetch property */ | ||
1531 | unsigned char *data; | ||
1532 | Ecore_X_Atom *types; | ||
1533 | int i, num_ret; | ||
1534 | |||
1535 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1536 | if (!(ecore_x_window_prop_property_get(target->source, | ||
1537 | ECORE_X_ATOM_XDND_TYPE_LIST, | ||
1538 | XA_ATOM, | ||
1539 | 32, &data, &num_ret))) | ||
1540 | { | ||
1541 | WRN( | ||
1542 | "DND: Could not fetch data type list from source window, aborting."); | ||
1543 | free(e); | ||
1544 | return; | ||
1545 | } | ||
1546 | |||
1547 | types = (Ecore_X_Atom *)data; | ||
1548 | e->types = calloc(num_ret, sizeof(char *)); | ||
1549 | if (e->types) | ||
1550 | { | ||
1551 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1552 | for (i = 0; i < num_ret; i++) | ||
1553 | e->types[i] = XGetAtomName(_ecore_x_disp, types[i]); | ||
1554 | } | ||
1555 | |||
1556 | e->num_types = num_ret; | ||
1557 | } | ||
1558 | else | ||
1559 | { | ||
1560 | int i = 0; | ||
1561 | |||
1562 | e->types = calloc(3, sizeof(char *)); | ||
1563 | if (e->types) | ||
1564 | { | ||
1565 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1566 | while ((i < 3) && (xevent->xclient.data.l[i + 2])) | ||
1567 | { | ||
1568 | e->types[i] = XGetAtomName(_ecore_x_disp, | ||
1569 | xevent->xclient.data.l[i + 2]); | ||
1570 | i++; | ||
1571 | } | ||
1572 | } | ||
1573 | |||
1574 | e->num_types = i; | ||
1575 | } | ||
1576 | |||
1577 | e->win = target->win; | ||
1578 | e->source = target->source; | ||
1579 | ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, | ||
1580 | _ecore_x_event_free_xdnd_enter, NULL); | ||
1581 | } | ||
1582 | /* Message Type: XdndPosition target */ | ||
1583 | else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_POSITION) | ||
1584 | { | ||
1585 | Ecore_X_Event_Xdnd_Position *e; | ||
1586 | Ecore_X_DND_Target *target; | ||
1587 | |||
1588 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1589 | |||
1590 | target = _ecore_x_dnd_target_get(); | ||
1591 | if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || | ||
1592 | (target->win != xevent->xclient.window)) | ||
1593 | return; | ||
1594 | |||
1595 | target->pos.x = xevent->xclient.data.l[2] >> 16; | ||
1596 | target->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL; | ||
1597 | target->action = xevent->xclient.data.l[4]; /* Version 2 */ | ||
1598 | |||
1599 | target->time = (target->version >= 1) ? | ||
1600 | (Time)xevent->xclient.data.l[3] : CurrentTime; | ||
1601 | |||
1602 | e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position)); | ||
1603 | if (!e) return; | ||
1604 | |||
1605 | e->win = target->win; | ||
1606 | e->source = target->source; | ||
1607 | e->position.x = target->pos.x; | ||
1608 | e->position.y = target->pos.y; | ||
1609 | e->action = target->action; | ||
1610 | ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL); | ||
1611 | } | ||
1612 | /* Message Type: XdndStatus source */ | ||
1613 | else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_STATUS) | ||
1614 | { | ||
1615 | Ecore_X_Event_Xdnd_Status *e; | ||
1616 | Ecore_X_DND_Source *source; | ||
1617 | |||
1618 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1619 | |||
1620 | source = _ecore_x_dnd_source_get(); | ||
1621 | /* Make sure source/target match */ | ||
1622 | if ((source->win != xevent->xclient.window) || | ||
1623 | (source->dest != (Window)xevent->xclient.data.l[0])) | ||
1624 | return; | ||
1625 | |||
1626 | source->await_status = 0; | ||
1627 | |||
1628 | source->will_accept = xevent->xclient.data.l[1] & 0x1UL; | ||
1629 | source->suppress = (xevent->xclient.data.l[1] & 0x2UL) ? 0 : 1; | ||
1630 | |||
1631 | source->rectangle.x = xevent->xclient.data.l[2] >> 16; | ||
1632 | source->rectangle.y = xevent->xclient.data.l[2] & 0xFFFFUL; | ||
1633 | source->rectangle.width = xevent->xclient.data.l[3] >> 16; | ||
1634 | source->rectangle.height = xevent->xclient.data.l[3] & 0xFFFFUL; | ||
1635 | |||
1636 | source->accepted_action = xevent->xclient.data.l[4]; | ||
1637 | |||
1638 | e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status)); | ||
1639 | if (!e) return; | ||
1640 | |||
1641 | e->win = source->win; | ||
1642 | e->target = source->dest; | ||
1643 | e->will_accept = source->will_accept; | ||
1644 | e->rectangle.x = source->rectangle.x; | ||
1645 | e->rectangle.y = source->rectangle.y; | ||
1646 | e->rectangle.width = source->rectangle.width; | ||
1647 | e->rectangle.height = source->rectangle.height; | ||
1648 | e->action = source->accepted_action; | ||
1649 | |||
1650 | ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL); | ||
1651 | } | ||
1652 | /* Message Type: XdndLeave target */ | ||
1653 | /* Pretend the whole thing never happened, sort of */ | ||
1654 | else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_LEAVE) | ||
1655 | { | ||
1656 | Ecore_X_Event_Xdnd_Leave *e; | ||
1657 | Ecore_X_DND_Target *target; | ||
1658 | |||
1659 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1660 | |||
1661 | target = _ecore_x_dnd_target_get(); | ||
1662 | if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || | ||
1663 | (target->win != xevent->xclient.window)) | ||
1664 | return; | ||
1665 | |||
1666 | target->state = ECORE_X_DND_TARGET_IDLE; | ||
1667 | |||
1668 | e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave)); | ||
1669 | if (!e) return; | ||
1670 | |||
1671 | e->win = xevent->xclient.window; | ||
1672 | e->source = (Window)xevent->xclient.data.l[0]; | ||
1673 | ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL); | ||
1674 | } | ||
1675 | /* Message Type: XdndDrop target */ | ||
1676 | else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_DROP) | ||
1677 | { | ||
1678 | Ecore_X_Event_Xdnd_Drop *e; | ||
1679 | Ecore_X_DND_Target *target; | ||
1680 | |||
1681 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1682 | |||
1683 | target = _ecore_x_dnd_target_get(); | ||
1684 | /* Match source/target */ | ||
1685 | if ((target->source != (Window)xevent->xclient.data.l[0]) || | ||
1686 | (target->win != xevent->xclient.window)) | ||
1687 | return; | ||
1688 | |||
1689 | target->time = (target->version >= 1) ? | ||
1690 | (Time)xevent->xclient.data.l[2] : _ecore_x_event_last_time; | ||
1691 | |||
1692 | e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop)); | ||
1693 | if (!e) return; | ||
1694 | |||
1695 | e->win = target->win; | ||
1696 | e->source = target->source; | ||
1697 | e->action = target->action; | ||
1698 | e->position.x = target->pos.x; | ||
1699 | e->position.y = target->pos.y; | ||
1700 | ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL); | ||
1701 | } | ||
1702 | /* Message Type: XdndFinished source */ | ||
1703 | else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_FINISHED) | ||
1704 | { | ||
1705 | Ecore_X_Event_Xdnd_Finished *e; | ||
1706 | Ecore_X_DND_Source *source; | ||
1707 | Eina_Bool completed = EINA_TRUE; | ||
1708 | |||
1709 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1710 | |||
1711 | source = _ecore_x_dnd_source_get(); | ||
1712 | /* Match source/target */ | ||
1713 | if ((source->win != xevent->xclient.window) || | ||
1714 | (source->dest != (Window)xevent->xclient.data.l[0])) | ||
1715 | return; | ||
1716 | |||
1717 | if ((source->version < 5) || (xevent->xclient.data.l[1] & 0x1UL)) | ||
1718 | { | ||
1719 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1720 | /* Target successfully performed drop action */ | ||
1721 | ecore_x_selection_xdnd_clear(); | ||
1722 | source->state = ECORE_X_DND_SOURCE_IDLE; | ||
1723 | } | ||
1724 | else if (source->version >= 5) | ||
1725 | { | ||
1726 | completed = EINA_FALSE; | ||
1727 | source->state = ECORE_X_DND_SOURCE_CONVERTING; | ||
1728 | |||
1729 | /* FIXME: Probably need to add a timer to switch back to idle | ||
1730 | * and discard the selection data */ | ||
1731 | } | ||
1732 | |||
1733 | e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished)); | ||
1734 | if (!e) return; | ||
1735 | |||
1736 | e->win = source->win; | ||
1737 | e->target = source->dest; | ||
1738 | e->completed = completed; | ||
1739 | if (source->version >= 5) | ||
1740 | { | ||
1741 | source->accepted_action = xevent->xclient.data.l[2]; | ||
1742 | e->action = source->accepted_action; | ||
1743 | } | ||
1744 | else | ||
1745 | { | ||
1746 | source->accepted_action = 0; | ||
1747 | e->action = source->action; | ||
1748 | } | ||
1749 | |||
1750 | ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL); | ||
1751 | } | ||
1752 | else if (xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_STATE) | ||
1753 | { | ||
1754 | Ecore_X_Event_Window_State_Request *e; | ||
1755 | |||
1756 | e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)); | ||
1757 | if (!e) return; | ||
1758 | |||
1759 | e->win = xevent->xclient.window; | ||
1760 | if (xevent->xclient.data.l[0] == 0) | ||
1761 | e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE; | ||
1762 | else if (xevent->xclient.data.l[0] == 1) | ||
1763 | e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; | ||
1764 | else if (xevent->xclient.data.l[0] == 2) | ||
1765 | e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE; | ||
1766 | else | ||
1767 | { | ||
1768 | free(e); | ||
1769 | return; | ||
1770 | } | ||
1771 | |||
1772 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1773 | e->state[0] = _ecore_x_netwm_state_get(xevent->xclient.data.l[1]); | ||
1774 | if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN) | ||
1775 | { | ||
1776 | // char *name; | ||
1777 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1778 | |||
1779 | // name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]); | ||
1780 | // if (name) ERR("Unknown state: %s", name); | ||
1781 | // XFree(name); | ||
1782 | } | ||
1783 | e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]); | ||
1784 | if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN) | ||
1785 | { | ||
1786 | // char *name; | ||
1787 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1788 | |||
1789 | // name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]); | ||
1790 | // if (name) ERR("Unknown state: %s", name); | ||
1791 | // XFree(name); | ||
1792 | } | ||
1793 | |||
1794 | e->source = xevent->xclient.data.l[3]; | ||
1795 | |||
1796 | ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); | ||
1797 | } | ||
1798 | else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_CHANGE_STATE) | ||
1799 | && (xevent->xclient.format == 32) | ||
1800 | && (xevent->xclient.data.l[0] == IconicState)) | ||
1801 | { | ||
1802 | Ecore_X_Event_Window_State_Request *e; | ||
1803 | |||
1804 | e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)); | ||
1805 | if (!e) | ||
1806 | return; | ||
1807 | |||
1808 | e->win = xevent->xclient.window; | ||
1809 | e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; | ||
1810 | e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED; | ||
1811 | |||
1812 | ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); | ||
1813 | } | ||
1814 | else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_DESKTOP) | ||
1815 | && (xevent->xclient.format == 32)) | ||
1816 | { | ||
1817 | Ecore_X_Event_Desktop_Change *e; | ||
1818 | |||
1819 | e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change)); | ||
1820 | if (!e) | ||
1821 | return; | ||
1822 | |||
1823 | e->win = xevent->xclient.window; | ||
1824 | e->desk = xevent->xclient.data.l[0]; | ||
1825 | e->source = xevent->xclient.data.l[1]; | ||
1826 | |||
1827 | ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL); | ||
1828 | } | ||
1829 | else if ((xevent->xclient.message_type == | ||
1830 | ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS)) | ||
1831 | { | ||
1832 | Ecore_X_Event_Frame_Extents_Request *e; | ||
1833 | |||
1834 | e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request)); | ||
1835 | if (!e) | ||
1836 | return; | ||
1837 | |||
1838 | e->win = xevent->xclient.window; | ||
1839 | |||
1840 | ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL); | ||
1841 | } | ||
1842 | else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) | ||
1843 | && ((Ecore_X_Atom)xevent->xclient.data.l[0] == | ||
1844 | ECORE_X_ATOM_NET_WM_PING) | ||
1845 | && (xevent->xclient.format == 32)) | ||
1846 | { | ||
1847 | Ecore_X_Event_Ping *e; | ||
1848 | Ecore_X_Window root = 0; | ||
1849 | |||
1850 | e = calloc(1, sizeof(Ecore_X_Event_Ping)); | ||
1851 | if (!e) | ||
1852 | return; | ||
1853 | |||
1854 | e->win = xevent->xclient.window; | ||
1855 | e->time = xevent->xclient.data.l[1]; | ||
1856 | e->event_win = xevent->xclient.data.l[2]; | ||
1857 | |||
1858 | /* send a reply anyway - we are alive... eventloop at least */ | ||
1859 | ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL); | ||
1860 | if (ScreenCount(_ecore_x_disp) > 1) | ||
1861 | { | ||
1862 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1863 | root = ecore_x_window_root_get(e->win); | ||
1864 | } | ||
1865 | else | ||
1866 | root = DefaultRootWindow(_ecore_x_disp); | ||
1867 | |||
1868 | if (xevent->xclient.window != root) | ||
1869 | { | ||
1870 | xevent->xclient.window = root; | ||
1871 | XSendEvent(_ecore_x_disp, root, False, | ||
1872 | SubstructureRedirectMask | SubstructureNotifyMask, | ||
1873 | xevent); | ||
1874 | } | ||
1875 | } | ||
1876 | else if ((xevent->xclient.message_type == | ||
1877 | ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) && | ||
1878 | (xevent->xclient.format == 8)) | ||
1879 | _ecore_x_netwm_startup_info_begin(xevent->xclient.window, | ||
1880 | xevent->xclient.data.b); | ||
1881 | else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_STARTUP_INFO) && | ||
1882 | (xevent->xclient.format == 8)) | ||
1883 | _ecore_x_netwm_startup_info(xevent->xclient.window, | ||
1884 | xevent->xclient.data.b); | ||
1885 | else if ((xevent->xclient.message_type == 27777) | ||
1886 | && (xevent->xclient.data.l[0] == 0x7162534) | ||
1887 | && (xevent->xclient.format == 32) | ||
1888 | && (xevent->xclient.window == _ecore_x_private_win)) | ||
1889 | { | ||
1890 | /* a grab sync marker */ | ||
1891 | if (xevent->xclient.data.l[1] == 0x10000001) | ||
1892 | _ecore_x_window_grab_remove(xevent->xclient.data.l[2]); | ||
1893 | else if (xevent->xclient.data.l[1] == 0x10000002) | ||
1894 | _ecore_x_key_grab_remove(xevent->xclient.data.l[2]); | ||
1895 | } | ||
1896 | else | ||
1897 | { | ||
1898 | Ecore_X_Event_Client_Message *e; | ||
1899 | int i; | ||
1900 | |||
1901 | e = calloc(1, sizeof(Ecore_X_Event_Client_Message)); | ||
1902 | if (!e) | ||
1903 | return; | ||
1904 | |||
1905 | e->win = xevent->xclient.window; | ||
1906 | e->message_type = xevent->xclient.message_type; | ||
1907 | e->format = xevent->xclient.format; | ||
1908 | for (i = 0; i < 5; i++) | ||
1909 | e->data.l[i] = xevent->xclient.data.l[i]; | ||
1910 | |||
1911 | ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL); | ||
1912 | } | ||
1913 | } | ||
1914 | |||
1915 | void | ||
1916 | _ecore_x_event_handle_mapping_notify(XEvent *xevent) | ||
1917 | { | ||
1918 | Ecore_X_Event_Mapping_Change *e; | ||
1919 | |||
1920 | _ecore_x_last_event_mouse_move = 0; | ||
1921 | XRefreshKeyboardMapping((XMappingEvent *)xevent); | ||
1922 | _ecore_x_modifiers_get(); | ||
1923 | e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)); | ||
1924 | if (!e) return; | ||
1925 | switch (xevent->xmapping.request) | ||
1926 | { | ||
1927 | case MappingModifier: | ||
1928 | e->type = ECORE_X_MAPPING_MODIFIER; | ||
1929 | break; | ||
1930 | |||
1931 | case MappingKeyboard: | ||
1932 | e->type = ECORE_X_MAPPING_KEYBOARD; | ||
1933 | break; | ||
1934 | |||
1935 | case MappingPointer: | ||
1936 | default: | ||
1937 | e->type = ECORE_X_MAPPING_MOUSE; | ||
1938 | break; | ||
1939 | } | ||
1940 | e->keycode = xevent->xmapping.first_keycode; | ||
1941 | e->num = xevent->xmapping.count; | ||
1942 | ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); | ||
1943 | } | ||
1944 | |||
1945 | void | ||
1946 | _ecore_x_event_handle_shape_change(XEvent *xevent) | ||
1947 | { | ||
1948 | XShapeEvent *shape_event; | ||
1949 | Ecore_X_Event_Window_Shape *e; | ||
1950 | |||
1951 | _ecore_x_last_event_mouse_move = 0; | ||
1952 | shape_event = (XShapeEvent *)xevent; | ||
1953 | e = calloc(1, sizeof(Ecore_X_Event_Window_Shape)); | ||
1954 | if (!e) | ||
1955 | return; | ||
1956 | |||
1957 | e->win = shape_event->window; | ||
1958 | e->time = shape_event->time; | ||
1959 | switch (shape_event->kind) | ||
1960 | { | ||
1961 | case ShapeBounding: | ||
1962 | e->type = ECORE_X_SHAPE_BOUNDING; | ||
1963 | break; | ||
1964 | |||
1965 | case ShapeClip: | ||
1966 | e->type = ECORE_X_SHAPE_CLIP; | ||
1967 | break; | ||
1968 | |||
1969 | case ShapeInput: | ||
1970 | e->type = ECORE_X_SHAPE_INPUT; | ||
1971 | break; | ||
1972 | |||
1973 | default: | ||
1974 | break; | ||
1975 | } | ||
1976 | e->x = shape_event->x; | ||
1977 | e->y = shape_event->y; | ||
1978 | e->w = shape_event->width; | ||
1979 | e->h = shape_event->height; | ||
1980 | e->shaped = shape_event->shaped; | ||
1981 | ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL); | ||
1982 | } | ||
1983 | |||
1984 | void | ||
1985 | _ecore_x_event_handle_screensaver_notify(XEvent *xevent) | ||
1986 | { | ||
1987 | #ifdef ECORE_XSS | ||
1988 | XScreenSaverNotifyEvent *screensaver_event; | ||
1989 | Ecore_X_Event_Screensaver_Notify *e; | ||
1990 | |||
1991 | _ecore_x_last_event_mouse_move = 0; | ||
1992 | screensaver_event = (XScreenSaverNotifyEvent *)xevent; | ||
1993 | e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify)); | ||
1994 | if (!e) | ||
1995 | return; | ||
1996 | |||
1997 | e->win = screensaver_event->window; | ||
1998 | if (screensaver_event->state == ScreenSaverOn) | ||
1999 | e->on = EINA_TRUE; | ||
2000 | else | ||
2001 | e->on = EINA_FALSE; | ||
2002 | |||
2003 | e->time = screensaver_event->time; | ||
2004 | ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL); | ||
2005 | #else /* ifdef ECORE_XSS */ | ||
2006 | xevent = NULL; | ||
2007 | #endif /* ifdef ECORE_XSS */ | ||
2008 | } | ||
2009 | |||
2010 | void | ||
2011 | _ecore_x_event_handle_sync_counter(XEvent *xevent) | ||
2012 | { | ||
2013 | XSyncCounterNotifyEvent *sync_counter_event; | ||
2014 | Ecore_X_Event_Sync_Counter *e; | ||
2015 | |||
2016 | _ecore_x_last_event_mouse_move = 0; | ||
2017 | sync_counter_event = (XSyncCounterNotifyEvent *)xevent; | ||
2018 | e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter)); | ||
2019 | if (!e) | ||
2020 | return; | ||
2021 | |||
2022 | e->time = sync_counter_event->time; | ||
2023 | ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL); | ||
2024 | } | ||
2025 | |||
2026 | void | ||
2027 | _ecore_x_event_handle_sync_alarm(XEvent *xevent) | ||
2028 | { | ||
2029 | XSyncAlarmNotifyEvent *sync_alarm_event; | ||
2030 | Ecore_X_Event_Sync_Alarm *e; | ||
2031 | |||
2032 | _ecore_x_last_event_mouse_move = 0; | ||
2033 | sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent; | ||
2034 | |||
2035 | e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm)); | ||
2036 | if (!e) | ||
2037 | return; | ||
2038 | |||
2039 | e->time = sync_alarm_event->time; | ||
2040 | e->alarm = sync_alarm_event->alarm; | ||
2041 | ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL); | ||
2042 | } | ||
2043 | |||
2044 | #ifdef ECORE_XRANDR | ||
2045 | void | ||
2046 | _ecore_x_event_handle_randr_change(XEvent *xevent) | ||
2047 | { | ||
2048 | XRRScreenChangeNotifyEvent *randr_event; | ||
2049 | Ecore_X_Event_Screen_Change *e; | ||
2050 | |||
2051 | _ecore_x_last_event_mouse_move = 0; | ||
2052 | randr_event = (XRRScreenChangeNotifyEvent *)xevent; | ||
2053 | if (!XRRUpdateConfiguration(xevent)) | ||
2054 | ERR("Can't update RR config!"); | ||
2055 | |||
2056 | e = calloc(1, sizeof(Ecore_X_Event_Screen_Change)); | ||
2057 | if (!e) | ||
2058 | return; | ||
2059 | |||
2060 | e->win = randr_event->window; | ||
2061 | e->root = randr_event->root; | ||
2062 | e->size.width = randr_event->width; | ||
2063 | e->size.height = randr_event->height; | ||
2064 | e->time = randr_event->timestamp; | ||
2065 | e->config_time = randr_event->config_timestamp; | ||
2066 | e->size.width_mm = randr_event->mwidth; | ||
2067 | e->size.height_mm = randr_event->mheight; | ||
2068 | e->orientation = randr_event->rotation; | ||
2069 | e->subpixel_order = randr_event->subpixel_order; | ||
2070 | ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL); | ||
2071 | } | ||
2072 | |||
2073 | static void | ||
2074 | _ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent) | ||
2075 | { | ||
2076 | const XRRCrtcChangeNotifyEvent *randr_event; | ||
2077 | Ecore_X_Event_Randr_Crtc_Change *e; | ||
2078 | |||
2079 | randr_event = (const XRRCrtcChangeNotifyEvent *)xevent; | ||
2080 | |||
2081 | e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change)); | ||
2082 | if (!e) | ||
2083 | return; | ||
2084 | |||
2085 | e->win = randr_event->window; | ||
2086 | e->crtc = randr_event->crtc; | ||
2087 | e->mode = randr_event->mode; | ||
2088 | e->orientation = randr_event->rotation; | ||
2089 | e->geo.x = randr_event->x; | ||
2090 | e->geo.y = randr_event->y; | ||
2091 | e->geo.w = randr_event->width; | ||
2092 | e->geo.h = randr_event->height; | ||
2093 | ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL); | ||
2094 | } | ||
2095 | |||
2096 | static void | ||
2097 | _ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent) | ||
2098 | { | ||
2099 | const XRROutputChangeNotifyEvent *randr_event; | ||
2100 | Ecore_X_Event_Randr_Output_Change *e; | ||
2101 | |||
2102 | randr_event = (const XRROutputChangeNotifyEvent *)xevent; | ||
2103 | |||
2104 | e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change)); | ||
2105 | if (!e) | ||
2106 | return; | ||
2107 | |||
2108 | e->win = randr_event->window; | ||
2109 | e->output = randr_event->output; | ||
2110 | e->crtc = randr_event->crtc; | ||
2111 | e->mode = randr_event->mode; | ||
2112 | e->orientation = randr_event->rotation; | ||
2113 | e->connection = randr_event->connection; | ||
2114 | e->subpixel_order = randr_event->subpixel_order; | ||
2115 | ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL); | ||
2116 | } | ||
2117 | |||
2118 | static void | ||
2119 | _ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent) | ||
2120 | { | ||
2121 | const XRROutputPropertyNotifyEvent *randr_event; | ||
2122 | Ecore_X_Event_Randr_Output_Property_Notify *e; | ||
2123 | |||
2124 | randr_event = (const XRROutputPropertyNotifyEvent *)xevent; | ||
2125 | |||
2126 | e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify)); | ||
2127 | if (!e) | ||
2128 | return; | ||
2129 | |||
2130 | e->win = randr_event->window; | ||
2131 | e->output = randr_event->output; | ||
2132 | e->property = randr_event->property; | ||
2133 | e->time = randr_event->timestamp; | ||
2134 | if (randr_event->state == PropertyNewValue) | ||
2135 | e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD; | ||
2136 | else | ||
2137 | e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL; | ||
2138 | ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL); | ||
2139 | } | ||
2140 | |||
2141 | void | ||
2142 | _ecore_x_event_handle_randr_notify(XEvent *xevent) | ||
2143 | { | ||
2144 | const XRRNotifyEvent *randr_event; | ||
2145 | |||
2146 | _ecore_x_last_event_mouse_move = 0; | ||
2147 | randr_event = (const XRRNotifyEvent *)xevent; | ||
2148 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2149 | switch (randr_event->subtype) | ||
2150 | { | ||
2151 | case RRNotify_CrtcChange: | ||
2152 | _ecore_x_event_handle_randr_notify_crtc_change(randr_event); | ||
2153 | break; | ||
2154 | |||
2155 | case RRNotify_OutputChange: | ||
2156 | _ecore_x_event_handle_randr_notify_output_change(randr_event); | ||
2157 | break; | ||
2158 | |||
2159 | case RRNotify_OutputProperty: | ||
2160 | _ecore_x_event_handle_randr_notify_output_property(randr_event); | ||
2161 | break; | ||
2162 | |||
2163 | default: | ||
2164 | ERR("Unknown XRandR RRNotify subtype: %d.", | ||
2165 | randr_event->subtype); | ||
2166 | break; | ||
2167 | } | ||
2168 | } | ||
2169 | |||
2170 | #endif /* ifdef ECORE_XRANDR */ | ||
2171 | |||
2172 | #ifdef ECORE_XFIXES | ||
2173 | void | ||
2174 | _ecore_x_event_handle_fixes_selection_notify(XEvent *event) | ||
2175 | { | ||
2176 | XFixesSelectionNotifyEvent *notify_event = | ||
2177 | (XFixesSelectionNotifyEvent *)event; | ||
2178 | Ecore_X_Event_Fixes_Selection_Notify *e; | ||
2179 | Ecore_X_Atom sel; | ||
2180 | |||
2181 | _ecore_x_last_event_mouse_move = 0; | ||
2182 | /* Nothing here yet */ | ||
2183 | |||
2184 | e = calloc(1, sizeof(*e)); | ||
2185 | if (!e) | ||
2186 | return; | ||
2187 | |||
2188 | e->win = notify_event->window; | ||
2189 | e->owner = notify_event->owner; | ||
2190 | e->time = notify_event->timestamp; | ||
2191 | e->selection_time = notify_event->selection_timestamp; | ||
2192 | e->atom = sel = notify_event->selection; | ||
2193 | if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) | ||
2194 | e->selection = ECORE_X_SELECTION_PRIMARY; | ||
2195 | else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) | ||
2196 | e->selection = ECORE_X_SELECTION_SECONDARY; | ||
2197 | else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) | ||
2198 | e->selection = ECORE_X_SELECTION_CLIPBOARD; | ||
2199 | else | ||
2200 | e->selection = ECORE_X_SELECTION_OTHER; | ||
2201 | e->reason = notify_event->subtype; | ||
2202 | |||
2203 | ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL); | ||
2204 | } | ||
2205 | |||
2206 | #endif /* ifdef ECORE_XFIXES */ | ||
2207 | |||
2208 | #ifdef ECORE_XDAMAGE | ||
2209 | void | ||
2210 | _ecore_x_event_handle_damage_notify(XEvent *event) | ||
2211 | { | ||
2212 | XDamageNotifyEvent *damage_event; | ||
2213 | Ecore_X_Event_Damage *e; | ||
2214 | |||
2215 | _ecore_x_last_event_mouse_move = 0; | ||
2216 | damage_event = (XDamageNotifyEvent *)event; | ||
2217 | |||
2218 | e = calloc(1, sizeof(Ecore_X_Event_Damage)); | ||
2219 | if (!e) | ||
2220 | return; | ||
2221 | |||
2222 | e->level = damage_event->level; | ||
2223 | e->drawable = damage_event->drawable; | ||
2224 | e->damage = damage_event->damage; | ||
2225 | e->more = damage_event->more; | ||
2226 | e->time = damage_event->timestamp; | ||
2227 | e->area.x = damage_event->area.x; | ||
2228 | e->area.y = damage_event->area.y; | ||
2229 | e->area.width = damage_event->area.width; | ||
2230 | e->area.height = damage_event->area.height; | ||
2231 | e->geometry.x = damage_event->geometry.x; | ||
2232 | e->geometry.y = damage_event->geometry.y; | ||
2233 | e->geometry.width = damage_event->geometry.width; | ||
2234 | e->geometry.height = damage_event->geometry.height; | ||
2235 | |||
2236 | ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL); | ||
2237 | } | ||
2238 | |||
2239 | #endif /* ifdef ECORE_XDAMAGE */ | ||
2240 | |||
2241 | static void | ||
2242 | _ecore_x_event_free_generic_event(void *data, | ||
2243 | void *ev) | ||
2244 | { | ||
2245 | #ifdef ECORE_XI2 | ||
2246 | Ecore_X_Event_Generic *e = (Ecore_X_Event_Generic *)ev; | ||
2247 | |||
2248 | if (data) | ||
2249 | { | ||
2250 | if (e->data) | ||
2251 | XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data); | ||
2252 | free(data); | ||
2253 | } | ||
2254 | free(e); | ||
2255 | #else | ||
2256 | return; | ||
2257 | data = NULL; ev = NULL; | ||
2258 | #endif /* ifdef ECORE_XI2 */ | ||
2259 | } | ||
2260 | |||
2261 | void | ||
2262 | _ecore_x_event_handle_generic_event(XEvent *event) | ||
2263 | { | ||
2264 | #ifdef ECORE_XI2 | ||
2265 | XGenericEvent *generic_event; | ||
2266 | Ecore_X_Event_Generic *e; | ||
2267 | XGenericEventCookie *data; | ||
2268 | |||
2269 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2270 | generic_event = (XGenericEvent *)event; | ||
2271 | |||
2272 | e = calloc(1, sizeof(Ecore_X_Event_Generic)); | ||
2273 | if (!e) | ||
2274 | return; | ||
2275 | |||
2276 | if (XGetEventData(_ecore_x_disp, &(event->xcookie))) | ||
2277 | { | ||
2278 | e->cookie = event->xcookie.cookie; | ||
2279 | e->data = event->xcookie.data; | ||
2280 | } | ||
2281 | else | ||
2282 | { | ||
2283 | e->cookie = 0; | ||
2284 | e->data = NULL; | ||
2285 | } | ||
2286 | |||
2287 | e->extension = generic_event->extension; | ||
2288 | e->evtype = generic_event->evtype; | ||
2289 | |||
2290 | if (e->extension == _ecore_x_xi2_opcode) | ||
2291 | _ecore_x_input_handler(event); | ||
2292 | |||
2293 | data = malloc(sizeof(XGenericEventCookie)); | ||
2294 | if (data) memcpy(data, &(event->xcookie), sizeof(XGenericEventCookie)); | ||
2295 | ecore_event_add(ECORE_X_EVENT_GENERIC, | ||
2296 | e, | ||
2297 | _ecore_x_event_free_generic_event, | ||
2298 | data); | ||
2299 | #else | ||
2300 | return; | ||
2301 | event = NULL; | ||
2302 | #endif /* ifdef ECORE_XI2 */ | ||
2303 | } | ||
2304 | |||
2305 | #ifdef ECORE_XGESTURE | ||
2306 | void | ||
2307 | _ecore_x_event_handle_gesture_notify_flick(XEvent *xevent) | ||
2308 | { | ||
2309 | XGestureNotifyFlickEvent *xfe; | ||
2310 | Ecore_X_Event_Gesture_Notify_Flick *e; | ||
2311 | |||
2312 | _ecore_x_last_event_mouse_move = 0; | ||
2313 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2314 | |||
2315 | xfe = (XGestureNotifyFlickEvent *)xevent; | ||
2316 | e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)); | ||
2317 | if (!e) | ||
2318 | return; | ||
2319 | |||
2320 | e->win = xfe->window; | ||
2321 | e->time = xfe->time; | ||
2322 | e->subtype = xfe->kind; | ||
2323 | e->num_fingers = xfe->num_finger; | ||
2324 | e->distance = xfe->distance; | ||
2325 | e->duration = xfe->duration; | ||
2326 | e->direction = xfe->direction; | ||
2327 | e->angle = XFixedToDouble(xfe->angle); | ||
2328 | |||
2329 | ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL); | ||
2330 | } | ||
2331 | |||
2332 | void | ||
2333 | _ecore_x_event_handle_gesture_notify_pan(XEvent *xevent) | ||
2334 | { | ||
2335 | XGestureNotifyPanEvent *xpe; | ||
2336 | Ecore_X_Event_Gesture_Notify_Pan *e; | ||
2337 | |||
2338 | _ecore_x_last_event_mouse_move = 0; | ||
2339 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2340 | |||
2341 | xpe = (XGestureNotifyPanEvent *)xevent; | ||
2342 | e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)); | ||
2343 | if (!e) | ||
2344 | return; | ||
2345 | |||
2346 | e->win = xpe->window; | ||
2347 | e->time = xpe->time; | ||
2348 | e->subtype = xpe->kind; | ||
2349 | e->num_fingers = xpe->num_finger; | ||
2350 | e->dx = xpe->dx; | ||
2351 | e->dy = xpe->dy; | ||
2352 | e->distance = xpe->distance; | ||
2353 | e->duration = xpe->duration; | ||
2354 | e->direction = xpe->direction; | ||
2355 | |||
2356 | ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL); | ||
2357 | } | ||
2358 | |||
2359 | void | ||
2360 | _ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent) | ||
2361 | { | ||
2362 | XGestureNotifyPinchRotationEvent *xpre; | ||
2363 | Ecore_X_Event_Gesture_Notify_PinchRotation *e; | ||
2364 | |||
2365 | _ecore_x_last_event_mouse_move = 0; | ||
2366 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2367 | |||
2368 | xpre = (XGestureNotifyPinchRotationEvent *)xevent; | ||
2369 | e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)); | ||
2370 | if (!e) | ||
2371 | return; | ||
2372 | |||
2373 | e->win = xpre->window; | ||
2374 | e->time = xpre->time; | ||
2375 | e->subtype = xpre->kind; | ||
2376 | e->num_fingers = xpre->num_finger; | ||
2377 | e->distance = xpre->distance; | ||
2378 | e->cx = xpre->cx; | ||
2379 | e->cy = xpre->cy; | ||
2380 | e->zoom = XFixedToDouble(xpre->zoom); | ||
2381 | e->angle = XFixedToDouble(xpre->angle); | ||
2382 | |||
2383 | ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL); | ||
2384 | } | ||
2385 | |||
2386 | void | ||
2387 | _ecore_x_event_handle_gesture_notify_tap(XEvent *xevent) | ||
2388 | { | ||
2389 | XGestureNotifyTapEvent *xte; | ||
2390 | Ecore_X_Event_Gesture_Notify_Tap *e; | ||
2391 | |||
2392 | _ecore_x_last_event_mouse_move = 0; | ||
2393 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2394 | |||
2395 | xte = (XGestureNotifyTapEvent *)xevent; | ||
2396 | e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)); | ||
2397 | if (!e) | ||
2398 | return; | ||
2399 | |||
2400 | e->win = xte->window; | ||
2401 | e->time = xte->time; | ||
2402 | e->subtype = xte->kind; | ||
2403 | e->num_fingers = xte->num_finger; | ||
2404 | e->cx = xte->cx; | ||
2405 | e->cy = xte->cy; | ||
2406 | e->tap_repeat = xte->tap_repeat; | ||
2407 | e->interval = xte->interval; | ||
2408 | |||
2409 | ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL); | ||
2410 | } | ||
2411 | |||
2412 | void | ||
2413 | _ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent) | ||
2414 | { | ||
2415 | XGestureNotifyTapNHoldEvent *xthe; | ||
2416 | Ecore_X_Event_Gesture_Notify_TapNHold *e; | ||
2417 | |||
2418 | _ecore_x_last_event_mouse_move = 0; | ||
2419 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2420 | |||
2421 | xthe = (XGestureNotifyTapNHoldEvent *)xevent; | ||
2422 | e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)); | ||
2423 | if (!e) | ||
2424 | return; | ||
2425 | |||
2426 | e->win = xthe->window; | ||
2427 | e->time = xthe->time; | ||
2428 | e->subtype = xthe->kind; | ||
2429 | e->num_fingers = xthe->num_finger; | ||
2430 | e->cx = xthe->cx; | ||
2431 | e->cy = xthe->cy; | ||
2432 | e->interval = xthe->interval; | ||
2433 | e->hold_time = xthe->holdtime; | ||
2434 | |||
2435 | ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL); | ||
2436 | } | ||
2437 | |||
2438 | void | ||
2439 | _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent) | ||
2440 | { | ||
2441 | XGestureNotifyHoldEvent *xhe; | ||
2442 | Ecore_X_Event_Gesture_Notify_Hold *e; | ||
2443 | |||
2444 | _ecore_x_last_event_mouse_move = 0; | ||
2445 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2446 | |||
2447 | xhe = (XGestureNotifyHoldEvent *)xevent; | ||
2448 | e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)); | ||
2449 | if (!e) | ||
2450 | return; | ||
2451 | |||
2452 | e->win = xhe->window; | ||
2453 | e->time = xhe->time; | ||
2454 | e->subtype = xhe->kind; | ||
2455 | e->num_fingers = xhe->num_finger; | ||
2456 | e->cx = xhe->cx; | ||
2457 | e->cy = xhe->cy; | ||
2458 | e->hold_time = xhe->holdtime; | ||
2459 | |||
2460 | ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL); | ||
2461 | } | ||
2462 | |||
2463 | void | ||
2464 | _ecore_x_event_handle_gesture_notify_group(XEvent *xevent) | ||
2465 | { | ||
2466 | XGestureNotifyGroupEvent *xge; | ||
2467 | Ecore_X_Event_Gesture_Notify_Group *e; | ||
2468 | |||
2469 | _ecore_x_last_event_mouse_move = 0; | ||
2470 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
2471 | |||
2472 | xge = (XGestureNotifyGroupEvent *)xevent; | ||
2473 | e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)); | ||
2474 | if (!e) | ||
2475 | return; | ||
2476 | |||
2477 | e->win = xge->window; | ||
2478 | e->time = xge->time; | ||
2479 | e->subtype = xge->kind; | ||
2480 | e->num_groups = xge->num_group; | ||
2481 | e->group_id = xge->groupid; | ||
2482 | |||
2483 | ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL); | ||
2484 | } | ||
2485 | |||
2486 | #endif /* ifdef ECORE_XGESTURE */ | ||
2487 | |||