Evas events: Add EO APIs for lock & modifiers
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 30 May 2016 06:34:31 +0000 (15:34 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 31 May 2016 10:03:04 +0000 (19:03 +0900)
This moves Efl.Pointer.Event back to Evas. Originally I wanted
to share this class with Ecore but eventually I didn't need to
do so, since only ecore_evas (which depends on evas) really needs
access to these.

The internal data struct is not moved out of efl (yet?)

15 files changed:
src/Makefile_Efl.am
src/Makefile_Evas.am
src/lib/ecore_evas/ecore_evas.c
src/lib/efl/Efl.h
src/lib/efl/interfaces/efl_common_internal.h
src/lib/efl/interfaces/efl_event.c [deleted file]
src/lib/efl/interfaces/efl_input_state.eo [new file with mode: 0644]
src/lib/efl/interfaces/efl_interfaces_main.c
src/lib/elementary/elm_win.c
src/lib/elementary/elm_win.eo
src/lib/evas/Evas_Eo.h
src/lib/evas/canvas/efl_pointer_event.c [moved from src/lib/efl/interfaces/efl_pointer_event.c with 92% similarity]
src/lib/evas/canvas/efl_pointer_event.eo [moved from src/lib/efl/interfaces/efl_pointer_event.eo with 96% similarity]
src/lib/evas/canvas/evas_events.c
src/lib/evas/canvas/evas_events_legacy.c

index b8c2834..506b683 100644 (file)
@@ -40,7 +40,7 @@ efl_eolian_files = \
       lib/efl/interfaces/efl_ui_spin.eo \
       lib/efl/interfaces/efl_ui_progress.eo \
       lib/efl/interfaces/efl_event.eo \
-      lib/efl/interfaces/efl_pointer_event.eo \
+      lib/efl/interfaces/efl_input_state.eo \
       $(efl_eolian_legacy_files) \
       $(NULL)
 
@@ -84,8 +84,6 @@ lib/efl/interfaces/efl_vpath_manager.c \
 lib/efl/interfaces/efl_vpath_core.c \
 lib/efl/interfaces/efl_vpath_file_core.c \
 lib/efl/interfaces/efl_input_device.c \
-lib/efl/interfaces/efl_event.c \
-lib/efl/interfaces/efl_pointer_event.c \
 $(NULL)
 
 lib_efl_libefl_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_srcdir)/src/lib/efl @EFL_CFLAGS@ -DEFL_GFX_FILTER_BETA
index e9ee137..ce2607b 100644 (file)
@@ -43,6 +43,7 @@ evas_eolian_pub_files = \
        lib/evas/canvas/efl_canvas_surface_wayland.eo \
        lib/evas/canvas/evas_filter.eo \
        lib/evas/canvas/evas_smart_clipped.eo \
+       lib/evas/canvas/efl_pointer_event.eo \
        $(NULL)
 
 evas_eolian_legacy_files = \
@@ -197,6 +198,7 @@ lib/evas/canvas/efl_canvas_surface.c \
 lib/evas/canvas/efl_canvas_surface_tbm.c \
 lib/evas/canvas/efl_canvas_surface_x11.c \
 lib/evas/canvas/efl_canvas_surface_wayland.c \
+lib/evas/canvas/efl_pointer_event.c \
 $(NULL)
 
 EXTRA_DIST += \
index 36ec77e..ba954d4 100644 (file)
@@ -4327,8 +4327,8 @@ _direct_mouse_updown(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info, Efl_P
     * root.{x,y}
     * root_window
     * event_window
-    * modifiers
     * same_screen
+    * modifiers (already passed to evas, no need to do anything)
     */
 
    evt = efl_pointer_event_instance_get(EFL_POINTER_EVENT_CLASS, e, (void **) &ev);
@@ -4385,8 +4385,8 @@ _direct_mouse_move_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Move *info)
     * root.{x,y}
     * root_window
     * event_window
-    * modifiers
     * same_screen
+    * modifiers (already passed to evas, no need to do anything)
     */
 
    evt = efl_pointer_event_instance_get(EFL_POINTER_EVENT_CLASS, e, (void **) &ev);
@@ -4423,8 +4423,7 @@ _direct_mouse_wheel_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Wheel *info)
     * root.{x,y}
     * root_window
     * event_window
-    * modifiers
-    * same_screen
+    * modifiers (already passed to evas, no need to do anything)
     */
 
    evt = efl_pointer_event_instance_get(EFL_POINTER_EVENT_CLASS, e, (void **) &ev);
