jpeg pushed a commit to branch master.

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

commit c1be667a6ccd8177976960c7e311ff2d419e806e
Author: Jean-Philippe Andre <[email protected]>
Date:   Wed May 11 17:28:26 2016 +0900

    ecore_evas: Pass mouse down,up,move with eo
    
    This way, ecore sends eo events to evas, which can then
    be listened to by other clients (FIXME: the events will
    need to be propagated from evas to the elm window).
    
    Current support:
    - mouse/multi down
    - mouse/multi up
    - mouse/multi move
    - mouse wheel
---
 src/lib/ecore_evas/ecore_evas.c | 121 +++++++++++++++++++++++++++++++---------
 1 file changed, 96 insertions(+), 25 deletions(-)

diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 4fc6130..a2ede77 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -4308,6 +4308,24 @@ _direct_key_up_cb(Ecore_Evas *ee EINA_UNUSED, const 
Ecore_Event_Key *info EINA_U
    EV->cur.y = (Y) - (FY); EV->cur.ysub = (MY) - (FY); \
    } while (0)
 
+static inline void
+_pointer_position_set(Efl_Pointer_Event_Data *ev, Ecore_Evas *ee, int x, int 
y, double mx, double my)
+{
+   int fx, fy, fw, fh;
+
+   evas_output_framespace_get(ee->evas, &fx, &fy, &fw, &fh);
+   if (ee->rotation == 0)
+     EVENT_XY_SET(ev, x, y, mx, my, fx, fy);
+   else if (ee->rotation == 90)
+     EVENT_XY_SET(ev, ee->h + fw - y - 1, x, ee->h + fw - my - 1, mx, fx, fy);
+   else if (ee->rotation == 180)
+     EVENT_XY_SET(ev, ee->w + fw - x - 1, ee->h + fh - y - 1,
+                  ee->w + fw - mx - 1, ee->h + fh - my - 1,
+                  fx, fy);
+   else if (ee->rotation == 270)
+     EVENT_XY_SET(ev, y, ee->w + fh - x - 1, y, ee->w + fh - mx - 1, fx, fy);
+}
+
 static Eina_Bool
 _direct_mouse_updown(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info, 
Efl_Pointer_Action action)
 {
@@ -4315,8 +4333,15 @@ _direct_mouse_updown(Ecore_Evas *ee, const 
Ecore_Event_Mouse_Button *info, Efl_P
    Efl_Pointer_Event *evt;
    Evas *e = ee->evas;
    Eina_Bool processed;
-   int fx, fy, fw, fh, x, y;
-   double mx, my;
+
+   /* Unused information:
+    * same_screen
+    * root.{x,y}
+    * root_window
+    * event_window
+    * modifiers
+    * same_screen
+    */
 
    evt = efl_pointer_event_instance_get(EFL_POINTER_EVENT_CLASS, e, (void **) 
&ev);
    if (!evt) return EINA_FALSE;
@@ -4327,24 +4352,7 @@ _direct_mouse_updown(Ecore_Evas *ee, const 
Ecore_Event_Mouse_Button *info, Efl_P
    if (info->triple_click) ev->button_flags |= 
EFL_POINTER_BUTTON_FLAGS_TRIPLE_CLICK;
    ev->timestamp = info->timestamp;
    ev->finger = info->multi.device;
-
-   evas_output_framespace_get(ee->evas, &fx, &fy, &fw, &fh);
-   x = info->x;
-   y = info->y;
-   mx = info->multi.x;
-   my = info->multi.y;
-
-   if (ee->rotation == 0)
-     EVENT_XY_SET(ev, x, y, mx, my, fx, fy);
-   else if (ee->rotation == 90)
-     EVENT_XY_SET(ev, ee->h + fw - y - 1, x, ee->h + fw - my - 1, mx, fx, fy);
-   else if (ee->rotation == 180)
-     EVENT_XY_SET(ev, ee->w + fw - x - 1, ee->h + fh - y - 1,
-                  ee->w + fw - mx - 1, ee->h + fh - my - 1,
-                  fx, fy);
-   else if (ee->rotation == 270)
-     EVENT_XY_SET(ev, y, ee->w + fh - x - 1, y, ee->w + fh - mx - 1, fx, fy);
-
+   _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, 
info->multi.y);
    ev->radius = info->multi.radius;
    ev->radius_x = info->multi.radius_x;
    ev->radius_y = info->multi.radius_y;
@@ -4365,7 +4373,7 @@ _direct_mouse_down_cb(Ecore_Evas *ee, const 
Ecore_Event_Mouse_Button *info)
 }
 
 static Eina_Bool
-_direct_mouse_up_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_Button 
*info EINA_UNUSED)
+_direct_mouse_up_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info)
 {
    return _direct_mouse_updown(ee, info, EFL_POINTER_ACTION_MOUSE_UP);
 }
