Elm win: Forward pointer events from evas to window
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 30 May 2016 10:51:31 +0000 (19:51 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 31 May 2016 10:03:04 +0000 (19:03 +0900)
This will allow applications to listen to those events
on the whole window. Necessary since they won't have access
to Evas with EO APIs.

src/lib/elementary/elm_win.c
src/lib/evas/canvas/efl_pointer_event.eo

index fc7e6bc..622edc9 100644 (file)
@@ -1625,6 +1625,19 @@ _elm_win_elm_widget_event(Eo *obj, Elm_Win_Data *_pd EINA_UNUSED, Evas_Object *s
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_evas_event_pointer_cb(void *data, const Eo_Event *ev)
+{
+   Eo *win = data;
+   Eo *evt = ev->info;
+
+   eo_event_callback_call(win, EFL_GFX_EVENT_POINTER, evt);
+   return EO_CALLBACK_CONTINUE;
+}
+
+EO_CALLBACKS_ARRAY_DEFINE(_elm_win_evas_forward_callbacks,
+                          { EVAS_CANVAS_EVENT_POINTER, _evas_event_pointer_cb })
+
 static void
 _deferred_ecore_evas_free(void *data)
 {
@@ -1972,6 +1985,8 @@ _elm_win_evas_object_smart_del(Eo *obj, Elm_Win_Data *sd)
                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                        _elm_win_on_resize_obj_changed_size_hints,
                                        obj);
+   eo_event_callback_array_del(sd->evas, _elm_win_evas_forward_callbacks(), obj);
+
    evas_object_del(sd->box);
    evas_object_del(sd->edje);
 
@@ -4028,6 +4043,8 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
    if (_elm_config->atspi_mode)
      elm_interface_atspi_window_created_signal_emit(obj);
 
+   eo_event_callback_array_add(sd->evas, _elm_win_evas_forward_callbacks(), obj);
+
    evas_object_show(sd->edje);
 
    if (type == ELM_WIN_FAKE)
index 96e923e..8e614d9 100644 (file)
@@ -49,15 +49,6 @@ class Efl.Pointer.Event (Eo.Base, Efl.Event, Efl.Input.State)
             y: int;
          }
       }
-      /*
-      @property input_state {
-         [[Carries information about keyboard modifiers and locks
-           at the moment of this event (eg. Ctrl, Alt or Caps Lock, Num Lock).]]
-         values {
-            modifiers: Efl.Input.State*; [[Can be $null (no info about state).]]
-         }
-      }
-      */
       @property device {
          [[Pointing device that originated this event.]]
          values {