Fixed a problem with e wl server that sent invalid key value to wl client.

Summary:
This problem occurred due to xkb_keysym_t value of libxkbcommon by e wl server.
e wl server should pass keycode from evdev input device on to wl client.
In order that e wl server receives valid keycode Ecore_Event_Key should have
an extended data member. This patch should be applied with server side patch.

@fix

Test Plan: run e wl server -> create wl client -> type keys

Reviewers: raster, devilhorns, zmike

CC: cedric

Differential Revision: https://phab.enlightenment.org/D712
This commit is contained in:
Gwanglim Lee 2014-04-14 09:38:58 -04:00 committed by Mike Blumenkrantz
parent e4ab76c397
commit ca443ac152
9 changed files with 167 additions and 11 deletions

View File

@ -291,11 +291,13 @@ static void
_device_notify_key(Ecore_Drm_Evdev *dev, struct input_event *event, unsigned int timestamp) _device_notify_key(Ecore_Drm_Evdev *dev, struct input_event *event, unsigned int timestamp)
{ {
unsigned int code, nsyms; unsigned int code, nsyms;
unsigned int *keycode;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
xkb_keysym_t sym = XKB_KEY_NoSymbol; xkb_keysym_t sym = XKB_KEY_NoSymbol;
char key[256], keyname[256], compose[256]; char key[256], keyname[256], compose[256];
Ecore_Event_Key *e; Ecore_Event_Key *e;
Ecore_Drm_Input *input; Ecore_Drm_Input *input;
int evtype;
if (!(input = dev->seat->input)) return; 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->root_window = (Ecore_Window)input->dev->window;
e->timestamp = timestamp; e->timestamp = timestamp;
e->same_screen = 1; e->same_screen = 1;
e->keycode = event->code;
e->data = NULL;
_device_modifiers_update(dev); _device_modifiers_update(dev);
e->modifiers = dev->xkb.modifiers; e->modifiers = dev->xkb.modifiers;
if (event->value) if (event->value)
ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); evtype = ECORE_EVENT_KEY_DOWN;
else 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 static void

View File

@ -119,6 +119,10 @@ extern "C" {
unsigned int modifiers; unsigned int modifiers;
int same_screen; 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 struct _Ecore_Event_Mouse_Button

View File

@ -332,9 +332,23 @@ _ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
if (!lookup) return ECORE_CALLBACK_PASS_ON; if (!lookup) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
if (press == ECORE_DOWN) 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 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; return ECORE_CALLBACK_PASS_ON;
} }

View File

@ -733,6 +733,8 @@ struct _Evas_Event_Key_Down /** Key press event */
unsigned int timestamp; unsigned int timestamp;
Evas_Event_Flags event_flags; Evas_Event_Flags event_flags;
Evas_Device *dev; Evas_Device *dev;
unsigned int keycode; /**< Key scan code numeric value @since 1.10 */
}; };
struct _Evas_Event_Key_Up /** Key release event */ struct _Evas_Event_Key_Up /** Key release event */
@ -748,6 +750,8 @@ struct _Evas_Event_Key_Up /** Key release event */
unsigned int timestamp; unsigned int timestamp;
Evas_Event_Flags event_flags; Evas_Event_Flags event_flags;
Evas_Device *dev; 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 */ struct _Evas_Event_Render_Post /** Send when the frame rendering is done @since 1.8 */

View File

@ -208,4 +208,4 @@ EAPI extern const Eo_Event_Description _EVAS_CANVAS_EVENT_RENDER_POST;
#include"canvas/evas_image.eo.h" #include"canvas/evas_image.eo.h"
#include "canvas/evas_out.eo.h" #include "canvas/evas_out.eo.h"

View File

@ -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); 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 * Hold event feed
* *

View File

@ -1730,6 +1730,46 @@ class Evas (Eo_Base, Evas_Common_Interface)
@in Evas_Coord y; /*@ The canvas y co-ordinate */ @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 { implements {
Eo_Base::constructor; Eo_Base::constructor;

View File

@ -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); pres, ang, fx, fy, timestamp, data);
} }
EOLIAN void static 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 *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; int event_id = 0;
if (!keyname) return; 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.timestamp = timestamp;
ev.event_flags = e->default_event_flags; ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e); ev.dev = _evas_device_top_get(eo_e);
ev.keycode = keycode;
if (ev.dev) _evas_device_ref(ev.dev); if (ev.dev) _evas_device_ref(ev.dev);
if (e->grabs) 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); _evas_unwalk(e);
} }
EOLIAN void static 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 *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; int event_id = 0;
if (!keyname) return; if (!keyname) return;
if (e->is_frozen) 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.timestamp = timestamp;
ev.event_flags = e->default_event_flags; ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e); ev.dev = _evas_device_top_get(eo_e);
ev.keycode = keycode;
if (ev.dev) _evas_device_ref(ev.dev); if (ev.dev) _evas_device_ref(ev.dev);
if (e->grabs) 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); _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 EOLIAN void
_evas_event_feed_hold(Eo *eo_e, Evas_Public_Data *e, int hold, unsigned int timestamp, const void *data) _evas_event_feed_hold(Eo *eo_e, Evas_Public_Data *e, int hold, unsigned int timestamp, const void *data)
{ {

View File

@ -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_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_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_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_feed_hold(Eo *e, void *_pd, va_list *list);
void _canvas_event_refeed_event(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); void _canvas_event_down_count_get(Eo *e, void *_pd, va_list *list);