summaryrefslogtreecommitdiff
path: root/src/lib/ecore_x
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-04-05 15:11:29 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-04-07 14:02:29 +0200
commit8400c9d3d2eecde87fab0e8cd5781a8b1acd54cb (patch)
tree6d59a8f0a8954ec9a63a686411253cf2fdda2418 /src/lib/ecore_x
parentbeb6fa61c7a3939eb3df50c31e20079801b00219 (diff)
ecore_x: fix emission of ECORE_X_EVENT_XKB_NEWKBD_NOTIFY
Summary: the event XkbNewKeyboardNotify was never selected with XkbSelectEventDetails so the event type could never occur. The event is now each time emitted when a new event to the keyboard happens. To clarify a bit: A new keyboard is always detected in x when the set of keymaps changes. @fix Reviewers: raster, devilhorns, zmike Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3867
Diffstat (limited to 'src/lib/ecore_x')
-rw-r--r--src/lib/ecore_x/xlib/ecore_x.c4
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_events.c45
2 files changed, 40 insertions, 9 deletions
diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c
index 7f2dc52820..546257b2da 100644
--- a/src/lib/ecore_x/xlib/ecore_x.c
+++ b/src/lib/ecore_x/xlib/ecore_x.c
@@ -477,12 +477,14 @@ _ecore_x_init2(void)
477#ifdef ECORE_XKB 477#ifdef ECORE_XKB
478 { 478 {
479 int dummy; 479 int dummy;
480 480
481 if (XkbQueryExtension(_ecore_x_disp, &dummy, &xkb_base, 481 if (XkbQueryExtension(_ecore_x_disp, &dummy, &xkb_base,
482 &dummy, &dummy, &dummy)) 482 &dummy, &dummy, &dummy))
483 _ecore_x_event_xkb_id = xkb_base; 483 _ecore_x_event_xkb_id = xkb_base;
484 XkbSelectEventDetails(_ecore_x_disp, XkbUseCoreKbd, XkbStateNotify, 484 XkbSelectEventDetails(_ecore_x_disp, XkbUseCoreKbd, XkbStateNotify,
485 XkbAllStateComponentsMask, XkbGroupStateMask); 485 XkbAllStateComponentsMask, XkbGroupStateMask);
486 XkbSelectEventDetails(_ecore_x_disp, XkbUseCoreKbd, XkbNewKeyboardNotify,
487 XkbNewKeyboardNotifyMask, XkbNewKeyboardNotifyMask);
486 } 488 }
487 ECORE_X_EVENT_HANDLERS_GROW(xkb_base, XkbNumberEvents); 489 ECORE_X_EVENT_HANDLERS_GROW(xkb_base, XkbNumberEvents);
488#endif 490#endif
diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/xlib/ecore_x_events.c
index 4fe5eeb58d..cf5ec17b57 100644
--- a/src/lib/ecore_x/xlib/ecore_x_events.c
+++ b/src/lib/ecore_x/xlib/ecore_x_events.c
@@ -40,6 +40,10 @@ static int _ecore_x_last_event_mouse_move = 0;
40static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL; 40static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL;
41static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL; 41static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL;
42 42
43#ifdef ECORE_XKB
44static Eina_Hash *emitted_events = NULL;
45#endif
46
43static void 47static void
44_ecore_x_mouse_down_info_clear(void) 48_ecore_x_mouse_down_info_clear(void)
45{ 49{
@@ -58,12 +62,18 @@ void
58_ecore_x_events_init(void) 62_ecore_x_events_init(void)
59{ 63{
60 //Actually, Nothing to do. 64 //Actually, Nothing to do.
65#ifdef ECORE_XKB
66 emitted_events = eina_hash_int64_new(NULL);
67#endif
61} 68}
62 69
63void 70void
64_ecore_x_events_shutdown(void) 71_ecore_x_events_shutdown(void)
65{ 72{
66 _ecore_x_mouse_down_info_clear(); 73 _ecore_x_mouse_down_info_clear();
74#ifdef ECORE_XKB
75 eina_hash_free(emitted_events);
76#endif
67} 77}
68 78
69static Ecore_X_Mouse_Down_Info * 79static Ecore_X_Mouse_Down_Info *
@@ -2614,22 +2624,40 @@ _ecore_x_event_handle_gesture_notify_group(XEvent *xevent)
2614 2624
2615#endif /* ifdef ECORE_XGESTURE */ 2625#endif /* ifdef ECORE_XGESTURE */
2616#ifdef ECORE_XKB 2626#ifdef ECORE_XKB
2627
2628void
2629free_hash(void *userdata EINA_UNUSED, void *funcdata EINA_UNUSED)
2630{
2631 eina_hash_del_by_data(emitted_events, (void*) 1);
2632}
2633
2617void 2634void
2618_ecore_x_event_handle_xkb(XEvent *xevent) 2635_ecore_x_event_handle_xkb(XEvent *xevent)
2619{ 2636{
2620 XkbEvent *xkbev; 2637 XkbEvent *xkbev;
2621 Ecore_X_Event_Xkb *e; 2638
2622
2623 xkbev = (XkbEvent *) xevent; 2639 xkbev = (XkbEvent *) xevent;
2624 e = calloc(1, sizeof(Ecore_X_Event_Xkb)); 2640
2625 if (!e) 2641
2626 return;
2627 e->group = xkbev->state.group;
2628 if (xkbev->any.xkb_type == XkbStateNotify) 2642 if (xkbev->any.xkb_type == XkbStateNotify)
2629 ecore_event_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, e, NULL, NULL); 2643 {
2644 Ecore_X_Event_Xkb *e;
2645
2646 if (eina_hash_find(emitted_events, &xkbev->state.serial)) return;
2647
2648 e = calloc(1, sizeof(Ecore_X_Event_Xkb));
2649 if (!e)
2650 return;
2651
2652 e->group = xkbev->state.group;
2653 ecore_event_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, e, free_hash, NULL);
2654 eina_hash_add(emitted_events, &xkbev->state.serial, (void*) 1);
2655 }
2630 else if ((xkbev->any.xkb_type == XkbNewKeyboardNotify) || 2656 else if ((xkbev->any.xkb_type == XkbNewKeyboardNotify) ||
2631 (xkbev->any.xkb_type == XkbMapNotify)) 2657 (xkbev->any.xkb_type == XkbMapNotify))
2632 { 2658 {
2659 if (eina_hash_find(emitted_events, &xkbev->state.serial)) return;
2660
2633 if (xkbev->any.xkb_type == XkbMapNotify) 2661 if (xkbev->any.xkb_type == XkbMapNotify)
2634 { 2662 {
2635 XkbMapNotifyEvent *xkbmapping; 2663 XkbMapNotifyEvent *xkbmapping;
@@ -2637,7 +2665,8 @@ _ecore_x_event_handle_xkb(XEvent *xevent)
2637 xkbmapping = (XkbMapNotifyEvent *)xkbev; 2665 xkbmapping = (XkbMapNotifyEvent *)xkbev;
2638 XkbRefreshKeyboardMapping(xkbmapping); 2666 XkbRefreshKeyboardMapping(xkbmapping);
2639 } 2667 }
2640 ecore_event_add(ECORE_X_EVENT_XKB_NEWKBD_NOTIFY, e, NULL, NULL); 2668 ecore_event_add(ECORE_X_EVENT_XKB_NEWKBD_NOTIFY, NULL, free_hash, NULL);
2669 eina_hash_add(emitted_events, &xkbev->new_kbd.serial, (void*) 1);
2641 } 2670 }
2642} 2671}
2643#endif /* ifdef ECORE_XKB */ 2672#endif /* ifdef ECORE_XKB */