2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
16 #include "ecore_private.h"
17 #include "ecore_x_private.h"
19 #include "Ecore_X_Atoms.h"
20 #include "Ecore_Input.h"
22 /** OpenBSD does not define CODESET
27 #define CODESET "INVALID"
31 static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
32 static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
33 static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev);
34 static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
35 static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev);
36 static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
39 static Window _ecore_x_mouse_down_last_win = 0;
40 static Window _ecore_x_mouse_down_last_last_win = 0;
41 static Window _ecore_x_mouse_down_last_event_win = 0;
42 static Window _ecore_x_mouse_down_last_last_event_win = 0;
43 static Time _ecore_x_mouse_down_last_time = 0;
44 static Time _ecore_x_mouse_down_last_last_time = 0;
45 static int _ecore_x_mouse_up_count = 0;
46 static int _ecore_x_mouse_down_did_triple = 0;
47 static int _ecore_x_last_event_mouse_move = 0;
48 static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL;
51 _ecore_x_event_free_mouse_move(void *data __UNUSED__, void *ev)
53 Ecore_Event_Mouse_Move *e;
56 if (_ecore_x_last_event_mouse_move)
58 _ecore_x_last_event_mouse_move_event = NULL;
59 _ecore_x_last_event_mouse_move = 0;
65 ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mask mask)
67 XWindowAttributes attr;
68 XSetWindowAttributes s_attr;
70 if (!w) w = DefaultRootWindow(_ecore_x_disp);
71 memset(&attr, 0, sizeof(XWindowAttributes));
72 XGetWindowAttributes(_ecore_x_disp, w, &attr);
73 s_attr.event_mask = mask | attr.your_event_mask;
74 XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
78 ecore_x_event_mask_unset(Ecore_X_Window w, Ecore_X_Event_Mask mask)
80 XWindowAttributes attr;
81 XSetWindowAttributes s_attr;
83 if (!w) w = DefaultRootWindow(_ecore_x_disp);
84 memset(&attr, 0, sizeof(XWindowAttributes));
85 XGetWindowAttributes(_ecore_x_disp, w, &attr);
86 s_attr.event_mask = attr.your_event_mask & ~mask;
87 XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
92 _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev)
94 Ecore_X_Event_Window_Prop_Name_Class_Change *e;
97 if (e->name) free(e->name);
98 if (e->clas) free(e->clas);
103 _ecore_x_event_free_window_prop_title_change(void *data, void *ev)
105 Ecore_X_Event_Window_Prop_Title_Change *e;
108 if (e->title) free(e->title);
113 _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
115 Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
118 if (e->title) free(e->title);
123 _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev)
125 Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
128 if (e->name) free(e->name);
133 _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev)
135 Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
138 if (e->name) free(e->name);
143 _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev)
145 Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
148 if (e->name) free(e->name);
154 _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev)
156 Ecore_X_Event_Xdnd_Enter *e;
160 for (i = 0; i < e->num_types; i++)
167 _ecore_x_event_free_selection_notify(void *data __UNUSED__, void *ev)
169 Ecore_X_Event_Selection_Notify *e;
170 Ecore_X_Selection_Data *sel;
174 if (sel->free) sel->free(sel);
180 _ecore_x_event_modifiers(unsigned int state)
182 unsigned int modifiers = 0;
184 if (state & ECORE_X_MODIFIER_SHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
185 if (state & ECORE_X_MODIFIER_CTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL;
186 if (state & ECORE_X_MODIFIER_ALT) modifiers |= ECORE_EVENT_MODIFIER_ALT;
187 if (state & ECORE_X_MODIFIER_WIN) modifiers |= ECORE_EVENT_MODIFIER_WIN;
188 if (state & ECORE_X_LOCK_SCROLL) modifiers |= ECORE_EVENT_LOCK_SCROLL;
189 if (state & ECORE_X_LOCK_NUM) modifiers |= ECORE_EVENT_LOCK_NUM;
190 if (state & ECORE_X_LOCK_CAPS) modifiers |= ECORE_EVENT_LOCK_CAPS;
196 _ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers,
198 int x_root, int y_root,
199 unsigned int event_window,
201 unsigned int root_win,
203 int dev, int radx, int rady)
205 Ecore_Event_Mouse_Move *e;
208 e = malloc(sizeof(Ecore_Event_Mouse_Move));
212 e->root_window = root_win;
213 e->timestamp = timestamp;
214 e->same_screen = same_screen;
215 e->event_window = event_window;
217 e->modifiers = _ecore_x_event_modifiers(xmodifiers);
224 e->radius = (radx + rady) / 2;
228 event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, _ecore_x_event_free_mouse_move, NULL);
230 _ecore_x_event_last_time = timestamp;
231 _ecore_x_event_last_win = window;
232 _ecore_x_event_last_root_x = x_root;
233 _ecore_x_event_last_root_y = y_root;
235 _ecore_x_last_event_mouse_move_event = event;
239 _ecore_key_press(int event,
243 char *compose = NULL;
247 char keyname_buffer[256];
248 char compose_buffer[256];
250 XComposeStatus status;
253 _ecore_x_last_event_mouse_move = 0;
254 keyname = XKeysymToString(XKeycodeToKeysym(xevent->display,
255 xevent->keycode, 0));
258 snprintf(keyname_buffer, sizeof(keyname_buffer), "Keycode-%i", xevent->keycode);
259 keyname = keyname_buffer;
260 if (!keyname) return ;
269 #ifdef X_HAVE_UTF8_STRING
270 val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
272 val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
274 if (mbstatus == XBufferOverflow)
276 tmp = malloc(sizeof (char) * (val + 1));
281 #ifdef X_HAVE_UTF8_STRING
282 val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
284 val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
290 #ifndef X_HAVE_UTF8_STRING
291 compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", tmp);
301 compose_buffer[val] = 0;
302 #ifdef X_HAVE_UTF8_STRING
303 compose = compose_buffer;
305 compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
312 val = XLookupString(xevent, compose_buffer, sizeof(compose_buffer), &sym, &status);
315 compose_buffer[val] = 0;
316 compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
321 key = XKeysymToString(sym);
322 if (!key) key = keyname;
323 if (!key) goto on_error;
325 e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
326 if (!e) goto on_error;
328 e->keyname = (char*) (e + 1);
329 e->key = e->keyname + strlen(keyname) + 1;
330 e->compose = (compose) ? e->key + strlen(key) + 1 : NULL;
331 e->string = e->compose;
333 strcpy((char *) e->keyname, keyname);
334 strcpy((char *) e->key, key);
335 if (compose) strcpy((char *) e->compose, compose);
337 e->modifiers = _ecore_x_event_modifiers(xevent->state);
339 e->timestamp = xevent->time;
340 e->window = xevent->subwindow ? xevent->subwindow : xevent->window;
341 e->event_window = xevent->window;
342 e->same_screen = xevent->same_screen;
343 e->root_window = xevent->root;
345 ecore_event_add(event, e, NULL, NULL);
347 _ecore_x_event_last_time = e->timestamp;
353 static Ecore_Event_Mouse_Button*
354 _ecore_mouse_button(int event,
355 unsigned int timestamp, unsigned int xmodifiers,
356 unsigned int buttons,
358 int x_root, int y_root,
359 unsigned int event_window,
361 unsigned int root_win,
363 int dev, int radx, int rady)
365 Ecore_Event_Mouse_Button *e;
367 e = malloc(sizeof(Ecore_Event_Mouse_Button));
371 e->root_window = root_win;
372 e->timestamp = timestamp;
373 e->same_screen = same_screen;
374 e->event_window = event_window;
376 e->buttons = buttons;
377 e->modifiers = _ecore_x_event_modifiers(xmodifiers);
385 if (event_window == window)
387 if (((int)(timestamp - _ecore_x_mouse_down_last_time) <=
388 (int)(1000 * _ecore_x_double_click_time)) &&
389 (window == _ecore_x_mouse_down_last_win) &&
390 (event_window == _ecore_x_mouse_down_last_event_win)
393 if (((int)(timestamp - _ecore_x_mouse_down_last_last_time) <=
394 (int)(2 * 1000 * _ecore_x_double_click_time)) &&
395 (window == _ecore_x_mouse_down_last_win) &&
396 (window == _ecore_x_mouse_down_last_last_win) &&
397 (event_window == _ecore_x_mouse_down_last_event_win) &&
398 (event_window == _ecore_x_mouse_down_last_last_event_win)
402 _ecore_x_mouse_down_did_triple = 1;
405 _ecore_x_mouse_down_did_triple = 0;
408 if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN
411 _ecore_x_mouse_up_count = 0;
414 e->radius = (radx + rady) / 2;
418 _ecore_x_event_last_time = e->timestamp;
419 _ecore_x_event_last_win = e->window;
420 _ecore_x_event_last_root_x = x_root;
421 _ecore_x_event_last_root_y = y_root;
423 ecore_event_add(event, e, NULL, NULL);
429 extern int _ecore_x_xi2_opcode;
433 _ecore_x_event_handle_any_event(XEvent *xevent)
435 XEvent* ev = malloc(sizeof(XEvent));
436 memcpy(ev, xevent, sizeof(XEvent));
438 ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
441 if (xevent->xcookie.type == GenericEvent &&
442 xevent->xcookie.extension == opcode)
444 if (XGetEventData(_ecore_x_disp &(xevent->xcookie)))
446 XIDeviceEvent* evd = (XIDeviceEvent *)(xevent->xcookie.data);
447 int devid = evd->deviceid;
449 //printf("deviceID = %d\n", devid);
450 switch (xevent->xcookie.evtype)
454 (xevent->xcookie.time, // ???
456 evd->event_x, evd->event_y,
457 evd->root_x, evd->root_y,
458 xevent->xcookie.window, // ???
459 (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window), // ???
460 xevent->xcookie.root, // ???
461 xevent->xcookie.same_screen, // ???
464 //printf("motion\n");
469 (ECORE_EVENT_MOUSE_BUTTON_DOWN,
470 (xevent->xcookie.time, // ???
473 evd->event_x, evd->event_y,
474 evd->root_x, evd->root_y,
475 xevent->xcookie.window, // ???
476 (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window), // ???
477 xevent->xcookie.root, // ???
478 xevent->xcookie.same_screen, // ???
480 //printf("abs X:%f Y:%f - ", evd->root_x, evd->root_y);
481 //printf("win X:%f Y:%f\n", evd->event_x, evd->event_y);
484 case XI_ButtonRelease:
486 (ECORE_EVENT_MOUSE_BUTTON_UP,
487 (xevent->xcookie.time, // ???
490 evd->event_x, evd->event_y,
491 evd->root_x, evd->root_y,
492 xevent->xcookie.window, // ???
493 (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window), // ???
494 xevent->xcookie.root, // ???
495 xevent->xcookie.same_screen, // ???
497 //printf("unclick\n");
503 XFreeEventData(_ecore_x_disp &(xevent->xcookie));
508 _ecore_x_event_handle_key_press(XEvent *xevent)
510 _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *) xevent);
514 _ecore_x_event_handle_key_release(XEvent *xevent)
516 _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *) xevent);
520 _ecore_x_event_handle_button_press(XEvent *xevent)
524 _ecore_x_last_event_mouse_move = 0;
525 if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8))
527 Ecore_Event_Mouse_Wheel *e;
529 e = malloc(sizeof(Ecore_Event_Mouse_Wheel));
532 e->timestamp = xevent->xbutton.time;
533 e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state);
534 switch (xevent->xbutton.button)
536 case 4: e->direction = 0; e->z = -1; break;
537 case 5: e->direction = 0; e->z = 1; break;
538 case 6: e->direction = 1; e->z = -1; break;
539 case 7: e->direction = 1; e->z = 1; break;
540 default: e->direction = 0; e->z = 0; break;
543 e->x = xevent->xbutton.x;
544 e->y = xevent->xbutton.y;
545 e->root.x = xevent->xbutton.x_root;
546 e->root.y = xevent->xbutton.y_root;
548 if (xevent->xbutton.subwindow) e->window = xevent->xbutton.subwindow;
549 else e->window = xevent->xbutton.window;
550 e->event_window = xevent->xbutton.window;
551 e->same_screen = xevent->xbutton.same_screen;
552 e->root_window = xevent->xbutton.root;
554 _ecore_x_event_last_time = e->timestamp;
555 _ecore_x_event_last_win = e->window;
556 _ecore_x_event_last_root_x = xevent->xbutton.x_root;
557 _ecore_x_event_last_root_y = xevent->xbutton.y_root;
558 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
560 for (i = 0; i < _ecore_window_grabs_num; i++)
562 if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
563 (_ecore_window_grabs[i] == xevent->xbutton.subwindow))
567 if (_ecore_window_grab_replay_func)
568 replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
569 ECORE_EVENT_MOUSE_WHEEL,
572 XAllowEvents(xevent->xbutton.display,
573 ReplayPointer, xevent->xbutton.time);
575 XAllowEvents(xevent->xbutton.display,
576 AsyncPointer, xevent->xbutton.time);
584 _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
585 xevent->xbutton.x, xevent->xbutton.y,
586 xevent->xbutton.x_root, xevent->xbutton.y_root,
587 xevent->xbutton.window,
588 (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
589 xevent->xbutton.root,
590 xevent->xbutton.same_screen, 0, 1, 1);
593 Ecore_Event_Mouse_Button *e;
597 if (_ecore_x_mouse_down_did_triple)
599 _ecore_x_mouse_down_last_win = 0;
600 _ecore_x_mouse_down_last_last_win = 0;
601 _ecore_x_mouse_down_last_event_win = 0;
602 _ecore_x_mouse_down_last_last_event_win = 0;
603 _ecore_x_mouse_down_last_time = 0;
604 _ecore_x_mouse_down_last_last_time = 0;
607 window = (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window);
608 event_window = xevent->xbutton.window;
610 e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
611 xevent->xbutton.time, xevent->xbutton.state,
612 xevent->xbutton.button,
613 xevent->xbutton.x, xevent->xbutton.y,
614 xevent->xbutton.x_root, xevent->xbutton.y_root,
615 event_window, window,
616 xevent->xbutton.root, xevent->xbutton.same_screen,
619 for (i = 0; i < _ecore_window_grabs_num; i++)
621 if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
622 (_ecore_window_grabs[i] == xevent->xbutton.subwindow))
626 if (_ecore_window_grab_replay_func)
627 replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
628 ECORE_EVENT_MOUSE_BUTTON_DOWN,
631 XAllowEvents(xevent->xbutton.display,
632 ReplayPointer, xevent->xbutton.time);
634 XAllowEvents(xevent->xbutton.display,
635 AsyncPointer, xevent->xbutton.time);
640 if (window == event_window)
642 if (!_ecore_x_mouse_down_did_triple)
644 _ecore_x_mouse_down_last_last_win = _ecore_x_mouse_down_last_win;
645 if (xevent->xbutton.subwindow)
646 _ecore_x_mouse_down_last_win = xevent->xbutton.subwindow;
648 _ecore_x_mouse_down_last_win = xevent->xbutton.window;
649 _ecore_x_mouse_down_last_last_event_win = _ecore_x_mouse_down_last_event_win;
650 _ecore_x_mouse_down_last_event_win = xevent->xbutton.window;
651 _ecore_x_mouse_down_last_last_time = _ecore_x_mouse_down_last_time;
652 _ecore_x_mouse_down_last_time = xevent->xbutton.time;
660 _ecore_x_event_handle_button_release(XEvent *xevent)
662 _ecore_x_last_event_mouse_move = 0;
663 /* filter out wheel buttons */
664 if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7))
666 _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
667 xevent->xbutton.x, xevent->xbutton.y,
668 xevent->xbutton.x_root, xevent->xbutton.y_root,
669 xevent->xbutton.window,
670 (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
671 xevent->xbutton.root,
672 xevent->xbutton.same_screen, 0, 1, 1);
674 _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
675 xevent->xbutton.time, xevent->xbutton.state,
676 xevent->xbutton.button,
677 xevent->xbutton.x, xevent->xbutton.y,
678 xevent->xbutton.x_root, xevent->xbutton.y_root,
679 xevent->xbutton.window,
680 (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
681 xevent->xbutton.root,
682 xevent->xbutton.same_screen,
688 _ecore_x_event_handle_motion_notify(XEvent *xevent)
691 if (_ecore_x_last_event_mouse_move)
693 ecore_event_del(_ecore_x_last_event_mouse_move_event);
694 _ecore_x_last_event_mouse_move = 0;
695 _ecore_x_last_event_mouse_move_event = NULL;
698 _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state,
699 xevent->xmotion.x, xevent->xmotion.y,
700 xevent->xmotion.x_root, xevent->xmotion.y_root,
701 xevent->xmotion.window,
702 (xevent->xmotion.subwindow ? xevent->xmotion.subwindow : xevent->xmotion.window),
703 xevent->xmotion.root,
704 xevent->xmotion.same_screen, 0, 1, 1);
706 _ecore_x_last_event_mouse_move = 1;
709 _ecore_x_dnd_drag(xevent->xmotion.root, xevent->xmotion.x_root, xevent->xmotion.y_root);
713 _ecore_x_event_handle_enter_notify(XEvent *xevent)
715 _ecore_x_last_event_mouse_move = 0;
717 _ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state,
718 xevent->xcrossing.x, xevent->xcrossing.y,
719 xevent->xcrossing.x_root, xevent->xcrossing.y_root,
720 xevent->xcrossing.window,
721 (xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window),
722 xevent->xcrossing.root,
723 xevent->xcrossing.same_screen, 0, 1, 1);
726 Ecore_X_Event_Mouse_In *e;
728 e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
730 e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
731 e->x = xevent->xcrossing.x;
732 e->y = xevent->xcrossing.y;
733 e->root.x = xevent->xcrossing.x_root;
734 e->root.y = xevent->xcrossing.y_root;
735 if (xevent->xcrossing.subwindow) e->win = xevent->xcrossing.subwindow;
736 else e->win = xevent->xcrossing.window;
737 e->same_screen = xevent->xcrossing.same_screen;
738 e->root_win = xevent->xcrossing.root;
739 e->event_win = xevent->xcrossing.window;
741 if (xevent->xcrossing.mode == NotifyNormal)
742 e->mode = ECORE_X_EVENT_MODE_NORMAL;
743 else if (xevent->xcrossing.mode == NotifyGrab)
744 e->mode = ECORE_X_EVENT_MODE_GRAB;
745 else if (xevent->xcrossing.mode == NotifyUngrab)
746 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
748 if (xevent->xcrossing.detail == NotifyAncestor)
749 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
750 else if (xevent->xcrossing.detail == NotifyVirtual)
751 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
752 else if (xevent->xcrossing.detail == NotifyInferior)
753 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
754 else if (xevent->xcrossing.detail == NotifyNonlinear)
755 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
756 else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
757 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
759 e->time = xevent->xcrossing.time;
760 _ecore_x_event_last_time = e->time;
761 ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL);
766 _ecore_x_event_handle_leave_notify(XEvent *xevent)
768 _ecore_x_last_event_mouse_move = 0;
770 _ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state,
771 xevent->xcrossing.x, xevent->xcrossing.y,
772 xevent->xcrossing.x_root, xevent->xcrossing.y_root,
773 xevent->xcrossing.window,
774 (xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window),
775 xevent->xcrossing.root,
776 xevent->xcrossing.same_screen, 0, 1, 1);
779 Ecore_X_Event_Mouse_Out *e;
781 e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
783 e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
784 e->x = xevent->xcrossing.x;
785 e->y = xevent->xcrossing.y;
786 e->root.x = xevent->xcrossing.x_root;
787 e->root.y = xevent->xcrossing.y_root;
788 if (xevent->xcrossing.subwindow) e->win = xevent->xcrossing.subwindow;
789 else e->win = xevent->xcrossing.window;
790 e->same_screen = xevent->xcrossing.same_screen;
791 e->root_win = xevent->xcrossing.root;
792 e->event_win = xevent->xcrossing.window;
794 if (xevent->xcrossing.mode == NotifyNormal)
795 e->mode = ECORE_X_EVENT_MODE_NORMAL;
796 else if (xevent->xcrossing.mode == NotifyGrab)
797 e->mode = ECORE_X_EVENT_MODE_GRAB;
798 else if (xevent->xcrossing.mode == NotifyUngrab)
799 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
801 if (xevent->xcrossing.detail == NotifyAncestor)
802 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
803 else if (xevent->xcrossing.detail == NotifyVirtual)
804 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
805 else if (xevent->xcrossing.detail == NotifyInferior)
806 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
807 else if (xevent->xcrossing.detail == NotifyNonlinear)
808 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
809 else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
810 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
812 e->time = xevent->xcrossing.time;
813 _ecore_x_event_last_time = e->time;
814 _ecore_x_event_last_win = e->win;
815 _ecore_x_event_last_root_x = e->root.x;
816 _ecore_x_event_last_root_y = e->root.y;
817 ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL);
822 _ecore_x_event_handle_focus_in(XEvent *xevent)
824 Ecore_X_Event_Window_Focus_In *e;
826 _ecore_x_last_event_mouse_move = 0;
831 XSetICValues(_ecore_x_ic, XNFocusWindow, xevent->xfocus.window, NULL);
832 if ((str = XmbResetIC(_ecore_x_ic)))
834 XSetICFocus(_ecore_x_ic);
836 e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
838 e->win = xevent->xfocus.window;
840 if (xevent->xfocus.mode == NotifyNormal)
841 e->mode = ECORE_X_EVENT_MODE_NORMAL;
842 else if (xevent->xfocus.mode == NotifyWhileGrabbed)
843 e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
844 else if (xevent->xfocus.mode == NotifyGrab)
845 e->mode = ECORE_X_EVENT_MODE_GRAB;
846 else if (xevent->xfocus.mode == NotifyUngrab)
847 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
849 if (xevent->xfocus.detail == NotifyAncestor)
850 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
851 else if (xevent->xfocus.detail == NotifyVirtual)
852 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
853 else if (xevent->xfocus.detail == NotifyInferior)
854 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
855 else if (xevent->xfocus.detail == NotifyNonlinear)
856 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
857 else if (xevent->xfocus.detail == NotifyNonlinearVirtual)
858 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
859 else if (xevent->xfocus.detail == NotifyPointer)
860 e->detail = ECORE_X_EVENT_DETAIL_POINTER;
861 else if (xevent->xfocus.detail == NotifyPointerRoot)
862 e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
863 else if (xevent->xfocus.detail == NotifyDetailNone)
864 e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
866 e->time = _ecore_x_event_last_time;
867 _ecore_x_event_last_time = e->time;
868 ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
872 _ecore_x_event_handle_focus_out(XEvent *xevent)
874 Ecore_X_Event_Window_Focus_Out *e;
876 _ecore_x_last_event_mouse_move = 0;
877 if (_ecore_x_ic) XUnsetICFocus(_ecore_x_ic);
878 e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
880 e->win = xevent->xfocus.window;
882 if (xevent->xfocus.mode == NotifyNormal)
883 e->mode = ECORE_X_EVENT_MODE_NORMAL;
884 else if (xevent->xfocus.mode == NotifyWhileGrabbed)
885 e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
886 else if (xevent->xfocus.mode == NotifyGrab)
887 e->mode = ECORE_X_EVENT_MODE_GRAB;
888 else if (xevent->xfocus.mode == NotifyUngrab)
889 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
891 if (xevent->xfocus.detail == NotifyAncestor)
892 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
893 else if (xevent->xfocus.detail == NotifyVirtual)
894 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
895 else if (xevent->xfocus.detail == NotifyInferior)
896 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
897 else if (xevent->xfocus.detail == NotifyNonlinear)
898 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
899 else if (xevent->xfocus.detail == NotifyNonlinearVirtual)
900 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
901 else if (xevent->xfocus.detail == NotifyPointer)
902 e->detail = ECORE_X_EVENT_DETAIL_POINTER;
903 else if (xevent->xfocus.detail == NotifyPointerRoot)
904 e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
905 else if (xevent->xfocus.detail == NotifyDetailNone)
906 e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
908 e->time = _ecore_x_event_last_time;
909 _ecore_x_event_last_time = e->time;
910 ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
914 _ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__)
916 _ecore_x_last_event_mouse_move = 0;
917 /* FIXME: handle this event type */
921 _ecore_x_event_handle_expose(XEvent *xevent)
923 Ecore_X_Event_Window_Damage *e;
925 _ecore_x_last_event_mouse_move = 0;
926 e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
928 e->win = xevent->xexpose.window;
929 e->time = _ecore_x_event_last_time;
930 e->x = xevent->xexpose.x;
931 e->y = xevent->xexpose.y;
932 e->w = xevent->xexpose.width;
933 e->h = xevent->xexpose.height;
934 e->count = xevent->xexpose.count;
935 ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
939 _ecore_x_event_handle_graphics_expose(XEvent *xevent)
941 Ecore_X_Event_Window_Damage *e;
943 _ecore_x_last_event_mouse_move = 0;
944 e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
946 e->win = xevent->xgraphicsexpose.drawable;
947 e->time = _ecore_x_event_last_time;
948 e->x = xevent->xgraphicsexpose.x;
949 e->y = xevent->xgraphicsexpose.y;
950 e->w = xevent->xgraphicsexpose.width;
951 e->h = xevent->xgraphicsexpose.height;
952 e->count = xevent->xgraphicsexpose.count;
953 ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
957 _ecore_x_event_handle_visibility_notify(XEvent *xevent)
959 _ecore_x_last_event_mouse_move = 0;
960 // if (xevent->xvisibility.state != VisibilityPartiallyObscured)
962 Ecore_X_Event_Window_Visibility_Change *e;
964 e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
966 e->win = xevent->xvisibility.window;
967 e->time = _ecore_x_event_last_time;
968 if (xevent->xvisibility.state == VisibilityFullyObscured)
969 e->fully_obscured = 1;
971 e->fully_obscured = 0;
972 ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
977 _ecore_x_event_handle_create_notify(XEvent *xevent)
979 Ecore_X_Event_Window_Create *e;
981 _ecore_x_last_event_mouse_move = 0;
982 e = calloc(1, sizeof(Ecore_X_Event_Window_Create));
984 e->win = xevent->xcreatewindow.window;
985 e->parent = xevent->xcreatewindow.parent;
986 if (xevent->xcreatewindow.override_redirect)
990 e->x = xevent->xcreatewindow.x;
991 e->y = xevent->xcreatewindow.y;
992 e->w = xevent->xcreatewindow.width;
993 e->h = xevent->xcreatewindow.height;
994 e->border = xevent->xcreatewindow.border_width;
995 e->time = _ecore_x_event_last_time;
996 ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
1000 _ecore_x_event_handle_destroy_notify(XEvent *xevent)
1002 Ecore_X_Event_Window_Destroy *e;
1004 _ecore_x_last_event_mouse_move = 0;
1005 e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy));
1007 e->win = xevent->xdestroywindow.window;
1008 e->event_win = xevent->xdestroywindow.event;
1009 e->time = _ecore_x_event_last_time;
1010 if (e->win == _ecore_x_event_last_win) _ecore_x_event_last_win = 0;
1011 ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL);
1015 _ecore_x_event_handle_unmap_notify(XEvent *xevent)
1017 Ecore_X_Event_Window_Hide *e;
1019 _ecore_x_last_event_mouse_move = 0;
1020 e = calloc(1, sizeof(Ecore_X_Event_Window_Hide));
1022 e->win = xevent->xunmap.window;
1023 e->event_win = xevent->xunmap.event;
1024 e->time = _ecore_x_event_last_time;
1025 ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL);
1029 _ecore_x_event_handle_map_notify(XEvent *xevent)
1031 Ecore_X_Event_Window_Show *e;
1033 _ecore_x_last_event_mouse_move = 0;
1034 e = calloc(1, sizeof(Ecore_X_Event_Window_Show));
1036 e->win = xevent->xmap.window;
1037 e->event_win = xevent->xmap.event;
1038 e->time = _ecore_x_event_last_time;
1039 ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL);
1043 _ecore_x_event_handle_map_request(XEvent *xevent)
1045 Ecore_X_Event_Window_Show_Request *e;
1047 _ecore_x_last_event_mouse_move = 0;
1048 e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request));
1050 e->win = xevent->xmaprequest.window;
1051 e->time = _ecore_x_event_last_time;
1052 e->parent = xevent->xmaprequest.parent;
1053 ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL);
1057 _ecore_x_event_handle_reparent_notify(XEvent *xevent)
1059 Ecore_X_Event_Window_Reparent *e;
1061 _ecore_x_last_event_mouse_move = 0;
1062 e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent));
1064 e->win = xevent->xreparent.window;
1065 e->event_win = xevent->xreparent.event;
1066 e->parent = xevent->xreparent.parent;
1067 e->time = _ecore_x_event_last_time;
1068 ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL);
1072 _ecore_x_event_handle_configure_notify(XEvent *xevent)
1074 Ecore_X_Event_Window_Configure *e;
1076 _ecore_x_last_event_mouse_move = 0;
1077 e = calloc(1, sizeof(Ecore_X_Event_Window_Configure));
1079 e->win = xevent->xconfigure.window;
1080 e->event_win = xevent->xconfigure.event;
1081 e->abovewin = xevent->xconfigure.above;
1082 e->x = xevent->xconfigure.x;
1083 e->y = xevent->xconfigure.y;
1084 e->w = xevent->xconfigure.width;
1085 e->h = xevent->xconfigure.height;
1086 e->border = xevent->xconfigure.border_width;
1087 e->override = xevent->xconfigure.override_redirect;
1088 e->from_wm = xevent->xconfigure.send_event;
1089 e->time = _ecore_x_event_last_time;
1090 ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
1094 _ecore_x_event_handle_configure_request(XEvent *xevent)
1096 Ecore_X_Event_Window_Configure_Request *e;
1098 _ecore_x_last_event_mouse_move = 0;
1099 e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request));
1101 e->win = xevent->xconfigurerequest.window;
1102 e->parent_win = xevent->xconfigurerequest.parent;
1103 e->abovewin = xevent->xconfigurerequest.above;
1104 e->x = xevent->xconfigurerequest.x;
1105 e->y = xevent->xconfigurerequest.y;
1106 e->w = xevent->xconfigurerequest.width;
1107 e->h = xevent->xconfigurerequest.height;
1108 e->border = xevent->xconfigurerequest.border_width;
1109 e->value_mask = xevent->xconfigurerequest.value_mask;
1110 e->time = _ecore_x_event_last_time;
1112 if (xevent->xconfigurerequest.detail == Above)
1113 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1114 else if (xevent->xconfigurerequest.detail == Below)
1115 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1116 else if (xevent->xconfigurerequest.detail == TopIf)
1117 e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
1118 else if (xevent->xconfigurerequest.detail == BottomIf)
1119 e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
1120 else if (xevent->xconfigurerequest.detail == Opposite)
1121 e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
1123 ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
1127 _ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__)
1129 _ecore_x_last_event_mouse_move = 0;
1130 /* FIXME: handle this event type */
1134 _ecore_x_event_handle_resize_request(XEvent *xevent)
1136 Ecore_X_Event_Window_Resize_Request *e;
1138 _ecore_x_last_event_mouse_move = 0;
1139 e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request));
1141 e->win = xevent->xresizerequest.window;
1142 e->w = xevent->xresizerequest.width;
1143 e->h = xevent->xresizerequest.height;
1144 e->time = _ecore_x_event_last_time;
1145 ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL);
1149 _ecore_x_event_handle_circulate_notify(XEvent *xevent)
1151 Ecore_X_Event_Window_Stack *e;
1153 _ecore_x_last_event_mouse_move = 0;
1154 e = calloc(1, sizeof(Ecore_X_Event_Window_Stack));
1156 e->win = xevent->xcirculate.window;
1157 e->event_win = xevent->xcirculate.event;
1158 if (xevent->xcirculate.place == PlaceOnTop)
1159 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1161 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1162 e->time = _ecore_x_event_last_time;
1163 ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL);
1167 _ecore_x_event_handle_circulate_request(XEvent *xevent)
1169 Ecore_X_Event_Window_Stack_Request *e;
1171 _ecore_x_last_event_mouse_move = 0;
1172 e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request));
1174 e->win = xevent->xcirculaterequest.window;
1175 e->parent = xevent->xcirculaterequest.parent;
1176 if (xevent->xcirculaterequest.place == PlaceOnTop)
1177 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1179 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1180 e->time = _ecore_x_event_last_time;
1181 ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL);
1185 _ecore_x_event_handle_property_notify(XEvent *xevent)
1187 _ecore_x_last_event_mouse_move = 0;
1188 #if 0 /* for now i disabled this. nice idea though this is - it leaves a lot
1189 * to be desired for efficiency that is better left to the app layer
1191 if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLASS)
1193 Ecore_X_Event_Window_Prop_Name_Class_Change *e;
1195 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change));
1197 ecore_x_window_prop_name_class_get(xevent->xproperty.window,
1198 &(e->name), &(e->clas));
1199 e->time = xevent->xproperty.time;
1200 _ecore_x_event_last_time = e->time;
1201 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e,
1202 _ecore_x_event_free_window_prop_name_class_change, NULL);
1204 else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) ||
1205 (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_NAME))
1207 Ecore_X_Event_Window_Prop_Title_Change *e;
1209 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change));
1211 e->title = ecore_x_window_prop_title_get(xevent->xproperty.window);
1212 e->time = xevent->xproperty.time;
1213 _ecore_x_event_last_time = e->time;
1214 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e,
1215 _ecore_x_event_free_window_prop_title_change, NULL);
1217 else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_NAME)
1219 Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
1221 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change));
1223 e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window);
1224 e->time = xevent->xproperty.time;
1225 _ecore_x_event_last_time = e->time;
1226 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e,
1227 _ecore_x_event_free_window_prop_visible_title_change, NULL);
1229 else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) ||
1230 (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_ICON_NAME))
1232 Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
1234 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
1236 e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
1237 e->time = xevent->xproperty.time;
1238 _ecore_x_event_last_time = e->time;
1239 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e,
1240 _ecore_x_event_free_window_prop_icon_name_change, NULL);
1242 else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME)
1244 Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
1246 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change));
1248 e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window);
1249 e->time = xevent->xproperty.time;
1250 _ecore_x_event_last_time = e->time;
1251 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e,
1252 _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
1254 else if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
1256 Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
1258 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
1260 e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window);
1261 e->time = xevent->xproperty.time;
1262 _ecore_x_event_last_time = e->time;
1263 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e,
1264 _ecore_x_event_free_window_prop_client_machine_change, NULL);
1266 else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_PID)
1268 Ecore_X_Event_Window_Prop_Pid_Change *e;
1270 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
1272 e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
1273 e->time = xevent->xproperty.time;
1274 _ecore_x_event_last_time = e->time;
1275 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
1277 else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_DESKTOP)
1279 Ecore_X_Event_Window_Prop_Desktop_Change *e;
1281 e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change));
1283 e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window);
1284 ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
1289 Ecore_X_Event_Window_Property *e;
1291 e = calloc(1,sizeof(Ecore_X_Event_Window_Property));
1293 e->win = xevent->xproperty.window;
1294 e->atom = xevent->xproperty.atom;
1295 e->time = xevent->xproperty.time;
1296 _ecore_x_event_last_time = e->time;
1297 ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL);
1302 _ecore_x_event_handle_selection_clear(XEvent *xevent)
1304 Ecore_X_Selection_Intern *d;
1305 Ecore_X_Event_Selection_Clear *e;
1308 _ecore_x_last_event_mouse_move = 0;
1309 d = _ecore_x_selection_get(xevent->xselectionclear.selection);
1310 if (d && (xevent->xselectionclear.time > d->time))
1312 _ecore_x_selection_set(None, NULL, 0,
1313 xevent->xselectionclear.selection);
1316 /* Generate event for app cleanup */
1317 e = malloc(sizeof(Ecore_X_Event_Selection_Clear));
1318 e->win = xevent->xselectionclear.window;
1319 e->time = xevent->xselectionclear.time;
1320 e->atom = sel = xevent->xselectionclear.selection;
1321 if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
1322 e->selection = ECORE_X_SELECTION_PRIMARY;
1323 else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
1324 e->selection = ECORE_X_SELECTION_SECONDARY;
1325 else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
1326 e->selection = ECORE_X_SELECTION_CLIPBOARD;
1328 e->selection = ECORE_X_SELECTION_OTHER;
1329 ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
1333 _ecore_x_event_handle_selection_request(XEvent *xevent)
1335 Ecore_X_Event_Selection_Request *e;
1336 Ecore_X_Selection_Intern *sd;
1339 _ecore_x_last_event_mouse_move = 0;
1341 * Generate a selection request event.
1343 e = malloc(sizeof(Ecore_X_Event_Selection_Request));
1344 e->owner = xevent->xselectionrequest.owner;
1345 e->requestor = xevent->xselectionrequest.requestor;
1346 e->time = xevent->xselectionrequest.time;
1347 e->selection = xevent->xselectionrequest.selection;
1348 e->target = xevent->xselectionrequest.target;
1349 e->property = xevent->xselectionrequest.property;
1350 ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL);
1352 if ((sd = _ecore_x_selection_get(xevent->xselectionrequest.selection)) &&
1353 (sd->win == xevent->xselectionrequest.owner))
1355 Ecore_X_Selection_Intern *si;
1357 si = _ecore_x_selection_get(xevent->xselectionrequest.selection);
1360 Ecore_X_Atom property;
1362 if (!ecore_x_selection_convert(xevent->xselectionrequest.selection,
1363 xevent->xselectionrequest.target,
1366 /* Refuse selection, conversion to requested target failed */
1371 /* FIXME: This does not properly handle large data transfers */
1372 ecore_x_window_prop_property_set(xevent->xselectionrequest.requestor,
1373 xevent->xselectionrequest.property,
1374 xevent->xselectionrequest.target,
1375 8, data, sd->length);
1376 property = xevent->xselectionrequest.property;
1380 ecore_x_selection_notify_send(xevent->xselectionrequest.requestor,
1381 xevent->xselectionrequest.selection,
1382 xevent->xselectionrequest.target,
1384 xevent->xselectionrequest.time);
1391 _ecore_x_event_handle_selection_notify(XEvent *xevent)
1393 Ecore_X_Event_Selection_Notify *e;
1394 unsigned char *data = NULL;
1395 Ecore_X_Atom selection;
1396 int num_ret, format;
1398 _ecore_x_last_event_mouse_move = 0;
1399 selection = xevent->xselection.selection;
1401 if (xevent->xselection.target == ECORE_X_ATOM_SELECTION_TARGETS)
1403 format = ecore_x_window_prop_property_get(xevent->xselection.requestor,
1404 xevent->xselection.property,
1405 XA_ATOM, 32, &data, &num_ret);
1406 if (!format) return;
1410 format = ecore_x_window_prop_property_get(xevent->xselection.requestor,
1411 xevent->xselection.property,
1412 AnyPropertyType, 8, &data,
1414 if (!format) return;
1417 e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify));
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);
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;
1433 e->selection = ECORE_X_SELECTION_OTHER;
1435 e->data = _ecore_x_selection_parse(e->target, data, num_ret, format);
1437 ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e,
1438 _ecore_x_event_free_selection_notify, NULL);
1442 _ecore_x_event_handle_colormap_notify(XEvent *xevent)
1444 Ecore_X_Event_Window_Colormap *e;
1446 _ecore_x_last_event_mouse_move = 0;
1447 e = calloc(1,sizeof(Ecore_X_Event_Window_Colormap));
1449 e->win = xevent->xcolormap.window;
1450 e->cmap = xevent->xcolormap.colormap;
1451 e->time = _ecore_x_event_last_time;
1452 if (xevent->xcolormap.state == ColormapInstalled)
1456 ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
1460 _ecore_x_event_handle_client_message(XEvent *xevent)
1462 _ecore_x_last_event_mouse_move = 0;
1463 /* Special client message event handling here. need to put LOTS of if */
1464 /* checks here and generate synthetic events per special message known */
1465 /* otherwise generate generic client message event. this would handle*/
1466 /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */
1467 if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) &&
1468 (xevent->xclient.format == 32) &&
1469 (xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW))
1471 Ecore_X_Event_Window_Delete_Request *e;
1473 e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request));
1475 e->win = xevent->xclient.window;
1476 e->time = _ecore_x_event_last_time;
1477 ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
1480 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_MOVERESIZE) &&
1481 (xevent->xclient.format == 32) &&
1482 /* Ignore move and resize with keyboard */
1483 (xevent->xclient.data.l[2] < 9))
1485 Ecore_X_Event_Window_Move_Resize_Request *e;
1487 e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request));
1489 e->win = xevent->xclient.window;
1490 e->x = xevent->xclient.data.l[0];
1491 e->y = xevent->xclient.data.l[1];
1492 e->direction = xevent->xclient.data.l[2];
1493 e->button = xevent->xclient.data.l[3];
1494 e->source = xevent->xclient.data.l[4];
1495 ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
1498 /* Xdnd Client Message Handling Begin */
1499 /* Message Type: XdndEnter target */
1500 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_ENTER)
1502 Ecore_X_Event_Xdnd_Enter *e;
1503 Ecore_X_DND_Target *target;
1505 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
1508 target = _ecore_x_dnd_target_get();
1509 target->state = ECORE_X_DND_TARGET_ENTERED;
1510 target->source = xevent->xclient.data.l[0];
1511 target->win = xevent->xclient.window;
1512 target->version = (int) (xevent->xclient.data.l[1] >> 24);
1513 if (target->version > ECORE_X_DND_VERSION)
1515 WRN("DND: Requested version %d, we only support up to %d",
1516 target->version, ECORE_X_DND_VERSION);
1520 if (xevent->xclient.data.l[1] & 0x1UL)
1522 /* source supports more than 3 types, fetch property */
1523 unsigned char *data;
1524 Ecore_X_Atom *types;
1527 if (!(ecore_x_window_prop_property_get(target->source,
1528 ECORE_X_ATOM_XDND_TYPE_LIST,
1530 32, &data, &num_ret)))
1532 WRN("DND: Could not fetch data type list from source window, aborting.");
1535 types = (Ecore_X_Atom *)data;
1536 e->types = calloc(num_ret, sizeof(char *));
1539 for (i = 0; i < num_ret; i++)
1540 e->types[i] = XGetAtomName(_ecore_x_disp, types[i]);
1542 e->num_types = num_ret;
1548 e->types = calloc(3, sizeof(char *));
1551 while ((i < 3) && (xevent->xclient.data.l[i + 2]))
1553 e->types[i] = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[i + 2]);
1560 e->win = target->win;
1561 e->source = target->source;
1562 ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e,
1563 _ecore_x_event_free_xdnd_enter, NULL);
1566 /* Message Type: XdndPosition target */
1567 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_POSITION)
1569 Ecore_X_Event_Xdnd_Position *e;
1570 Ecore_X_DND_Target *target;
1572 target = _ecore_x_dnd_target_get();
1573 if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) ||
1574 (target->win != xevent->xclient.window))
1577 target->pos.x = xevent->xclient.data.l[2] >> 16;
1578 target->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL;
1579 target->action = xevent->xclient.data.l[4]; /* Version 2 */
1581 target->time = (target->version >= 1) ?
1582 (Time)xevent->xclient.data.l[3] : CurrentTime;
1584 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
1586 e->win = target->win;
1587 e->source = target->source;
1588 e->position.x = target->pos.x;
1589 e->position.y = target->pos.y;
1590 e->action = target->action;
1591 ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
1594 /* Message Type: XdndStatus source */
1595 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_STATUS)
1597 Ecore_X_Event_Xdnd_Status *e;
1598 Ecore_X_DND_Source *source;
1600 source = _ecore_x_dnd_source_get();
1601 /* Make sure source/target match */
1602 if ((source->win != xevent->xclient.window ) ||
1603 (source->dest != (Window)xevent->xclient.data.l[0]))
1606 source->await_status = 0;
1608 source->will_accept = xevent->xclient.data.l[1] & 0x1UL;
1609 source->suppress = (xevent->xclient.data.l[1] & 0x2UL) ? 0 : 1;
1611 source->rectangle.x = xevent->xclient.data.l[2] >> 16;
1612 source->rectangle.y = xevent->xclient.data.l[2] & 0xFFFFUL;
1613 source->rectangle.width = xevent->xclient.data.l[3] >> 16;
1614 source->rectangle.height = xevent->xclient.data.l[3] & 0xFFFFUL;
1616 source->accepted_action = xevent->xclient.data.l[4];
1618 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
1620 e->win = source->win;
1621 e->target = source->dest;
1622 e->will_accept = source->will_accept;
1623 e->rectangle.x = source->rectangle.x;
1624 e->rectangle.y = source->rectangle.y;
1625 e->rectangle.width = source->rectangle.width;
1626 e->rectangle.height = source->rectangle.height;
1627 e->action = source->accepted_action;
1629 ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
1632 /* Message Type: XdndLeave target */
1633 /* Pretend the whole thing never happened, sort of */
1634 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_LEAVE)
1636 Ecore_X_Event_Xdnd_Leave *e;
1637 Ecore_X_DND_Target *target;
1639 target = _ecore_x_dnd_target_get();
1640 if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) ||
1641 (target->win != xevent->xclient.window))
1644 target->state = ECORE_X_DND_TARGET_IDLE;
1646 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
1648 e->win = xevent->xclient.window;
1649 e->source = (Window)xevent->xclient.data.l[0];
1650 ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
1653 /* Message Type: XdndDrop target */
1654 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_DROP)
1656 Ecore_X_Event_Xdnd_Drop *e;
1657 Ecore_X_DND_Target *target;
1659 target = _ecore_x_dnd_target_get();
1660 /* Match source/target */
1661 if ((target->source != (Window)xevent->xclient.data.l[0]) ||
1662 (target->win != xevent->xclient.window))
1665 target->time = (target->version >= 1) ?
1666 (Time)xevent->xclient.data.l[2] : _ecore_x_event_last_time;
1668 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
1670 e->win = target->win;
1671 e->source = target->source;
1672 e->action = target->action;
1673 e->position.x = target->pos.x;
1674 e->position.y = target->pos.y;
1675 ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
1678 /* Message Type: XdndFinished source */
1679 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_FINISHED)
1681 Ecore_X_Event_Xdnd_Finished *e;
1682 Ecore_X_DND_Source *source;
1685 source = _ecore_x_dnd_source_get();
1686 /* Match source/target */
1687 if ((source->win != xevent->xclient.window) ||
1688 (source->dest != (Window)xevent->xclient.data.l[0]))
1691 if ((source->version < 5) || (xevent->xclient.data.l[1] & 0x1UL))
1693 /* Target successfully performed drop action */
1694 ecore_x_selection_xdnd_clear();
1695 source->state = ECORE_X_DND_SOURCE_IDLE;
1697 else if (source->version >= 5)
1700 source->state = ECORE_X_DND_SOURCE_CONVERTING;
1702 /* FIXME: Probably need to add a timer to switch back to idle
1703 * and discard the selection data */
1706 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished));
1708 e->win = source->win;
1709 e->target = source->dest;
1710 e->completed = completed;
1711 if (source->version >= 5)
1713 source->accepted_action = xevent->xclient.data.l[2];
1714 e->action = source->accepted_action;
1718 source->accepted_action = 0;
1719 e->action = source->action;
1722 ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
1724 else if (xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_STATE)
1726 Ecore_X_Event_Window_State_Request *e;
1728 e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
1730 e->win = xevent->xclient.window;
1731 if (xevent->xclient.data.l[0] == 0)
1732 e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
1733 else if (xevent->xclient.data.l[0] == 1)
1734 e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
1735 else if (xevent->xclient.data.l[0] == 2)
1736 e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
1742 e->state[0] = _ecore_x_netwm_state_get(xevent->xclient.data.l[1]);
1743 if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
1747 name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]);
1748 if (name) ERR("Unknown state: %s", name);
1751 e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]);
1752 if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
1756 name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]);
1757 if (name) ERR("Unknown state: %s", name);
1760 e->source = xevent->xclient.data.l[3];
1762 ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
1764 else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_CHANGE_STATE)
1765 && (xevent->xclient.format == 32)
1766 && (xevent->xclient.data.l[0] == IconicState))
1768 Ecore_X_Event_Window_State_Request *e;
1770 e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
1772 e->win = xevent->xclient.window;
1773 e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
1774 e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
1776 ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
1778 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_DESKTOP)
1779 && (xevent->xclient.format == 32))
1781 Ecore_X_Event_Desktop_Change *e;
1783 e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
1785 e->win = xevent->xclient.window;
1786 e->desk = xevent->xclient.data.l[0];
1787 e->source = xevent->xclient.data.l[1];
1789 ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
1791 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS))
1793 Ecore_X_Event_Frame_Extents_Request *e;
1795 e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
1797 e->win = xevent->xclient.window;
1799 ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
1801 else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS)
1802 && ((Ecore_X_Atom)xevent->xclient.data.l[0] == ECORE_X_ATOM_NET_WM_PING)
1803 && (xevent->xclient.format == 32))
1805 Ecore_X_Event_Ping *e;
1807 e = calloc(1, sizeof(Ecore_X_Event_Ping));
1809 e->win = xevent->xclient.window;
1810 e->time = xevent->xclient.data.l[1];
1811 e->event_win = xevent->xclient.data.l[2];
1813 ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
1815 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) &&
1816 (xevent->xclient.format == 8))
1818 _ecore_x_netwm_startup_info_begin(xevent->xclient.window, xevent->xclient.data.b);
1820 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_STARTUP_INFO) &&
1821 (xevent->xclient.format == 8))
1823 _ecore_x_netwm_startup_info(xevent->xclient.window, xevent->xclient.data.b);
1825 else if ((xevent->xclient.message_type == 27777)
1826 && (xevent->xclient.data.l[0] == 0x7162534)
1827 && (xevent->xclient.format == 32)
1828 && (xevent->xclient.window == _ecore_x_private_win))
1830 /* a grab sync marker */
1831 if (xevent->xclient.data.l[1] == 0x10000001)
1832 _ecore_x_window_grab_remove(xevent->xclient.data.l[2]);
1833 else if (xevent->xclient.data.l[1] == 0x10000002)
1834 _ecore_x_key_grab_remove(xevent->xclient.data.l[2]);
1838 Ecore_X_Event_Client_Message *e;
1841 e = calloc(1, sizeof(Ecore_X_Event_Client_Message));
1843 e->win = xevent->xclient.window;
1844 e->message_type = xevent->xclient.message_type;
1845 e->format = xevent->xclient.format;
1846 for (i = 0; i < 5; i++)
1847 e->data.l[i] = xevent->xclient.data.l[i];
1849 ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
1854 _ecore_x_event_handle_mapping_notify(XEvent *xevent)
1856 _ecore_x_last_event_mouse_move = 0;
1857 XRefreshKeyboardMapping((XMappingEvent *)xevent);
1861 _ecore_x_event_handle_shape_change(XEvent *xevent)
1863 XShapeEvent *shape_event;
1864 Ecore_X_Event_Window_Shape *e;
1866 _ecore_x_last_event_mouse_move = 0;
1867 shape_event = (XShapeEvent *)xevent;
1868 e = calloc(1, sizeof(Ecore_X_Event_Window_Shape));
1870 e->win = shape_event->window;
1871 e->time = shape_event->time;
1872 ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL);
1876 _ecore_x_event_handle_screensaver_notify(XEvent *xevent)
1879 XScreenSaverNotifyEvent *screensaver_event;
1880 Ecore_X_Event_Screensaver_Notify *e;
1882 _ecore_x_last_event_mouse_move = 0;
1883 screensaver_event = (XScreenSaverNotifyEvent *)xevent;
1884 e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify));
1886 e->win = screensaver_event->window;
1887 if (screensaver_event->state == ScreenSaverOn)
1891 e->time = screensaver_event->time;
1892 ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL);
1899 _ecore_x_event_handle_sync_counter(XEvent *xevent)
1901 XSyncCounterNotifyEvent *sync_counter_event;
1902 Ecore_X_Event_Sync_Counter *e;
1904 _ecore_x_last_event_mouse_move = 0;
1905 sync_counter_event = (XSyncCounterNotifyEvent *)xevent;
1906 e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter));
1908 e->time = sync_counter_event->time;
1909 ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
1913 _ecore_x_event_handle_sync_alarm(XEvent *xevent)
1915 XSyncAlarmNotifyEvent *sync_alarm_event;
1916 Ecore_X_Event_Sync_Alarm *e;
1918 _ecore_x_last_event_mouse_move = 0;
1919 sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent;
1921 e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm));
1923 e->time = sync_alarm_event->time;
1924 e->alarm = sync_alarm_event->alarm;
1925 ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
1930 _ecore_x_event_handle_randr_change(XEvent *xevent)
1932 XRRScreenChangeNotifyEvent *randr_event;
1933 Ecore_X_Event_Screen_Change *e;
1935 _ecore_x_last_event_mouse_move = 0;
1936 randr_event = (XRRScreenChangeNotifyEvent *)xevent;
1937 if (!XRRUpdateConfiguration(xevent))
1938 ERR("Can't update RR config!");
1940 e = calloc(1, sizeof(Ecore_X_Event_Screen_Change));
1942 e->win = randr_event->window;
1943 e->root = randr_event->root;
1944 e->width = randr_event->width;
1945 e->height = randr_event->height;
1946 e->time = randr_event->timestamp;
1947 e->config_time = randr_event->config_timestamp;
1948 e->mm_width = randr_event->mwidth;
1949 e->mm_height = randr_event->mheight;
1950 e->rotation = randr_event->rotation;
1951 e->subpixel_order = randr_event->subpixel_order;
1952 ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL);
1956 _ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent)
1958 const XRRCrtcChangeNotifyEvent *randr_event;
1959 Ecore_X_Event_Randr_Crtc_Change *e;
1961 randr_event = (const XRRCrtcChangeNotifyEvent *)xevent;
1963 e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change));
1965 e->win = randr_event->window;
1966 e->crtc = randr_event->crtc;
1967 e->mode = randr_event->mode;
1968 e->rotation = randr_event->rotation;
1969 e->x = randr_event->x;
1970 e->y = randr_event->y;
1971 e->width = randr_event->width;
1972 e->height = randr_event->height;
1973 ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL);
1977 _ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent)
1979 const XRROutputChangeNotifyEvent *randr_event;
1980 Ecore_X_Event_Randr_Output_Change *e;
1982 randr_event = (const XRROutputChangeNotifyEvent *)xevent;
1984 e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change));
1986 e->win = randr_event->window;
1987 e->output = randr_event->output;
1988 e->crtc = randr_event->crtc;
1989 e->mode = randr_event->mode;
1990 e->rotation = randr_event->rotation;
1991 e->connection = randr_event->connection;
1992 e->subpixel_order = randr_event->subpixel_order;
1996 _ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent)
1998 const XRROutputPropertyNotifyEvent *randr_event;
1999 Ecore_X_Event_Randr_Output_Property_Notify *e;
2001 randr_event = (const XRROutputPropertyNotifyEvent *)xevent;
2003 e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify));
2005 e->win = randr_event->window;
2006 e->output = randr_event->output;
2007 e->property = randr_event->property;
2008 e->time = randr_event->timestamp;
2009 e->state = randr_event->state;
2013 _ecore_x_event_handle_randr_notify(XEvent *xevent)
2015 const XRRNotifyEvent *randr_event;
2017 _ecore_x_last_event_mouse_move = 0;
2018 randr_event = (const XRRNotifyEvent *)xevent;
2019 switch (randr_event->subtype)
2021 case RRNotify_CrtcChange:
2022 _ecore_x_event_handle_randr_notify_crtc_change(randr_event);
2024 case RRNotify_OutputChange:
2025 _ecore_x_event_handle_randr_notify_output_change(randr_event);
2027 case RRNotify_OutputProperty:
2028 _ecore_x_event_handle_randr_notify_output_property(randr_event);
2031 ERR("Unknown XRandR RRNotify subtype: %d.",
2032 randr_event->subtype);
2040 _ecore_x_event_handle_fixes_selection_notify(XEvent *event)
2042 _ecore_x_last_event_mouse_move = 0;
2043 /* Nothing here yet */
2048 #ifdef ECORE_XDAMAGE
2050 _ecore_x_event_handle_damage_notify(XEvent *event)
2052 XDamageNotifyEvent *damage_event;
2053 Ecore_X_Event_Damage *e;
2055 _ecore_x_last_event_mouse_move = 0;
2056 damage_event = (XDamageNotifyEvent *)event;
2058 e = calloc(1, sizeof(Ecore_X_Event_Damage));
2061 e->level = damage_event->level;
2062 e->drawable = damage_event->drawable;
2063 e->damage = damage_event->damage;
2064 e->more = damage_event->more;
2065 e->time = damage_event->timestamp;
2066 e->area.x = damage_event->area.x;
2067 e->area.y = damage_event->area.y;
2068 e->area.width = damage_event->area.width;
2069 e->area.height = damage_event->area.height;
2070 e->geometry.x = damage_event->geometry.x;
2071 e->geometry.y = damage_event->geometry.y;
2072 e->geometry.width = damage_event->geometry.width;
2073 e->geometry.height = damage_event->geometry.height;
2075 ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL);