diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c index 28772a9845..8909746ee7 100644 --- a/src/lib/ecore_drm/ecore_drm_evdev.c +++ b/src/lib/ecore_drm/ecore_drm_evdev.c @@ -291,11 +291,13 @@ static void _device_notify_key(Ecore_Drm_Evdev *dev, struct input_event *event, unsigned int timestamp) { unsigned int code, nsyms; + unsigned int *keycode; const xkb_keysym_t *syms; xkb_keysym_t sym = XKB_KEY_NoSymbol; char key[256], keyname[256], compose[256]; Ecore_Event_Key *e; Ecore_Drm_Input *input; + int evtype; if (!(input = dev->seat->input)) return; @@ -354,14 +356,18 @@ _device_notify_key(Ecore_Drm_Evdev *dev, struct input_event *event, unsigned int e->root_window = (Ecore_Window)input->dev->window; e->timestamp = timestamp; e->same_screen = 1; + e->keycode = event->code; + e->data = NULL; _device_modifiers_update(dev); e->modifiers = dev->xkb.modifiers; if (event->value) - ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); + evtype = ECORE_EVENT_KEY_DOWN; else - ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL); + evtype = ECORE_EVENT_KEY_UP; + + ecore_event_add(evtype, e, NULL, NULL); } static void diff --git a/src/lib/ecore_input/Ecore_Input.h b/src/lib/ecore_input/Ecore_Input.h index ec40af8062..46e3e6ea87 100644 --- a/src/lib/ecore_input/Ecore_Input.h +++ b/src/lib/ecore_input/Ecore_Input.h @@ -119,6 +119,10 @@ extern "C" { unsigned int modifiers; int same_screen; + + unsigned int keycode; /**< Key scan code numeric value @since 1.10 */ + + void *data; /**< User data associated with an Ecore_Event_Key @since 1.10 */ }; struct _Ecore_Event_Mouse_Button diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c index ef08c48c59..52058624fa 100644 --- a/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/src/lib/ecore_input_evas/ecore_input_evas.c @@ -332,9 +332,23 @@ _ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press) if (!lookup) return ECORE_CALLBACK_PASS_ON; ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); if (press == ECORE_DOWN) - evas_event_feed_key_down(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL); + evas_event_feed_key_down_with_keycode(lookup->evas, + e->keyname, + e->key, + e->string, + e->compose, + e->timestamp, + e->data, + e->keycode); else - evas_event_feed_key_up(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL); + evas_event_feed_key_up_with_keycode(lookup->evas, + e->keyname, + e->key, + e->string, + e->compose, + e->timestamp, + e->data, + e->keycode); return ECORE_CALLBACK_PASS_ON; } diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index 3012548210..88c4b61bed 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -733,6 +733,8 @@ struct _Evas_Event_Key_Down /** Key press event */ unsigned int timestamp; Evas_Event_Flags event_flags; Evas_Device *dev; + + unsigned int keycode; /**< Key scan code numeric value @since 1.10 */ }; struct _Evas_Event_Key_Up /** Key release event */ @@ -748,6 +750,8 @@ struct _Evas_Event_Key_Up /** Key release event */ unsigned int timestamp; Evas_Event_Flags event_flags; Evas_Device *dev; + + unsigned int keycode; /**< Key scan code numeric value @since 1.10 */ }; struct _Evas_Event_Render_Post /** Send when the frame rendering is done @since 1.8 */ diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 848649e27e..751c97f3a8 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -208,4 +208,4 @@ EAPI extern const Eo_Event_Description _EVAS_CANVAS_EVENT_RENDER_POST; #include"canvas/evas_image.eo.h" -#include "canvas/evas_out.eo.h" \ No newline at end of file +#include "canvas/evas_out.eo.h" diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 6957ab9743..05a1e000bd 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -1245,6 +1245,46 @@ EAPI void evas_event_feed_key_down(Evas *e, const char *keyname, const char *key */ EAPI void evas_event_feed_key_up(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) EINA_ARG_NONNULL(1); +/** + * Key down event feed with keycode + * + * @param e The canvas to thaw out + * @param keyname Name of the key + * @param key The key pressed. + * @param string A String + * @param compose The compose string + * @param timestamp Timestamp of the mouse up event + * @param data Data for canvas. + * @param keycode Key scan code numeric value for canvas. + * + * This function will set some evas properties that is necessary when + * a key is pressed. It prepares information to be treated by the + * callback function. + * + * @since 1.10 + */ +EAPI void evas_event_feed_key_down_with_keycode(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data, unsigned int keycode) EINA_ARG_NONNULL(1); + +/** + * Key up event feed with keycode + * + * @param e The canvas to thaw out + * @param keyname Name of the key + * @param key The key released. + * @param string string + * @param compose compose + * @param timestamp Timestamp of the mouse up event + * @param data Data for canvas. + * @param keycode Key scan code numeric value for canvas. + * + * This function will set some evas properties that is necessary when + * a key is released. It prepares information to be treated by the + * callback function. + * + * @since 1.10 + */ +EAPI void evas_event_feed_key_up_with_keycode(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data, unsigned int keycode) EINA_ARG_NONNULL(1); + /** * Hold event feed * diff --git a/src/lib/evas/canvas/evas.eo b/src/lib/evas/canvas/evas.eo index d6367c91c1..12a105cec2 100644 --- a/src/lib/evas/canvas/evas.eo +++ b/src/lib/evas/canvas/evas.eo @@ -1730,6 +1730,46 @@ class Evas (Eo_Base, Evas_Common_Interface) @in Evas_Coord y; /*@ The canvas y co-ordinate */ } } + event_feed_key_down_with_keycode { + /*@ + Key down event feed with keycode + + This function will set some evas properties that is necessary when + a key is pressed. It prepares information to be treated by the + callback function. + + @since 1.10 */ + + params { + @in const char *keyname; /*@ Name of the key */ + @in const char *key; /*@ The key pressed. */ + @in const char *string; /*@ A String */ + @in const char *compose; /*@ The compose string */ + @in unsigned int timestamp; /*@ Timestamp of the mouse up event */ + @in const void *data; /*@ Data for canvas. */ + @in unsigned int keycode; /*@ Key scan code numeric value for canvas. */ + } + } + event_feed_key_up_with_keycode { + /*@ + Key up event feed with keycode + + This function will set some evas properties that is necessary when + a key is released. It prepares information to be treated by the + callback function. + + @since 1.10 */ + + params { + @in const char *keyname; /*@ Name of the key */ + @in const char *key; /*@ The key released. */ + @in const char *string; /*@ string */ + @in const char *compose; /*@ compose */ + @in unsigned int timestamp; /*@ Timestamp of the mouse up event */ + @in const void *data; /*@ Data for canvas. */ + @in unsigned int keycode; /*@ Key scan code numeric value for canvas. */ + } + } } implements { Eo_Base::constructor; diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c index d53451b94e..b1fc48e21b 100644 --- a/src/lib/evas/canvas/evas_events.c +++ b/src/lib/evas/canvas/evas_events.c @@ -2445,10 +2445,18 @@ _evas_event_feed_multi_move(Eo *eo_e, Evas_Public_Data *e, int d, int x, int y, pres, ang, fx, fy, timestamp, data); } -EOLIAN void -_evas_event_feed_key_down(Eo *eo_e, Evas_Public_Data *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) +static void +_canvas_event_feed_key_down_internal(Eo *eo_e, + void *_pd, + const char *keyname, + const char *key, + const char *string, + const char *compose, + unsigned int timestamp, + const void *data, + unsigned int keycode) { - + Evas_Public_Data *e = _pd; int event_id = 0; if (!keyname) return; @@ -2473,6 +2481,7 @@ _evas_event_feed_key_down(Eo *eo_e, Evas_Public_Data *e, const char *keyname, co ev.timestamp = timestamp; ev.event_flags = e->default_event_flags; ev.dev = _evas_device_top_get(eo_e); + ev.keycode = keycode; if (ev.dev) _evas_device_ref(ev.dev); if (e->grabs) @@ -2542,10 +2551,18 @@ _evas_event_feed_key_down(Eo *eo_e, Evas_Public_Data *e, const char *keyname, co _evas_unwalk(e); } -EOLIAN void -_evas_event_feed_key_up(Eo *eo_e, Evas_Public_Data *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) +static void +_canvas_event_feed_key_up_internal(Eo *eo_e, + void *_pd, + const char *keyname, + const char *key, + const char *string, + const char *compose, + unsigned int timestamp, + const void *data, + unsigned int keycode) { - + Evas_Public_Data *e = _pd; int event_id = 0; if (!keyname) return; if (e->is_frozen) return; @@ -2569,6 +2586,7 @@ _evas_event_feed_key_up(Eo *eo_e, Evas_Public_Data *e, const char *keyname, cons ev.timestamp = timestamp; ev.event_flags = e->default_event_flags; ev.dev = _evas_device_top_get(eo_e); + ev.keycode = keycode; if (ev.dev) _evas_device_ref(ev.dev); if (e->grabs) @@ -2639,6 +2657,34 @@ _evas_event_feed_key_up(Eo *eo_e, Evas_Public_Data *e, const char *keyname, cons _evas_unwalk(e); } +EOLIAN void +_evas_event_feed_key_down(Eo *eo_e, Evas_Public_Data *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) +{ + _canvas_event_feed_key_down_internal(eo_e, e, keyname, key, string, + compose, timestamp, data, 0); +} + +EOLIAN void +_evas_event_feed_key_up(Eo *eo_e, Evas_Public_Data *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) +{ + _canvas_event_feed_key_up_internal(eo_e, e, keyname, key, string, + compose, timestamp, data, 0); +} + +EOLIAN void +_evas_event_feed_key_down_with_keycode(Eo *eo_e, Evas_Public_Data *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data, unsigned int keycode) +{ + _canvas_event_feed_key_down_internal(eo_e, e, keyname, key, string, + compose, timestamp, data, keycode); +} + +EOLIAN void +_evas_event_feed_key_up_with_keycode(Eo *eo_e, Evas_Public_Data *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data, unsigned int keycode) +{ + _canvas_event_feed_key_up_internal(eo_e, e, keyname, key, string, + compose, timestamp, data, keycode); +} + EOLIAN void _evas_event_feed_hold(Eo *eo_e, Evas_Public_Data *e, int hold, unsigned int timestamp, const void *data) { diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index f5c0700b07..f67f731919 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -1144,6 +1144,8 @@ void _canvas_event_input_multi_up(Eo *e, void *_pd, va_list *list); void _canvas_event_input_multi_move(Eo *e, void *_pd, va_list *list); void _canvas_event_feed_key_down(Eo *e, void *_pd, va_list *list); void _canvas_event_feed_key_up(Eo *e, void *_pd, va_list *list); +void _canvas_event_feed_key_down_with_keycode(Eo *e, void *_pd, va_list *list); +void _canvas_event_feed_key_up_with_keycode(Eo *e, void *_pd, va_list *list); void _canvas_event_feed_hold(Eo *e, void *_pd, va_list *list); void _canvas_event_refeed_event(Eo *e, void *_pd, va_list *list); void _canvas_event_down_count_get(Eo *e, void *_pd, va_list *list);