@@ -4373,36 +4381,99 @@ _direct_mouse_up_cb(Ecore_Evas *ee EINA_UNUSED, const 
Ecore_Event_Mouse_Button *
 static Eina_Bool
 _direct_mouse_cancel_cb(Ecore_Evas *ee EINA_UNUSED, const 
Ecore_Event_Mouse_Button *info EINA_UNUSED)
 {
+   /* TODO: Add cancel event type. */
    return EINA_FALSE;
 }
 
 static Eina_Bool
-_direct_mouse_move_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_Move 
*info EINA_UNUSED)
+_direct_mouse_move_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Move *info)
 {
-   return EINA_FALSE;
+   Efl_Pointer_Event_Data *ev;
+   Efl_Pointer_Event *evt;
+   Evas *e = ee->evas;
+   Eina_Bool processed;
+
+   /* Unused information:
+    * same_screen
+    * root.{x,y}
+    * root_window
+    * event_window
+    * modifiers
+    * same_screen
+    */
+
+   evt = efl_pointer_event_instance_get(EFL_POINTER_EVENT_CLASS, e, (void **) 
&ev);
+   if (!evt) return EINA_FALSE;
+
+   ev->action = EFL_POINTER_ACTION_MOUSE_MOVE;
+   ev->timestamp = info->timestamp;
+   ev->finger = info->multi.device;
+   _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, 
info->multi.y);
+
+   ev->radius = info->multi.radius;
+   ev->radius_x = info->multi.radius_x;
+   ev->radius_y = info->multi.radius_y;
+   ev->pressure = info->multi.pressure;
+   ev->angle = info->multi.angle - ee->rotation;
+
+   eo_event_callback_call(e, EVAS_CANVAS_EVENT_POINTER, evt);
+   processed = ev->evas_done;
+   eo_unref(evt);
+
+   return processed;
 }
 
 static Eina_Bool
-_direct_mouse_wheel_cb(Ecore_Evas *ee EINA_UNUSED, const 
Ecore_Event_Mouse_Wheel *info EINA_UNUSED)
+_direct_mouse_wheel_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Wheel *info)
 {
-   return EINA_FALSE;
+   Efl_Pointer_Event_Data *ev;
+   Efl_Pointer_Event *evt;
+   Evas *e = ee->evas;
+   Eina_Bool processed;
+
+   /* Unused information:
+    * same_screen
+    * root.{x,y}
+    * root_window
+    * event_window
+    * modifiers
+    * same_screen
+    */
+
+   evt = efl_pointer_event_instance_get(EFL_POINTER_EVENT_CLASS, e, (void **) 
&ev);
+   if (!evt) return EINA_FALSE;
+
+   ev->action = EFL_POINTER_ACTION_MOUSE_WHEEL;
+   ev->timestamp = info->timestamp;
+   _pointer_position_set(ev, ee, info->x, info->y, info->x, info->y);
+   ev->wheel.z = info->z;
+   ev->wheel.dir = info->direction ? EFL_ORIENT_HORIZONTAL : 
EFL_ORIENT_VERTICAL;
+
+   eo_event_callback_call(e, EVAS_CANVAS_EVENT_POINTER, evt);
+   processed = ev->evas_done;
+   eo_unref(evt);
+
+   return processed;
 }
 
 static Eina_Bool
 _direct_mouse_in_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_IO 
*info EINA_UNUSED)
 {
+   /* TODO: Add mouse in event type. */
    return EINA_FALSE;
 }
 
 static Eina_Bool
 _direct_mouse_out_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_IO 
*info EINA_UNUSED)
 {
+   /* TODO: Add mouse out event type. */
    return EINA_FALSE;
 }
 
 static Eina_Bool
 _direct_axis_update_cb(Ecore_Evas *ee EINA_UNUSED, const 
Ecore_Event_Axis_Update *info EINA_UNUSED)
 {
+   /* TODO: Add joystick event type. */
    return EINA_FALSE;
 }
 

-- 


Reply via email to