@@ -4453,7 +4452,7 @@ _direct_mouse_inout(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info, Efl_Pointe
 
    /* Unused information:
     * event_window
-    * modifiers
+    * modifiers (already passed to evas, no need to do anything)
     */
 
    evt = efl_pointer_event_instance_get(EFL_POINTER_EVENT_CLASS, e, (void **) &ev);
index 2d25714..dda8293 100644 (file)
@@ -128,9 +128,8 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color,
 /* Input events */
 #include "interfaces/efl_event_types.eot.h"
 #include "interfaces/efl_input_device.eo.h"
-//#include "interfaces/efl_input_state.eo.h"
+#include "interfaces/efl_input_state.eo.h"
 #include "interfaces/efl_event.eo.h"
-#include "interfaces/efl_pointer_event.eo.h"
 
 #else
 
index d2467d2..32ddb12 100644 (file)
@@ -18,19 +18,10 @@ typedef struct _Efl_Input_Device_Data   Efl_Input_Device_Data;
 typedef struct _Efl_Input_State_Data    Efl_Input_State_Data;
 
 #ifndef _EVAS_TYPES_EOT_H_
-/* FIXME */
-//typedef struct _Evas_Modifier Evas_Modifier;
-//typedef struct _Evas_Lock Evas_Lock;
+typedef struct _Evas_Modifier Evas_Modifier;
+typedef struct _Evas_Lock Evas_Lock;
 #endif
 
-struct _Efl_Input_State_Data
-{
-   Eo             *eo;
-   /* FIXME / TODO  */
-//   Evas_Modifier  *modifiers;
-//   Evas_Lock      *locks;
-};
-
 struct _Efl_Pointer_Event_Data
 {
    Eo             *eo;
@@ -58,8 +49,9 @@ struct _Efl_Pointer_Event_Data
    const Eo_Event_Description *event_desc;
    Eina_Bool                   window_pos; /* true if positions are window-relative
                                               (see input vs. feed: this is "input") */
-   //Efl_Input_State            *state;
-   void                       *legacy; /* DO NOT TOUCH */
+   Evas_Modifier              *modifiers;
+   Evas_Lock                  *locks;
+   void                       *legacy; /* DO NOT TOUCH (may contain the legacy event_info) */
    Eina_Bool                   evas_done; /* set by evas */
 };
 
diff --git a/src/lib/efl/interfaces/efl_event.c b/src/lib/efl/interfaces/efl_event.c
deleted file mode 100644 (file)
index 1d75a1c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <Efl.h>
-
-#define EFL_INTERNAL_UNSTABLE
-#include "efl_common_internal.h"
-
-#include "interfaces/efl_event.eo.c"
diff --git a/src/lib/efl/interfaces/efl_input_state.eo b/src/lib/efl/interfaces/efl_input_state.eo
new file mode 100644 (file)
index 0000000..0622adc
--- /dev/null
@@ -0,0 +1,27 @@
+interface Efl.Input.State ()
+{
+   eo_prefix: efl_input;
+   methods {
+      /* FIXME: legacy name was 'modifier_is_set' */
+      @property modifier_enabled {
+         [[Indicates whether a key modifier is on, such as Ctrl, Shift,...]]
+         get {}
+         keys {
+            name: string;
+         }
+         values {
+            is_set: bool; [[$true if the key modifier is pressed.]]
+         }
+      }
+      @property lock_enabled {
+         [[Indicates whether a key lock is on, such as NumLock, CapsLock, ...]]
+         get {}
+         keys {
+            name: string;
+         }
+         values {
+            is_set: bool; [[$true if the key lock is on.]]
+         }
+      }
+   }
+}
index 5432a8d..370abab 100644 (file)
@@ -48,6 +48,9 @@ EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
 #include "interfaces/efl_ui_spin.eo.c"
 #include "interfaces/efl_ui_progress.eo.c"
 
+#include "interfaces/efl_event.eo.c"
+#include "interfaces/efl_input_state.eo.c"
+
 EAPI void
 __efl_internal_init(void)
 {
index f9f0afc..fc7e6bc 100644 (file)
@@ -5548,6 +5548,20 @@ _elm_win_elm_interface_atspi_accessible_name_get(Eo *obj, Elm_Win_Data *sd EINA_
    return name ? strdup(name) : NULL;
 }
 
+EOLIAN static Eina_Bool
+_elm_win_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, const char *name)
+{
+   const Evas_Modifier *m = evas_key_modifier_get(pd->evas);
+   return evas_key_modifier_is_set(m, name);
+}
+
+EOLIAN static Eina_Bool
+_elm_win_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, const char *name)
+{
+   const Evas_Lock *m = evas_key_lock_get(pd->evas);
+   return evas_key_lock_is_set(m, name);
+}
+
 #ifndef EFL_TEAMWORK_VERSION
 # define EFL_TEAMWORK_VERSION 2
 #endif
