forked from enlightenment/efl
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
This commit is contained in:
parent
beb6fa61c7
commit
8400c9d3d2
|
@ -477,12 +477,14 @@ _ecore_x_init2(void)
|
||||||
#ifdef ECORE_XKB
|
#ifdef ECORE_XKB
|
||||||
{
|
{
|
||||||
int dummy;
|
int dummy;
|
||||||
|
|
||||||
if (XkbQueryExtension(_ecore_x_disp, &dummy, &xkb_base,
|
if (XkbQueryExtension(_ecore_x_disp, &dummy, &xkb_base,
|
||||||
&dummy, &dummy, &dummy))
|
&dummy, &dummy, &dummy))
|
||||||
_ecore_x_event_xkb_id = xkb_base;
|
_ecore_x_event_xkb_id = xkb_base;
|
||||||
XkbSelectEventDetails(_ecore_x_disp, XkbUseCoreKbd, XkbStateNotify,
|
XkbSelectEventDetails(_ecore_x_disp, XkbUseCoreKbd, XkbStateNotify,
|
||||||
XkbAllStateComponentsMask, XkbGroupStateMask);
|
XkbAllStateComponentsMask, XkbGroupStateMask);
|
||||||
|
XkbSelectEventDetails(_ecore_x_disp, XkbUseCoreKbd, XkbNewKeyboardNotify,
|
||||||
|
XkbNewKeyboardNotifyMask, XkbNewKeyboardNotifyMask);
|
||||||
}
|
}
|
||||||
ECORE_X_EVENT_HANDLERS_GROW(xkb_base, XkbNumberEvents);
|
ECORE_X_EVENT_HANDLERS_GROW(xkb_base, XkbNumberEvents);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,6 +40,10 @@ static int _ecore_x_last_event_mouse_move = 0;
|
||||||
static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL;
|
static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL;
|
||||||
static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL;
|
static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL;
|
||||||
|
|
||||||
|
#ifdef ECORE_XKB
|
||||||
|
static Eina_Hash *emitted_events = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_x_mouse_down_info_clear(void)
|
_ecore_x_mouse_down_info_clear(void)
|
||||||
{
|
{
|
||||||
|
@ -58,12 +62,18 @@ void
|
||||||
_ecore_x_events_init(void)
|
_ecore_x_events_init(void)
|
||||||
{
|
{
|
||||||
//Actually, Nothing to do.
|
//Actually, Nothing to do.
|
||||||
|
#ifdef ECORE_XKB
|
||||||
|
emitted_events = eina_hash_int64_new(NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_ecore_x_events_shutdown(void)
|
_ecore_x_events_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_x_mouse_down_info_clear();
|
_ecore_x_mouse_down_info_clear();
|
||||||
|
#ifdef ECORE_XKB
|
||||||
|
eina_hash_free(emitted_events);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ecore_X_Mouse_Down_Info *
|
static Ecore_X_Mouse_Down_Info *
|
||||||
|
@ -2614,22 +2624,40 @@ _ecore_x_event_handle_gesture_notify_group(XEvent *xevent)
|
||||||
|
|
||||||
#endif /* ifdef ECORE_XGESTURE */
|
#endif /* ifdef ECORE_XGESTURE */
|
||||||
#ifdef ECORE_XKB
|
#ifdef ECORE_XKB
|
||||||
|
|
||||||
|
void
|
||||||
|
free_hash(void *userdata EINA_UNUSED, void *funcdata EINA_UNUSED)
|
||||||
|
{
|
||||||
|
eina_hash_del_by_data(emitted_events, (void*) 1);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_ecore_x_event_handle_xkb(XEvent *xevent)
|
_ecore_x_event_handle_xkb(XEvent *xevent)
|
||||||
{
|
{
|
||||||
XkbEvent *xkbev;
|
XkbEvent *xkbev;
|
||||||
Ecore_X_Event_Xkb *e;
|
|
||||||
|
|
||||||
xkbev = (XkbEvent *) xevent;
|
xkbev = (XkbEvent *) xevent;
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Xkb));
|
|
||||||
if (!e)
|
|
||||||
return;
|
|
||||||
e->group = xkbev->state.group;
|
|
||||||
if (xkbev->any.xkb_type == XkbStateNotify)
|
if (xkbev->any.xkb_type == XkbStateNotify)
|
||||||
ecore_event_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, e, NULL, NULL);
|
{
|
||||||
|
Ecore_X_Event_Xkb *e;
|
||||||
|
|
||||||
|
if (eina_hash_find(emitted_events, &xkbev->state.serial)) return;
|
||||||
|
|
||||||
|
e = calloc(1, sizeof(Ecore_X_Event_Xkb));
|
||||||
|
if (!e)
|
||||||
|
return;
|
||||||
|
|
||||||
|
e->group = xkbev->state.group;
|
||||||
|
ecore_event_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, e, free_hash, NULL);
|
||||||
|
eina_hash_add(emitted_events, &xkbev->state.serial, (void*) 1);
|
||||||
|
}
|
||||||
else if ((xkbev->any.xkb_type == XkbNewKeyboardNotify) ||
|
else if ((xkbev->any.xkb_type == XkbNewKeyboardNotify) ||
|
||||||
(xkbev->any.xkb_type == XkbMapNotify))
|
(xkbev->any.xkb_type == XkbMapNotify))
|
||||||
{
|
{
|
||||||
|
if (eina_hash_find(emitted_events, &xkbev->state.serial)) return;
|
||||||
|
|
||||||
if (xkbev->any.xkb_type == XkbMapNotify)
|
if (xkbev->any.xkb_type == XkbMapNotify)
|
||||||
{
|
{
|
||||||
XkbMapNotifyEvent *xkbmapping;
|
XkbMapNotifyEvent *xkbmapping;
|
||||||
|
@ -2637,7 +2665,8 @@ _ecore_x_event_handle_xkb(XEvent *xevent)
|
||||||
xkbmapping = (XkbMapNotifyEvent *)xkbev;
|
xkbmapping = (XkbMapNotifyEvent *)xkbev;
|
||||||
XkbRefreshKeyboardMapping(xkbmapping);
|
XkbRefreshKeyboardMapping(xkbmapping);
|
||||||
}
|
}
|
||||||
ecore_event_add(ECORE_X_EVENT_XKB_NEWKBD_NOTIFY, e, NULL, NULL);
|
ecore_event_add(ECORE_X_EVENT_XKB_NEWKBD_NOTIFY, NULL, free_hash, NULL);
|
||||||
|
eina_hash_add(emitted_events, &xkbev->new_kbd.serial, (void*) 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* ifdef ECORE_XKB */
|
#endif /* ifdef ECORE_XKB */
|
||||||
|
|
Loading…
Reference in New Issue