ecore_evas: Add private direct callback for ecore
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 11 May 2016 04:01:54 +0000 (13:01 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 31 May 2016 10:03:04 +0000 (19:03 +0900)
All ecore_input_evas events should be passed through ecore_evas
in order to avoid any information loss between ecore and evas.

This is a private API.

src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_evas/ecore_evas_private.h
src/lib/ecore_input_evas/Ecore_Input_Evas.h
src/lib/ecore_input_evas/ecore_input_evas.c

index dffb915..dc7d1d4 100644 (file)
@@ -2,6 +2,8 @@
 # include <config.h>
 #endif
 
+#define ECORE_EVAS_INTERNAL
+
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -3598,6 +3600,7 @@ ecore_evas_input_event_register(Ecore_Evas *ee)
                                (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
                                (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
                                (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
+   _ecore_event_window_direct_cb_set((Ecore_Window)ee, _ecore_evas_input_direct_cb);
 }
 
 EAPI void
@@ -4276,3 +4279,103 @@ ecore_evas_psl1ght_new(const char* name, int w, int h)
 
    return new(name, w, h);
 }
+
+
+/* new input model with eo:
+ *  1. pass all events from ecore_input_evas through
+ *     ecore_evas and send eo events from here
+ *  2. those eo events can then be translated to legacy by evas
+ *  3. let evas send legacy & eo events to the objects
+ */
+
+static Eina_Bool
+_direct_key_down_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Key *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_key_up_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Key *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_mouse_down_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_Button *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_mouse_up_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_Button *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_mouse_cancel_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_Button *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_mouse_move_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_Move *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_mouse_wheel_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_Wheel *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_mouse_in_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_IO *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_mouse_out_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Mouse_IO *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_direct_axis_update_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Axis_Update *ev EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+EAPI Eina_Bool
+_ecore_evas_input_direct_cb(void *window, int type, const void *info)
+{
+   Ecore_Evas *ee = window;
+
+   if (type == ECORE_EVENT_KEY_DOWN)
+     return _direct_key_down_cb(ee, (const Ecore_Event_Key *) info);
+   else if (type == ECORE_EVENT_KEY_UP)
+     return _direct_key_up_cb(ee, (const Ecore_Event_Key *) info);
+   else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
+     return _direct_mouse_down_cb(ee, (const Ecore_Event_Mouse_Button *) info);
+   else if (type == ECORE_EVENT_MOUSE_BUTTON_UP)
+     return _direct_mouse_up_cb(ee, (const Ecore_Event_Mouse_Button *) info);
+   else if (type == ECORE_EVENT_MOUSE_BUTTON_CANCEL)
+     return _direct_mouse_cancel_cb(ee, (const Ecore_Event_Mouse_Button *) info);
+   else if (type == ECORE_EVENT_MOUSE_MOVE)
+     return _direct_mouse_move_cb(ee, (const Ecore_Event_Mouse_Move *) info);
+   else if (type == ECORE_EVENT_MOUSE_WHEEL)
+     return _direct_mouse_wheel_cb(ee, (const Ecore_Event_Mouse_Wheel *) info);
+   else if (type == ECORE_EVENT_MOUSE_IN)
+     return _direct_mouse_in_cb(ee, (const Ecore_Event_Mouse_IO *) info);
+   else if (type == ECORE_EVENT_MOUSE_OUT)
+     return _direct_mouse_out_cb(ee, (const Ecore_Event_Mouse_IO *) info);
+   else if (type == ECORE_EVENT_AXIS_UPDATE)
+     return _direct_axis_update_cb(ee, (const Ecore_Event_Axis_Update *) info);
+   else
+     {
+        ERR("unhandled input event type %d", type);
+        return EINA_FALSE;
+     }
+}
index a179733..fea4792 100644 (file)
@@ -390,6 +390,7 @@ EAPI void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
                                         double mx, double my,
                                         Evas_Button_Flags flags,
                                         unsigned int timestamp);
+EAPI Eina_Bool _ecore_evas_input_direct_cb(void *window, int type, const void *info);
 
 EAPI extern Eina_Bool _ecore_evas_app_comp_sync;
 
index db4029f..c9b0c05 100644 (file)
@@ -59,6 +59,11 @@ EAPI void      ecore_event_window_ignore_events(Ecore_Window id, int ignore_even
 
 EAPI void      ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers);
 
+#ifdef ECORE_EVAS_INTERNAL
+typedef Eina_Bool (*Ecore_Event_Direct_Input_Cb)(void *window, int type, const void *info);
+EAPI void      _ecore_event_window_direct_cb_set(Ecore_Window id, Ecore_Event_Direct_Input_Cb fptr);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index bea13cb..daed66a 100644 (file)
@@ -2,6 +2,8 @@
 # include <config.h>
 #endif
 
+#define ECORE_EVAS_INTERNAL
+
 #include <string.h>
 #include <stdlib.h>
 
@@ -22,6 +24,7 @@ struct _Ecore_Input_Window
    Ecore_Event_Multi_Move_Cb move_multi;
    Ecore_Event_Multi_Down_Cb down_multi;
    Ecore_Event_Multi_Up_Cb up_multi;
+   Ecore_Event_Direct_Input_Cb direct;
    int ignore_event;
 };
 
@@ -359,6 +362,16 @@ ecore_event_window_unregister(Ecore_Window id)
    eina_hash_del(_window_hash, &id, NULL);
 }
 
+EAPI void
+_ecore_event_window_direct_cb_set(Ecore_Window id, Ecore_Event_Direct_Input_Cb fptr)
+{
+   Ecore_Input_Window *lookup;
+
+   lookup = eina_hash_find(_window_hash, &id);
+   if (!lookup) return;
+   lookup->direct = fptr;
+}
+
 EAPI void *
 ecore_event_window_match(Ecore_Window id)
 {