index 0dcccca..fce86ed 100644 (file)
@@ -149,7 +149,8 @@ enum Elm.Illume_Command
 }
 
 class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
-               Elm.Interface.Atspi_Widget_Action, Efl.Pack)
+               Elm.Interface.Atspi_Widget_Action, Efl.Pack,
+               Efl.Input.State)
 {
    legacy_prefix: elm_win;
    eo_prefix: elm_obj_win;
@@ -1042,6 +1043,8 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
       Efl.Container.content_count;
       Efl.Pack.unpack;
       Efl.Pack.pack;
+      Efl.Input.State.modifier_enabled.get;
+      Efl.Input.State.lock_enabled.get;
    }
    constructors {
       .name;
index 948a07d..3dc0025 100644 (file)
@@ -299,3 +299,5 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x,
 #include "canvas/efl_vg_gradient.eo.h"
 #include "canvas/efl_vg_gradient_linear.eo.h"
 #include "canvas/efl_vg_gradient_radial.eo.h"
+
+#include "canvas/efl_pointer_event.eo.h"
similarity index 92%
rename from src/lib/efl/interfaces/efl_pointer_event.c
rename to src/lib/evas/canvas/efl_pointer_event.c
index dbd96ea..9791617 100644 (file)
@@ -2,10 +2,10 @@
 # include <config.h>
 #endif
 
-#include <Efl.h>
+#include <Evas.h>
 
 #define EFL_INTERNAL_UNSTABLE
-#include "efl_common_internal.h"
+#include "interfaces/efl_common_internal.h"
 
 #define MY_CLASS EFL_POINTER_EVENT_CLASS
 
@@ -182,22 +182,6 @@ _efl_pointer_event_previous_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_
    if (y) *y = pd->prev.y;
 }
 
-
-/* FIXME: implement input state with eo*/
-
-/*
-EOLIAN static void
-_efl_pointer_event_input_state_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, Efl_Input_State *modifiers)
-{
-
-}
-EOLIAN static Efl_Input_State *
-_efl_pointer_event_input_state_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd)
-{
-
-}
-*/
-
 EOLIAN static void
 _efl_pointer_event_device_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, Efl_Input_Device *dev)
 {
@@ -318,7 +302,6 @@ _efl_pointer_event_touch_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, do
    if (angle) *angle = pd->angle;
 }
 
-
 EOLIAN static void
 _efl_pointer_event_touch_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, double r, double rx, double ry, double press, double angle)
 {
@@ -329,4 +312,18 @@ _efl_pointer_event_touch_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, do
    pd->angle = angle;
 }
 
-#include "interfaces/efl_pointer_event.eo.c"
+EOLIAN static Eina_Bool
+_efl_pointer_event_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, const char *name)
+{
+   if (!pd->modifiers) return EINA_FALSE;
+   return evas_key_modifier_is_set(pd->modifiers, name);
+}
+
+EOLIAN static Eina_Bool
+_efl_pointer_event_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, const char *name)
+{
+   if (!pd->locks) return EINA_FALSE;
+   return evas_key_lock_is_set(pd->locks, name);
+}
+
+#include "efl_pointer_event.eo.c"
similarity index 96%
rename from src/lib/efl/interfaces/efl_pointer_event.eo
rename to src/lib/evas/canvas/efl_pointer_event.eo
index 6e8251e..96e923e 100644 (file)
@@ -1,7 +1,7 @@
 import efl_orientation;
 import efl_event_types;
 
