evas: Fix legacy events output vs. canvas coords
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 17 Oct 2016 02:34:05 +0000 (11:34 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 26 Oct 2016 04:42:54 +0000 (13:42 +0900)
In case of a mapped object (eg. when applying a map to a window
in wayland compositor), the canvas and output coordinates are
not meant to be the same.

In EO land, applications should instead use the common interface
Efl.Input.Interface.pointer_xy.get (on the canvas).

@fix

src/lib/evas/canvas/evas_callbacks.c
src/lib/evas/canvas/evas_events_legacy.c
src/lib/evas/include/evas_private.h

index 18117bf..d529399 100644 (file)
@@ -167,7 +167,7 @@ _eo_evas_object_cb(void *data, const Efl_Event *event)
    switch (info->efl_event_type)
      {
       case EFL_EVENT_TYPE_POINTER:
-        event_info = efl_input_pointer_legacy_info_fill(efl_event_info, info->type, &event_flags);
+        event_info = efl_input_pointer_legacy_info_fill(evas, efl_event_info, info->type, &event_flags);
         break;
 
       case EFL_EVENT_TYPE_KEY:
index 2b4f7e5..9c57bb4 100644 (file)
@@ -33,12 +33,14 @@ _event_alloc(void *old)
 }
 
 void *
-efl_input_pointer_legacy_info_fill(Efl_Input_Key *evt, Evas_Callback_Type type, Evas_Event_Flags **pflags)
+efl_input_pointer_legacy_info_fill(Evas *eo_evas, Efl_Input_Key *eo_ev, Evas_Callback_Type type, Evas_Event_Flags **pflags)
 {
-   Efl_Input_Pointer_Data *ev = efl_data_scope_get(evt, EFL_INPUT_POINTER_CLASS);
-   if (!ev) return NULL;
+   Efl_Input_Pointer_Data *ev = efl_data_scope_get(eo_ev, EFL_INPUT_POINTER_CLASS);
+   Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
+
+   if (!ev || !evas) return NULL;
 
-#define COORD_DUP(e) do { (e)->output.x = (e)->canvas.x; (e)->output.y = (e)->canvas.y; } while (0)
+#define COORD_DUP(e) do { (e)->output.x = evas->pointer.x; (e)->output.y = evas->pointer.y; } while (0)
 #define TYPE_CHK(typ) do { if (type != EVAS_CALLBACK_ ## typ) return NULL; } while (0)
 
    switch (ev->action)
index 1106e67..6dc037b 100644 (file)
@@ -1916,7 +1916,7 @@ void _evas_device_cleanup(Evas *e);
 Evas_Device *_evas_device_top_get(const Evas *e);
 
 /* legacy/eo events */
-void *efl_input_pointer_legacy_info_fill(Efl_Input_Key *evt, Evas_Callback_Type type, Evas_Event_Flags **pflags);
+void *efl_input_pointer_legacy_info_fill(Evas *eo_evas, Efl_Input_Key *eo_ev, Evas_Callback_Type type, Evas_Event_Flags **pflags);
 void *efl_input_key_legacy_info_fill(Efl_Input_Key *evt, Evas_Event_Flags **pflags);
 void *efl_input_hold_legacy_info_fill(Efl_Input_Hold *evt, Evas_Event_Flags **pflags);