discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ca443ac1528c9355c1b17b32e9867b05ecc42c62

commit ca443ac1528c9355c1b17b32e9867b05ecc42c62
Author: Gwanglim Lee <gl77....@samsung.com>
Date:   Mon Apr 14 09:38:58 2014 -0400

    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
---
 src/lib/ecore_drm/ecore_drm_evdev.c         | 10 ++++-
 src/lib/ecore_input/Ecore_Input.h           |  4 ++
 src/lib/ecore_input_evas/ecore_input_evas.c | 18 ++++++++-
 src/lib/evas/Evas_Common.h                  |  4 ++
 src/lib/evas/Evas_Eo.h                      |  2 +-
 src/lib/evas/Evas_Legacy.h                  | 40 ++++++++++++++++++++
 src/lib/evas/canvas/evas.eo                 | 40 ++++++++++++++++++++
 src/lib/evas/canvas/evas_events.c           | 58 ++++++++++++++++++++++++++---
 src/lib/evas/include/evas_private.h         |  2 +
 9 files changed, 167 insertions(+), 11 deletions(-)

diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c 
b/src/lib/ecore_drm/ecore_drm_evdev.c
index 28772a9..8909746 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 ec40af8..46e3e6e 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 ef08c48..5205862 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 3012548..88c4b61b 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 848649e..751c97f 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 6957ab9..05a1e00 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -1246,6 +1246,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
  *
  * @param e The given canvas pointer.
diff --git a/src/lib/evas/canvas/evas.eo b/src/lib/evas/canvas/evas.eo
index d6367c9..12a105c 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 d53451b..b1fc48e 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)
@@ -2640,6 +2658,34 @@ _evas_event_feed_key_up(Eo *eo_e, Evas_Public_Data *e, 
const char *keyname, cons
 }
 
 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 f5c0700..f67f731 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);

-- 


Reply via email to