-class Efl.Pointer.Event (Eo.Base, Efl.Event)
+class Efl.Pointer.Event (Eo.Base, Efl.Event, Efl.Input.State)
 {
    [[Event data carried over with any pointer event (mouse, touch, ...)
 
@@ -131,5 +131,7 @@ class Efl.Pointer.Event (Eo.Base, Efl.Event)
       Efl.Event.timestamp.get;
       Efl.Event.event_type.set;
       Efl.Event.event_type.get;
+      Efl.Input.State.modifier_enabled.get;
+      Efl.Input.State.lock_enabled.get;
    }
 }
index 25750fe..aeefb1b 100644 (file)
@@ -3191,11 +3191,13 @@ _evas_canvas_event_pointer_cb(void *data, const Eo_Event *event)
    if (!ev) return EO_CALLBACK_CONTINUE;
 
    /* TODO:
-    * - pass event to the internal functions
-    * - implement legacy over eo instead of this
+    * - implement legacy over eo instead of this (hardcore)
     */
 
    ev->evas_done = EINA_TRUE;
+   ev->modifiers = &e->modifiers;
+   ev->locks = &e->locks;
+
    switch (ev->action)
      {
       case EFL_POINTER_ACTION_MOVE:
index 0e85e0e..d456db7 100644 (file)
@@ -46,6 +46,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
            ev->source = e->event_src;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -63,6 +65,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
            ev->source = e->event_src;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -82,6 +86,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
            ev->source = e->event_src;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -101,6 +107,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
            ev->source = e->event_src;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -123,6 +131,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
            ev->source = e->event_src;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -141,6 +151,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->timestamp = e->timestamp;
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -164,6 +176,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->timestamp = e->timestamp;
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -187,6 +201,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->timestamp = e->timestamp;
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -209,6 +225,8 @@ efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info
            ev->timestamp = e->timestamp;
            ev->event_flags = e->event_flags;
            ev->device = e->dev;
+           ev->modifiers = e->modifiers;
+           ev->locks = e->locks;
            break;
         }
 
@@ -244,9 +262,9 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
            e->timestamp = ev->timestamp;
            e->event_flags = ev->event_flags;
            e->dev = ev->device;
-           e->modifiers = NULL; /* FIXME */
-           e->locks = NULL; /* FIXME */
            e->event_src = ev->source;
+           e->modifiers = ev->modifiers;
+           e->locks = ev->locks;
         }
         break;
 
@@ -267,8 +285,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
            e->event_flags = ev->event_flags;
            e->dev = ev->device;
            e->event_src = ev->source;
-           e->modifiers = NULL; /* FIXME */
-           e->locks = NULL; /* FIXME */
+           e->modifiers = ev->modifiers;
+           e->locks = ev->locks;
         }
         break;
 
@@ -291,8 +309,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
              e->event_flags = ev->event_flags;
              e->dev = ev->device;
              e->event_src = ev->source;
-             e->modifiers = NULL; /* FIXME */
-             e->locks = NULL; /* FIXME */
+             e->modifiers = ev->modifiers;
+             e->locks = ev->locks;
           }
         else
           {
@@ -318,8 +336,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
              e->timestamp = ev->timestamp;
              e->event_flags = ev->event_flags;
              e->dev = ev->device;
-             e->modifiers = NULL; /* FIXME */
-             e->locks = NULL; /* FIXME */
+             e->modifiers = ev->modifiers;
+             e->locks = ev->locks;
           }
         break;
 
@@ -342,8 +360,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
              e->event_flags = ev->event_flags;
              e->dev = ev->device;
              e->event_src = ev->source;
-             e->modifiers = NULL; /* FIXME */
-             e->locks = NULL; /* FIXME */
+             e->modifiers = ev->modifiers;
+             e->locks = ev->locks;
           }
         else
           {
@@ -369,8 +387,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
              e->timestamp = ev->timestamp;
              e->event_flags = ev->event_flags;
              e->dev = ev->device;
-             e->modifiers = NULL; /* FIXME */
-             e->locks = NULL; /* FIXME */
+             e->modifiers = ev->modifiers;
+             e->locks = ev->locks;
              break;
           }
         break;
@@ -397,8 +415,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
              e->event_flags = ev->event_flags;
              e->dev = ev->device;
              e->event_src = ev->source;
-             e->modifiers = NULL; /* FIXME */
-             e->locks = NULL; /* FIXME */
+             e->modifiers = ev->modifiers;
+             e->locks = ev->locks;
           }
         else
           {
@@ -423,8 +441,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
              e->timestamp = ev->timestamp;
              e->event_flags = ev->event_flags;
              e->dev = ev->device;
-             e->modifiers = NULL; /* FIXME */
-             e->locks = NULL; /* FIXME */
+             e->modifiers = ev->modifiers;
+             e->locks = ev->locks;
           }
         break;
 
@@ -445,8 +463,8 @@ efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Ty
            e->timestamp = ev->timestamp;
            e->event_flags = ev->event_flags;
            e->dev = ev->device;
-           e->modifiers = NULL; /* FIXME */
-           e->locks = NULL; /* FIXME */
+           e->modifiers = ev->modifiers;
+           e->locks = ev->locks;
            break;
         }