evas: Fix legacy events output vs. canvas coords

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
This commit is contained in:
Jean-Philippe Andre 2016-10-17 11:34:05 +09:00
parent ab18b01e1c
commit 40fec5f608
3 changed files with 8 additions and 6 deletions

View 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:

View 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);
#define COORD_DUP(e) do { (e)->output.x = (e)->canvas.x; (e)->output.y = (e)->canvas.y; } while (0)
if (!ev || !evas) return NULL;
#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)

View 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);