Evas: Add proper EO events with info for mouse inputs

This adds a few classes, in particular Efl.Event and Efl.Event.Point
which are used as the event info for all pointer (mouse, multi) call

Using an eo object as event info will allow for future extensions
really easily. We don't need to expose any of the internals, also
a single type can be used for all pointer events.

Still TODO:
 - Keyboard events (urgent)
 - Axis / Joystick events (needs porting from Tizen)
 - Gestures support (probably later)
 - Event feeding from app side (manual feed)

Not going to be ported to EO:
 - Hold API and hold event. Seems barely used.

The new APIs are not very much tested at this point, and rely on the
old legacy event system. The most important thing right now is to
ensure that nothing was broken so far. Unfortunately I can only do
this much testing myself...

Merge branch 'devs/jpeg/work'
This commit is contained in:
Jean-Philippe Andre 2016-05-31 19:08:37 +09:00
commit b8d1db365b
43 changed files with 2980 additions and 856 deletions

View File

@ -4,6 +4,7 @@ efl_eolian_legacy_files = \
lib/efl/interfaces/efl_gfx.eo \
lib/efl/interfaces/efl_image.eo \
lib/efl/interfaces/efl_image_animated.eo \
lib/efl/interfaces/efl_input_device.eo \
$(NULL)
efl_eolian_files = \
@ -38,11 +39,15 @@ efl_eolian_files = \
lib/efl/interfaces/efl_vpath_file_core.eo \
lib/efl/interfaces/efl_ui_spin.eo \
lib/efl/interfaces/efl_ui_progress.eo \
lib/efl/interfaces/efl_event.eo \
lib/efl/interfaces/efl_input_interface.eo \
lib/efl/interfaces/efl_input_state.eo \
$(efl_eolian_legacy_files) \
$(NULL)
efl_eolian_type_files = \
lib/efl/interfaces/efl_gfx_types.eot \
lib/efl/interfaces/efl_event_types.eot \
lib/efl/interfaces/efl_types.eot \
$(NULL)
@ -62,6 +67,7 @@ EXTRA_DIST += \
lib/efl/Efl.h \
lib/efl/Makefile.am \
lib/efl/Makefile.in \
lib/efl/interfaces/efl_common_internal.h \
$(efl_eolian_files) \
$(efl_eolian_type_files)
@ -77,7 +83,9 @@ lib/efl/interfaces/efl_gfx_shape.c \
lib/efl/interfaces/efl_vpath_file.c \
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_vpath_file_core.c \
lib/efl/interfaces/efl_input_device.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
lib_efl_libefl_la_LIBADD = @EFL_LIBS@

View 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_event_pointer.eo \
$(NULL)
evas_eolian_legacy_files = \
@ -152,6 +153,7 @@ lib/evas/canvas/evas_common_interface.c \
lib/evas/canvas/evas_data.c \
lib/evas/canvas/evas_device.c \
lib/evas/canvas/evas_events.c \
lib/evas/canvas/evas_events_legacy.c \
lib/evas/canvas/evas_focus.c \
lib/evas/canvas/evas_key.c \
lib/evas/canvas/evas_key_grab.c \
@ -196,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_event_pointer.c \
$(NULL)
EXTRA_DIST += \

View File

@ -366,6 +366,9 @@ extern Eo *_ecore_parent;
#define ECORE_PARENT_CLASS ecore_parent_class_get()
EAPI const Eo_Class *ecore_parent_class_get(void) EINA_CONST;
// access to direct input cb
#define ECORE_EVAS_INTERNAL
#undef EAPI
#define EAPI

View File

@ -2,6 +2,8 @@
# include <config.h>
#endif
#define ECORE_EVAS_INTERNAL
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -34,6 +36,9 @@
#include "ecore_evas_extn.h"
#include "ecore_evas_win32.h"
#define EFL_INTERNAL_UNSTABLE
#include "interfaces/efl_common_internal.h"
#ifndef O_BINARY
# define O_BINARY 0
#endif
@ -3598,6 +3603,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 +4282,272 @@ 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
*/
#define EVENT_XY_SET(EV, MX, MY, FX, FY) do { \
EV->cur.x = (MX) - (FX); EV->cur.y = (MY) - (FY); \
} while (0)
static inline void
_pointer_position_set(Efl_Event_Pointer_Data *ev, Ecore_Evas *ee, double mx, double my)
{
int fx, fy, fw, fh;
evas_output_framespace_get(ee->evas, &fx, &fy, &fw, &fh);
if (ee->rotation == 0)
EVENT_XY_SET(ev, mx, my, fx, fy);
else if (ee->rotation == 90)
EVENT_XY_SET(ev, ee->h + fw - my - 1, mx, fx, fy);
else if (ee->rotation == 180)
EVENT_XY_SET(ev, ee->w + fw - mx - 1, ee->h + fh - my - 1, fx, fy);
else if (ee->rotation == 270)
EVENT_XY_SET(ev, my, ee->w + fh - mx - 1, fx, fy);
}
static const Eo_Event_Description *
_event_description_get(Efl_Pointer_Action action)
{
switch (action)
{
case EFL_POINTER_ACTION_MOVE:
return EFL_EVENT_POINTER_MOVE;
case EFL_POINTER_ACTION_DOWN:
return EFL_EVENT_POINTER_DOWN;
case EFL_POINTER_ACTION_UP:
return EFL_EVENT_POINTER_UP;
case EFL_POINTER_ACTION_CANCEL:
return EFL_EVENT_POINTER_CANCEL;
case EFL_POINTER_ACTION_IN:
return EFL_EVENT_POINTER_IN;
case EFL_POINTER_ACTION_OUT:
return EFL_EVENT_POINTER_OUT;
case EFL_POINTER_ACTION_WHEEL:
return EFL_EVENT_POINTER_WHEEL;
default: return NULL;
}
}
static Eina_Bool
_direct_mouse_updown(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info, Efl_Pointer_Action action)
{
Efl_Event_Pointer_Data *ev;
Efl_Event_Pointer *evt;
Evas *e = ee->evas;
Eina_Bool processed;
/* Unused information:
* same_screen
* root.{x,y}
* root_window
* event_window
* same_screen
* modifiers (already passed to evas, no need to do anything)
*/
evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
if (!evt) return EINA_FALSE;
ev->action = action;
ev->button = info->buttons;
if (info->double_click) ev->button_flags |= EFL_POINTER_FLAGS_DOUBLE_CLICK;
if (info->triple_click) ev->button_flags |= EFL_POINTER_FLAGS_TRIPLE_CLICK;
ev->timestamp = info->timestamp;
ev->finger = info->multi.device;
_pointer_position_set(ev, ee, info->multi.x, info->multi.y);
ev->radius = info->multi.radius;
ev->radius_x = info->multi.radius_x;
ev->radius_y = info->multi.radius_y;
ev->pressure = info->multi.pressure;
ev->angle = info->multi.angle - ee->rotation;
eo_event_callback_call(e, _event_description_get(ev->action), evt);
processed = ev->evas_done;
eo_unref(evt);
return processed;
}
static Eina_Bool
_direct_mouse_down_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info)
{
return _direct_mouse_updown(ee, info, EFL_POINTER_ACTION_DOWN);
}
static Eina_Bool
_direct_mouse_up_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info)
{
return _direct_mouse_updown(ee, info, EFL_POINTER_ACTION_UP);
}
static Eina_Bool
_direct_mouse_cancel_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info)
{
return _direct_mouse_updown(ee, info, EFL_POINTER_ACTION_CANCEL);
}
static Eina_Bool
_direct_mouse_move_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Move *info)
{
Efl_Event_Pointer_Data *ev;
Efl_Event_Pointer *evt;
Evas *e = ee->evas;
Eina_Bool processed;
/* Unused information:
* same_screen
* root.{x,y}
* root_window
* event_window
* same_screen
* modifiers (already passed to evas, no need to do anything)
*/
evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
if (!evt) return EINA_FALSE;
ev->action = EFL_POINTER_ACTION_MOVE;
ev->timestamp = info->timestamp;
ev->finger = info->multi.device;
_pointer_position_set(ev, ee, info->multi.x, info->multi.y);
ev->radius = info->multi.radius;
ev->radius_x = info->multi.radius_x;
ev->radius_y = info->multi.radius_y;
ev->pressure = info->multi.pressure;
ev->angle = info->multi.angle - ee->rotation;
eo_event_callback_call(e, _event_description_get(ev->action), evt);
processed = ev->evas_done;
eo_unref(evt);
return processed;
}
static Eina_Bool
_direct_mouse_wheel_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Wheel *info)
{
Efl_Event_Pointer_Data *ev;
Efl_Event_Pointer *evt;
Evas *e = ee->evas;
Eina_Bool processed;
/* Unused information:
* same_screen
* root.{x,y}
* root_window
* event_window
* modifiers (already passed to evas, no need to do anything)
*/
evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
if (!evt) return EINA_FALSE;
ev->action = EFL_POINTER_ACTION_WHEEL;
ev->timestamp = info->timestamp;
_pointer_position_set(ev, ee, info->x, info->y);
ev->wheel.z = info->z;
ev->wheel.dir = info->direction ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL;
eo_event_callback_call(e, _event_description_get(ev->action), evt);
processed = ev->evas_done;
eo_unref(evt);
return processed;
}
static Eina_Bool
_direct_mouse_inout(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info, Efl_Pointer_Action action)
{
Efl_Event_Pointer_Data *ev;
Efl_Event_Pointer *evt;
Evas *e = ee->evas;
Eina_Bool processed;
/* Unused information:
* event_window
* modifiers (already passed to evas, no need to do anything)
*/
evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
if (!evt) return EINA_FALSE;
ev->action = action;
ev->timestamp = info->timestamp;
_pointer_position_set(ev, ee, info->x, info->y);
eo_event_callback_call(e, _event_description_get(ev->action), evt);
processed = ev->evas_done;
eo_unref(evt);
return processed;
}
static Eina_Bool
_direct_mouse_in_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info)
{
return _direct_mouse_inout(ee, info, EFL_POINTER_ACTION_IN);
}
static Eina_Bool
_direct_mouse_out_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info)
{
return _direct_mouse_inout(ee, info, EFL_POINTER_ACTION_OUT);
}
static Eina_Bool
_direct_key_down_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Key *info EINA_UNUSED)
{
return EINA_FALSE;
}
static Eina_Bool
_direct_key_up_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Key *info EINA_UNUSED)
{
return EINA_FALSE;
}
static Eina_Bool
_direct_axis_update_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Axis_Update *info EINA_UNUSED)
{
/* TODO: Add joystick event type. */
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_MOUSE_MOVE)
return _direct_mouse_move_cb(ee, (const Ecore_Event_Mouse_Move *) 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_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_KEY_DOWN)
return _direct_key_down_cb(ee, (const Ecore_Event_Key *) 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_KEY_UP)
return _direct_key_up_cb(ee, (const Ecore_Event_Key *) 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;
}
}

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

View 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

View 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)
{
@ -399,23 +412,36 @@ _ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
if (!lookup) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
if (press == ECORE_DOWN)
evas_event_feed_key_down_with_keycode(lookup->evas,
e->keyname,
e->key,
e->string,
e->compose,
e->timestamp,
e->data,
e->keycode);
{
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_KEY_DOWN, e))
{
evas_event_feed_key_down_with_keycode(lookup->evas,
e->keyname,
e->key,
e->string,
e->compose,
e->timestamp,
e->data,
e->keycode);
}
}
else
evas_event_feed_key_up_with_keycode(lookup->evas,
e->keyname,
e->key,
e->string,
e->compose,
e->timestamp,
e->data,
e->keycode);
{
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_KEY_DOWN, e))
{
evas_event_feed_key_up_with_keycode(lookup->evas,
e->keyname,
e->key,
e->string,
e->compose,
e->timestamp,
e->data,
e->keycode);
}
}
return ECORE_CALLBACK_PASS_ON;
}
@ -430,7 +456,11 @@ _ecore_event_evas_mouse_button_cancel(Ecore_Event_Mouse_Button *e)
if (!lookup) return ECORE_CALLBACK_PASS_ON;
INF("ButtonEvent cancel, device(%d), button(%d)", e->multi.device, e->buttons);
evas_event_feed_mouse_cancel(lookup->evas, e->timestamp, NULL);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_CANCEL, e))
{
evas_event_feed_mouse_cancel(lookup->evas, e->timestamp, NULL);
}
//the number of last event is small, simple check is ok.
EINA_LIST_FOREACH(_last_events, l, eel)
@ -494,47 +524,67 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
{
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
if (press == ECORE_DOWN)
evas_event_feed_mouse_down(lookup->evas, e->buttons, flags,
e->timestamp, NULL);
{
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_DOWN, e))
{
evas_event_feed_mouse_down(lookup->evas, e->buttons, flags,
e->timestamp, NULL);
}
}
else
evas_event_feed_mouse_up(lookup->evas, e->buttons, flags,
e->timestamp, NULL);
{
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_UP, e))
{
evas_event_feed_mouse_up(lookup->evas, e->buttons, flags,
e->timestamp, NULL);
}
}
}
else
{
if (press == ECORE_DOWN)
{
if (lookup->down_multi)
lookup->down_multi(lookup->window, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp);
else
evas_event_input_multi_down(lookup->evas, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp, NULL);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_DOWN, e))
{
if (lookup->down_multi)
lookup->down_multi(lookup->window, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp);
else
evas_event_input_multi_down(lookup->evas, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp, NULL);
}
}
else
{
if (lookup->up_multi)
lookup->up_multi(lookup->window, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp);
else
evas_event_input_multi_up(lookup->evas, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp, NULL);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_UP, e))
{
if (lookup->up_multi)
lookup->up_multi(lookup->window, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp);
else
evas_event_input_multi_up(lookup->evas, e->multi.device,
e->x, e->y, e->multi.radius,
e->multi.radius_x, e->multi.radius_y,
e->multi.pressure, e->multi.angle,
e->multi.x, e->multi.y, flags,
e->timestamp, NULL);
}
}
}
return ECORE_CALLBACK_PASS_ON;
@ -549,6 +599,9 @@ ecore_event_evas_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *
e = event;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
if (lookup->direct &&
lookup->direct(lookup->window, ECORE_EVENT_MOUSE_MOVE, e))
return ECORE_CALLBACK_PASS_ON;
if (e->multi.device == 0)
{
_ecore_event_evas_push_mouse_move(e);
@ -609,10 +662,18 @@ _ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
switch (io)
{
case ECORE_IN:
evas_event_feed_mouse_in(lookup->evas, e->timestamp, NULL);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_IN, e))
{
evas_event_feed_mouse_in(lookup->evas, e->timestamp, NULL);
}
break;
case ECORE_OUT:
evas_event_feed_mouse_out(lookup->evas, e->timestamp, NULL);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_OUT, e))
{
evas_event_feed_mouse_out(lookup->evas, e->timestamp, NULL);
}
break;
default:
break;
@ -644,7 +705,12 @@ ecore_event_evas_mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_WHEEL, e))
{
evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL);
}
return ECORE_CALLBACK_PASS_ON;
}
@ -669,9 +735,14 @@ ecore_event_evas_axis_update(void *data EINA_UNUSED, int type EINA_UNUSED, void
e = event;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
evas_event_feed_axis_update(lookup->evas, e->timestamp, e->device,
e->toolid, e->naxis,
(Evas_Axis *)e->axis, NULL);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_AXIS_UPDATE, e))
{
evas_event_feed_axis_update(lookup->evas, e->timestamp, e->device,
e->toolid, e->naxis,
(Evas_Axis *)e->axis, NULL);
}
return ECORE_CALLBACK_PASS_ON;
}

View File

@ -125,14 +125,23 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color,
#include "interfaces/efl_pack_linear.eo.h"
#include "interfaces/efl_pack_grid.eo.h"
/* 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_interface.eo.h"
#include "interfaces/efl_event.eo.h"
#else
#ifndef EFL_NOLEGACY_API_SUPPORT
#include "interfaces/efl_gfx_types.eot.h"
#include "interfaces/efl_event_types.eot.h"
#include "interfaces/efl_gfx_fill.eo.legacy.h"
#include "interfaces/efl_gfx.eo.legacy.h"
#include "interfaces/efl_image.eo.legacy.h"
#include "interfaces/efl_image_animated.eo.legacy.h"
#include "interfaces/efl_input_device.eo.legacy.h"
#endif
typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;

View File

@ -0,0 +1,70 @@
/* This header file is intended for EFL internal use, and is not part of
* EFL stable API.
* Place here structs and enums that need to be shared between core EFL
* components, such as Ecore, Evas, etc...
*/
#ifndef EFL_COMMON_INTERNAL_H
#define EFL_COMMON_INTERNAL_H
#ifndef EFL_INTERNAL_UNSTABLE
# error This file can not be included outside EFL
#endif
#include <Efl.h>
typedef struct _Efl_Event_Pointer_Data Efl_Event_Pointer_Data;
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_
typedef struct _Evas_Modifier Evas_Modifier;
typedef struct _Evas_Lock Evas_Lock;
#endif
struct _Efl_Event_Pointer_Data
{
Eo *eo;
unsigned int timestamp; /* FIXME: store as double? */
int button;
unsigned int pressed_buttons;
int finger;
double radius, radius_x, radius_y;
double pressure;
double angle;
struct {
double x, y;
} cur, prev;
struct {
Efl_Orient dir;
int z;
} wheel;
Efl_Gfx *source; /* could it be ecore? */
Efl_Input_Device *device;
Efl_Pointer_Action action;
Efl_Pointer_Flags button_flags;
Efl_Event_Flags event_flags;
void *data; /* evas data - whatever that is */
const Eo_Event_Description *event_desc;
Eina_Bool window_pos; /* true if positions are window-relative
(see input vs. feed: this is "input") */
Evas_Modifier *modifiers;
Evas_Lock *locks;
void *legacy; /* DO NOT TOUCH (may contain the legacy event_info) */
Eina_Bool evas_done; /* set by evas */
};
struct _Efl_Input_Device_Data
{
Eo *eo;
Eo *evas; /* Evas */
Efl_Input_Device *parent; /* no ref */
Efl_Input_Device *source; /* ref */
Eina_List *children; /* ref */
Eina_Stringshare *name;
Eina_Stringshare *desc;
Efl_Input_Device_Class klass;
Efl_Input_Device_Sub_Class subclass;
};
#endif

View File

@ -0,0 +1,37 @@
import eo_base;
interface Efl.Event
{
[[Represents a generic event data.
Note: Most Eo Events do not carry Eo objects, rather simple data
structures. This class is intended to carry more complex event
data, such as pointer events.
@since 1.18
]]
legacy_prefix: null;
methods {
@property timestamp {
[[The time at which an event was generated.
If the event is generated by a server (eg. X.org or Wayland), then
the time may be set by the server. Usually this time will be based
on the monotonic clock, if available, but this class can not
guarantee it.
]]
set { [[Call this when generating events manually.]] }
get {}
values {
ms: double; [[Time in milliseconds when the event happened.]]
}
}
reset {
[[Resets the internal data to 0 or default values.]]
}
dup {
[[Creates a copy of this event.]]
return: own(Efl.Event);
}
}
}

View File

@ -0,0 +1,35 @@
/* FIXME: Do we need this? Or just use the Eo Event Description as a type? */
enum Efl.Pointer.Action
{
[[Pointer event type.
@since 1.18
]]
none, [[Not a valid event.]]
move, [[Mouse or equivalent pointer moved.]]
down, [[Mouse button or equivalent pointer pressed down.
Always followed by up or cancel.]]
up, [[Mouse button or equivalent pointer released. See also cancel.]]
cancel, [[Special event happening after a down if the up counterpart
can not happen (eg. another window forcibly stole the focus).]]
in, [[Mouse or pointer entered the object.]]
out, [[Mouse or pointer exited the object.]]
wheel, [[Mouse wheel scroll, horizontally or vertically.]]
axis, [[Joystick event.]]
}
enum Efl.Pointer.Flags
{
/* Evas.Button_Flags */
none = 0, [[No extra mouse button data]]
double_click = (1 << 0), [[This mouse button press was the 2nd press of a double click]]
triple_click = (1 << 1), [[This mouse button press was the 3rd press of a triple click]]
}
enum Efl.Event.Flags
{
/* Evas.Event_Flags */
none = 0, [[No fancy flags set]]
on_hold = (1 << 0), [[This event is being delivered but should be put "on hold" until the on hold flag is unset. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything]]
on_scroll = (1 << 1), [[This event flag indicates the event occurs while scrolling; for example, DOWN event occurs during scrolling; the event should be used for informational purposes and maybe some indications visually, but not actually perform anything]]
}

View File

@ -0,0 +1,106 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Efl.h>
#define EFL_INTERNAL_UNSTABLE
#include "efl_common_internal.h"
/* Efl Input Device = Evas Device */
EOLIAN static Eo_Base *
_efl_input_device_eo_base_constructor(Eo *obj, Efl_Input_Device_Data *pd)
{
obj = eo_constructor(eo_super(obj, EFL_INPUT_DEVICE_CLASS));
pd->eo = obj;
return obj;
}
EOLIAN static void
_efl_input_device_eo_base_destructor(Eo *obj, Efl_Input_Device_Data *pd)
{
Eo *eo_child;
eina_stringshare_del(pd->name);
eina_stringshare_del(pd->desc);
EINA_LIST_FREE(pd->children, eo_child)
{
Efl_Input_Device_Data *child = eo_data_scope_get(eo_child, EFL_INPUT_DEVICE_CLASS);
child->parent = NULL;
eo_unref(eo_child);
}
eo_unref(pd->source);
return eo_destructor(eo_super(obj, EFL_INPUT_DEVICE_CLASS));
}
EOLIAN static void
_efl_input_device_device_type_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device_Class klass)
{
pd->klass= klass;
}
EOLIAN static Efl_Input_Device_Class
_efl_input_device_device_type_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->klass;
}
EOLIAN static void
_efl_input_device_device_subtype_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device_Sub_Class klass)
{
pd->subclass = klass;
}
EOLIAN static Efl_Input_Device_Sub_Class
_efl_input_device_device_subtype_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->subclass;
}
EOLIAN static void
_efl_input_device_source_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device *src)
{
if (pd->source == src) return;
eo_unref(pd->source);
pd->source = eo_ref(src);
}
EOLIAN static Efl_Input_Device *
_efl_input_device_source_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->source;
}
EOLIAN static void
_efl_input_device_name_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *name)
{
eina_stringshare_replace(&pd->name, name);
}
EOLIAN static const char *
_efl_input_device_name_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->name;
}
EOLIAN static void
_efl_input_device_description_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *desc)
{
eina_stringshare_replace(&pd->desc, desc);
}
EOLIAN static const char *
_efl_input_device_description_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->desc;
}
EOLIAN static Efl_Input_Device *
_efl_input_device_parent_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->parent;
}
#include "interfaces/efl_input_device.eo.c"

View File

@ -0,0 +1,90 @@
enum Efl.Input.Device.Class
{
[[General type of input device.
Legacy support since 1.8.
@since 1.18
]]
none, [[Not a device.]]
seat, [[The user/seat (the user themselves).]]
keyboard, [[A regular keyboard, numberpad or attached buttons.]]
mouse, [[A mouse, trackball or touchpad relative motion device.]]
touch, [[A touchscreen with fingers or stylus.]]
pen, [[A special pen device.]]
pointer, [[A laser pointer, wii-style or "minority report" pointing device.]]
gamepad, [[A gamepad controller or joystick.]]
}
enum Efl.Input.Device.Sub_Class
{
[[Specific type of input device.
Legacy support since 1.8.
@since 1.18
]]
none, [[Not a device.]]
finger, [[The normal flat of your finger.]]
fingernail, [[A fingernail.]]
knuckle, [[A Knuckle.]]
palm, [[The palm of a users hand.]]
hand_size, [[The side of your hand.]]
hand_flat, [[The flat of your hand.]]
pen_tip, [[The tip of a pen.]]
trackpad, [[A trackpad style mouse.]]
trackpoint, [[A trackpoint style mouse.]]
trackball, [[A trackball style mouse.]]
}
/* This represents Evas_Device */
/* FIXME: no parent, no children and no Evas */
class Efl.Input.Device (Eo.Base)
{
[[Represents a pointing device, such as a touch finger, a pen or a mouse.
@since 1.18
]]
legacy_prefix: null;
methods {
/* FIXME: device_class makes compilation error because of class_get() */
@property device_type {
values {
klass: Efl.Input.Device.Class;
}
}
@property device_subtype {
values {
klass: Efl.Input.Device.Sub_Class;
}
}
@property source {
values {
src: Efl.Input.Device;
}
}
@property name {
values {
name: const(char)*;
}
}
@property description {
values {
desc: const(char)*;
}
}
@property parent {
/* set {} */
get {}
values {
parent: Efl.Input.Device;
}
}
}
implements {
Eo.Base.constructor;
Eo.Base.destructor;
}
}

View File

@ -0,0 +1,17 @@
interface Efl.Input.Interface ()
{
[[An object implementing this interface can send pointer events.
Windows and canvas objects may send input events.
]]
event_prefix: efl;
events {
pointer,move: Efl.Event.Pointer;
pointer,down: Efl.Event.Pointer;
pointer,up: Efl.Event.Pointer;
pointer,cancel: Efl.Event.Pointer;
pointer,in: Efl.Event.Pointer;
pointer,out: Efl.Event.Pointer;
pointer,wheel: Efl.Event.Pointer;
}
}

View File

@ -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.]]
}
}
}
}

View File

@ -34,6 +34,7 @@ EAPI const Eo_Event_Description _EFL_GFX_CHANGED =
EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
EO_EVENT_DESCRIPTION("Graphics path changed");
/* Packing & containers */
#include "interfaces/efl_container.eo.c"
#include "interfaces/efl_pack.eo.c"
#include "interfaces/efl_pack_layout.eo.c"
@ -47,6 +48,10 @@ 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"
#include "interfaces/efl_input_interface.eo.c"
EAPI void
__efl_internal_init(void)
{

View File

@ -1,5 +1,6 @@
import edje_types;
import elm_general;
import efl_event_types;
/* FIXME: This shouldn't be here. */
type list_data_get_func_type: __undefined_type;
@ -630,7 +631,7 @@ abstract Elm.Widget (Evas.Object.Smart, Elm.Interface.Atspi_Accessible, Elm.Inte
params {
@in type: Evas.Callback_Type;
@in event_info: void *;
@in event_flags: Evas.Event_Flags *;
@in event_flags: Efl.Event.Flags *;
}
}
signal_callback_add {

View File

@ -1625,6 +1625,25 @@ _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, ev->desc, evt);
return EO_CALLBACK_CONTINUE;
}
EO_CALLBACKS_ARRAY_DEFINE(_elm_win_evas_forward_callbacks,
{ EFL_EVENT_POINTER_MOVE, _evas_event_pointer_cb },
{ EFL_EVENT_POINTER_DOWN, _evas_event_pointer_cb },
{ EFL_EVENT_POINTER_UP, _evas_event_pointer_cb },
{ EFL_EVENT_POINTER_IN, _evas_event_pointer_cb },
{ EFL_EVENT_POINTER_OUT, _evas_event_pointer_cb },
{ EFL_EVENT_POINTER_CANCEL, _evas_event_pointer_cb },
{ EFL_EVENT_POINTER_WHEEL, _evas_event_pointer_cb })
static void
_deferred_ecore_evas_free(void *data)
{
@ -1972,6 +1991,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 +4049,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)
@ -5548,6 +5571,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

View 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, Efl.Input.Interface)
{
legacy_prefix: elm_win;
eo_prefix: elm_obj_win;
@ -830,7 +831,7 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
name: const(char)* @nullable;
}
}
@property type {
@property type { /* FIXME: before finalize */
[[The type of the window.
It is a hint of how the Window Manager should handle it.
@ -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;

View File

@ -232,7 +232,6 @@ struct _Evas_Precision_Position /** A position with precision*/
};
typedef struct _Evas_Pixel_Import_Source Evas_Pixel_Import_Source; /**< A source description of pixels for importing pixels */
typedef struct _Evas_Device Evas_Device; /**< A source device handle - where the event came from */
typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down; /**< Event structure for #EVAS_CALLBACK_MOUSE_DOWN event callbacks */
typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up; /**< Event structure for #EVAS_CALLBACK_MOUSE_UP event callbacks */
typedef struct _Evas_Event_Mouse_In Evas_Event_Mouse_In; /**< Event structure for #EVAS_CALLBACK_MOUSE_IN event callbacks */
@ -248,6 +247,9 @@ typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure f
typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */
typedef struct _Evas_Event_Axis_Update Evas_Event_Axis_Update; /**< Event structure for #EVAS_CALLBACK_AXIS_UPDATE event callbacks @since 1.13 */
/* Opaque types */
typedef Eo Evas_Device; /**< A source device handle - where the event came from */
typedef Efl_Image_Content_Hint Evas_Image_Content_Hint;
#define EVAS_IMAGE_CONTENT_HINT_NONE EFL_IMAGE_CONTENT_HINT_NONE
#define EVAS_IMAGE_CONTENT_HINT_DYNAMIC EFL_IMAGE_CONTENT_HINT_DYNAMIC
@ -315,32 +317,42 @@ typedef enum _Evas_Engine_Render_Mode
EVAS_RENDER_MODE_NONBLOCKING = 1, /**< The rendering is non blocking mode*/
} Evas_Engine_Render_Mode; /**< behaviour of the renderer*/
typedef enum _Evas_Device_Class
{
EVAS_DEVICE_CLASS_NONE, /**< Not a device @since 1.8 */
EVAS_DEVICE_CLASS_SEAT, /**< The user/seat (the user themselves) @since 1.8 */
EVAS_DEVICE_CLASS_KEYBOARD, /**< A regular keyboard, numberpad or attached buttons @since 1.8 */
EVAS_DEVICE_CLASS_MOUSE, /**< A mouse, trackball or touchpad relative motion device @since 1.8 */
EVAS_DEVICE_CLASS_TOUCH, /**< A touchscreen with fingers or stylus @since 1.8 */
EVAS_DEVICE_CLASS_PEN, /**< A special pen device @since 1.8 */
EVAS_DEVICE_CLASS_POINTER, /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */
EVAS_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */
} Evas_Device_Class; /**< A general class of device @since 1.8 */
typedef Efl_Input_Device_Class Evas_Device_Class;
typedef enum _Evas_Device_Subclass
{
EVAS_DEVICE_SUBCLASS_NONE, /**< Not a device @since 1.8 */
EVAS_DEVICE_SUBCLASS_FINGER, /**< The normal flat of your finger @since 1.8 */
EVAS_DEVICE_SUBCLASS_FINGERNAIL, /**< A fingernail @since 1.8 */
EVAS_DEVICE_SUBCLASS_KNUCKLE, /**< A Knuckle @since 1.8 */
EVAS_DEVICE_SUBCLASS_PALM, /**< The palm of a users hand @since 1.8 */
EVAS_DEVICE_SUBCLASS_HAND_SIZE, /**< The side of your hand @since 1.8 */
EVAS_DEVICE_SUBCLASS_HAND_FLAT, /**< The flat of your hand @since 1.8 */
EVAS_DEVICE_SUBCLASS_PEN_TIP, /**< The tip of a pen @since 1.8 */
EVAS_DEVICE_SUBCLASS_TRACKPAD, /**< A trackpad style mouse @since 1.8 */
EVAS_DEVICE_SUBCLASS_TRACKPOINT, /**< A trackpoint style mouse @since 1.8 */
EVAS_DEVICE_SUBCLASS_TRACKBALL, /**< A trackball style mouse @since 1.8 */
} Evas_Device_Subclass; /**< A general subclass of device @since 1.8 */
#define EVAS_DEVICE_CLASS_NONE EFL_INPUT_DEVICE_CLASS_NONE /**< Not a device @since 1.8 */
#define EVAS_DEVICE_CLASS_SEAT EFL_INPUT_DEVICE_CLASS_SEAT /**< The user/seat (the user themselves) @since 1.8 */
#define EVAS_DEVICE_CLASS_KEYBOARD EFL_INPUT_DEVICE_CLASS_KEYBOARD /**< A regular keyboard, numberpad or attached buttons @since 1.8 */
#define EVAS_DEVICE_CLASS_MOUSE EFL_INPUT_DEVICE_CLASS_MOUSE /**< A mouse, trackball or touchpad relative motion device @since 1.8 */
#define EVAS_DEVICE_CLASS_TOUCH EFL_INPUT_DEVICE_CLASS_TOUCH /**< A touchscreen with fingers or stylus @since 1.8 */
#define EVAS_DEVICE_CLASS_PEN EFL_INPUT_DEVICE_CLASS_PEN /**< A special pen device @since 1.8 */
#define EVAS_DEVICE_CLASS_POINTER EFL_INPUT_DEVICE_CLASS_POINTER /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */
#define EVAS_DEVICE_CLASS_GAMEPAD EFL_INPUT_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */
typedef Efl_Input_Device_Sub_Class Evas_Device_Subclass;
#define EVAS_DEVICE_SUBCLASS_NONE EFL_INPUT_DEVICE_SUBCLASS_NONE /**< Not a device @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_FINGER EFL_INPUT_DEVICE_SUBCLASS_FINGER /**< The normal flat of your finger @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_FINGERNAIL EFL_INPUT_DEVICE_SUBCLASS_FINGERNAIL /**< A fingernail @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_KNUCKLE EFL_INPUT_DEVICE_SUBCLASS_KNUCKLE /**< A Knuckle @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_PALM EFL_INPUT_DEVICE_SUBCLASS_PALM /**< The palm of a users hand @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_HAND_SIZE EFL_INPUT_DEVICE_SUBCLASS_HAND_SIZE /**< The side of your hand @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_HAND_FLAT EFL_INPUT_DEVICE_SUBCLASS_HAND_FLAT /**< The flat of your hand @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_PEN_TIP EFL_INPUT_DEVICE_SUBCLASS_PEN_TIP /**< The tip of a pen @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_TRACKPAD EFL_INPUT_DEVICE_SUBCLASS_TRACKPAD /**< A trackpad style mouse @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_TRACKPOINT EFL_INPUT_DEVICE_SUBCLASS_TRACKPOINT /**< A trackpoint style mouse @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_TRACKBALL EFL_INPUT_DEVICE_SUBCLASS_TRACKBALL /**< A trackball style mouse @since 1.8 */
typedef Efl_Pointer_Flags Evas_Button_Flags;
#define EVAS_BUTTON_NONE EFL_POINTER_FLAGS_NONE
#define EVAS_BUTTON_DOUBLE_CLICK EFL_POINTER_FLAGS_DOUBLE_CLICK
#define EVAS_BUTTON_TRIPLE_CLICK EFL_POINTER_FLAGS_TRIPLE_CLICK
typedef Efl_Event_Flags Evas_Event_Flags;
#define EVAS_EVENT_FLAG_NONE EFL_EVENT_FLAGS_NONE
#define EVAS_EVENT_FLAG_ON_HOLD EFL_EVENT_FLAGS_ON_HOLD
#define EVAS_EVENT_FLAG_ON_SCROLL EFL_EVENT_FLAGS_ON_SCROLL
struct _Evas_Engine_Info /** Generic engine information. Generic info is useless */
{
@ -363,6 +375,7 @@ struct _Evas_Event_Mouse_Down /** Mouse button press event */
Evas_Event_Flags event_flags;
Evas_Device *dev;
Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Mouse_Up /** Mouse button release event */
@ -381,6 +394,7 @@ struct _Evas_Event_Mouse_Up /** Mouse button release event */
Evas_Event_Flags event_flags;
Evas_Device *dev;
Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Mouse_In /** Mouse enter event */
@ -397,6 +411,7 @@ struct _Evas_Event_Mouse_In /** Mouse enter event */
Evas_Event_Flags event_flags;
Evas_Device *dev;
Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Mouse_Out /** Mouse leave event */
@ -413,6 +428,7 @@ struct _Evas_Event_Mouse_Out /** Mouse leave event */
Evas_Event_Flags event_flags;
Evas_Device *dev;
Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Mouse_Move /** Mouse move event */
@ -429,6 +445,7 @@ struct _Evas_Event_Mouse_Move /** Mouse move event */
Evas_Event_Flags event_flags;
Evas_Device *dev;
Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Mouse_Wheel /** Wheel event */
@ -445,6 +462,7 @@ struct _Evas_Event_Mouse_Wheel /** Wheel event */
unsigned int timestamp;
Evas_Event_Flags event_flags;
Evas_Device *dev;
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Multi_Down /** Multi button press event */
@ -464,6 +482,7 @@ struct _Evas_Event_Multi_Down /** Multi button press event */
unsigned int timestamp;
Evas_Event_Flags event_flags;
Evas_Device *dev;
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Multi_Up /** Multi button release event */
@ -483,6 +502,7 @@ struct _Evas_Event_Multi_Up /** Multi button release event */
unsigned int timestamp;
Evas_Event_Flags event_flags;
Evas_Device *dev;
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Multi_Move /** Multi button down event */
@ -499,6 +519,7 @@ struct _Evas_Event_Multi_Move /** Multi button down event */
unsigned int timestamp;
Evas_Event_Flags event_flags;
Evas_Device *dev;
void *reserved; /**< Reserved field for internal use only. @since 1.18 */
};
struct _Evas_Event_Key_Down /** Key press event */

View 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_event_pointer.eo.h"

View File

@ -336,6 +336,217 @@ EAPI int evas_event_freeze_get(const Evas *e) EINA_WARN_UNUSED_RESU
* out on new objects if the state change demands it.
*/
EAPI void evas_event_thaw_eval(Evas *e) EINA_ARG_NONNULL(1);
/**
* @brief Mouse move event feed.
*
* This function will set some evas properties that is necessary when the mouse
* is moved from its last position. It prepares information to be treated by
* the callback function.
*
* @param[in] y The vertical position of the mouse pointer.
* @param[in] timestamp The timestamp of the mouse up event.
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_mouse_move(Evas *obj, int x, int y, unsigned int timestamp, const void *data);
/**
* @brief Mouse move event feed from input.
*
* Similar to the @ref evas_event_feed_mouse_move, this function will inform
* Evas about mouse move events which were received by the input system,
* relative to the 0,0 of the window, not to the canvas 0,0. It will take care
* of doing any special transformation like adding the framespace offset to the
* mouse event.
*
* @param[in] y The vertical position of the mouse pointer relative to the 0,0
* of the window/surface.
* @param[in] timestamp The timestamp of the mouse move event.
* @param[in] data The data for canvas.
*
* @since 1.8
*/
EAPI void evas_event_input_mouse_move(Evas *obj, int x, int y, unsigned int timestamp, const void *data);
/**
* @brief Mouse up event feed.
*
* This function will set some evas properties that is necessary when the mouse
* button is released. It prepares information to be treated by the callback
* function.
*
* @param[in] flags Evas button flags.
* @param[in] timestamp The timestamp of the mouse up event.
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_mouse_up(Evas *obj, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
/**
* @brief Mouse down event feed.
*
* This function will set some evas properties that is necessary when the mouse
* button is pressed. It prepares information to be treated by the callback
* function.
*
* @param[in] flags Evas button flags.
* @param[in] timestamp The timestamp of the mouse up event.
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_mouse_down(Evas *obj, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
/**
* @brief Mouse wheel event feed.
*
* This function will set some evas properties that is necessary when the mouse
* wheel is scrolled up or down. It prepares information to be treated by the
* callback function.
*
* @param[in] z How much mouse wheel was scrolled up or down.
* @param[in] timestamp The timestamp of the mouse up event.
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_mouse_wheel(Evas *obj, int direction, int z, unsigned int timestamp, const void *data);
/**
* @brief Mouse in event feed.
*
* This function will set some evas properties that is necessary when the mouse
* in event happens. It prepares information to be treated by the callback
* function.
*
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_mouse_in(Evas *obj, unsigned int timestamp, const void *data);
/**
* @brief Mouse out event feed.
*
* This function will set some evas properties that is necessar when the mouse
* out event happens. It prepares information to be treated by the callback
* function.
*
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_mouse_out(Evas *obj, unsigned int timestamp, const void *data);
/**
* @brief Mouse cancel event feed.
*
* This function will call generate a mouse up event.
*
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_mouse_cancel(Evas *obj, unsigned int timestamp, const void *data);
/* multi touch events - no doc */
EAPI void evas_event_input_multi_down(Evas *obj, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
EAPI void evas_event_input_multi_move(Evas *obj, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, unsigned int timestamp, const void *data);
EAPI void evas_event_input_multi_up(Evas *obj, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
EAPI void evas_event_feed_multi_down(Evas *obj, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
EAPI void evas_event_feed_multi_move(Evas *obj, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, unsigned int timestamp, const void *data);
EAPI void evas_event_feed_multi_up(Evas *obj, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
/**
* @brief Key down event feed.
*
* This function will set some evas properties that is necessary when a key is
* pressed. It prepares information to be treated by the callback function.
*
* @param[in] key The key pressed.
* @param[in] string A string.
* @param[in] compose The compose string.
* @param[in] timestamp Timestamp of the mouse up event.
* @param[in] data Data for canvas.
*/
EAPI void evas_event_feed_key_down(Evas *obj, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data);
/**
* @brief Key up event feed.
*
* This function will set some evas properties that is necessary when a key is
* released. It prepares information to be treated by the callback function.
*
* @param[in] key The key released.
* @param[in] string A string.
* @param[in] compose Compose.
* @param[in] timestamp Timestamp of the mouse up event.
* @param[in] data Data for canvas.
*/
EAPI void evas_event_feed_key_up(Evas *obj, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data);
/**
* @brief Key down event feed with keycode.
*
* This function will set some evas properties that is necessary when a key is
* pressed. It prepares information to be treated by the callback function.
*
* @param[in] key The key released.
* @param[in] string A string.
* @param[in] compose Compose.
* @param[in] timestamp Timestamp of the mouse up event.
* @param[in] data Data for canvas.
* @param[in] keycode Key scan code numeric value for canvas.
*
* @since 1.10
*/
EAPI void evas_event_feed_key_down_with_keycode(Evas *obj, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data, unsigned int keycode);
/**
* @brief Key up event feed with keycode.
*
* This function will set some evas properties that is necessary when a key is
* released. It prepares information to be treated by the callback function.
*
* @param[in] key The key released.
* @param[in] string A string.
* @param[in] compose Compose.
* @param[in] timestamp Timestamp of the mouse up event.
* @param[in] data Data for canvas.
* @param[in] keycode Key scan code numeric value for canvas.
*
* @since 1.10
*/
EAPI void evas_event_feed_key_up_with_keycode(Evas *obj, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data, unsigned int keycode);
/**
* @brief Input device axis update event feed.
*
* This function will set some evas properties that is necessary when an e.g.
* stylus axis is updated. It prepares information to be treated by the
* callback function.
*
* @param[in] device System-provided device identifier.
* @param[in] toolid Type of tool currently being used.
* @param[in] naxes Number of elements in the \p axis array.
* @param[in] axis Array containing the current value of all updated axes.
* @param[in] data Data for canvas.
*
* @since 1.13
*/
EAPI void evas_event_feed_axis_update(Evas *obj, unsigned int timestamp, int device, int toolid, int naxes, const Evas_Axis *axis, const void *data);
/**
* @brief Hold event feed.
*
* This function makes the object to stop sending events.
*
* @param[in] timestamp The timestamp of the mouse up event.
* @param[in] data The data for canvas.
*/
EAPI void evas_event_feed_hold(Evas *obj, int hold, unsigned int timestamp, const void *data);
/**
* @brief Re feed event.
*
* This function re-feeds the event pointed by event_copy.
*
* This function call evas_event_feed_* functions, so it can cause havoc if not
* used wisely. Please use it responsibly.
*
* @param[in] event_type Event type.
*/
EAPI void evas_event_refeed_event(Evas *obj, void *event_copy, Evas_Callback_Type event_type);
/**
* @}
*/

View File

@ -0,0 +1,401 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Evas.h>
#define EFL_INTERNAL_UNSTABLE
#include "interfaces/efl_common_internal.h"
#define MY_CLASS EFL_EVENT_POINTER_CLASS
/* Pointer Event
*
* This is a storage class only, should not require ANY knowledge about
* Ecore, Evas or anything else.
*
* This is intended to replace Ecore and Evas structs for mouse events.
*
* Do not add any logic here.
*/
static Efl_Event_Pointer *s_cached_event = NULL;
static void
_del_hook(Eo *evt)
{
if (!s_cached_event)
{
if (eo_parent_get(evt))
{
eo_ref(evt);
eo_parent_set(evt, NULL);
}
s_cached_event = evt;
}
else
{
eo_del_intercept_set(evt, NULL);
eo_unref(evt);
}
}
EOLIAN static Efl_Event_Pointer *
_efl_event_pointer_instance_get(Eo_Class *klass EINA_UNUSED, void *pd EINA_UNUSED,
Eo *owner, void **priv)
{
Efl_Event_Pointer *evt;
if (s_cached_event)
{
evt = s_cached_event;
s_cached_event = NULL;
efl_event_reset(evt);
eo_parent_set(evt, owner);
}
else
{
evt = eo_add(EFL_EVENT_POINTER_CLASS, owner);
eo_del_intercept_set(evt, _del_hook);
}
if (priv)
*priv = eo_data_scope_get(evt, EFL_EVENT_POINTER_CLASS);
return evt;
}
EOLIAN static void
_efl_event_pointer_class_destructor(Eo_Class *klass EINA_UNUSED)
{
// this is a strange situation...
eo_unref(s_cached_event);
s_cached_event = NULL;
}
EOLIAN static Eo_Base *
_efl_event_pointer_eo_base_constructor(Eo *obj, Efl_Event_Pointer_Data *pd EINA_UNUSED)
{
eo_constructor(eo_super(obj, MY_CLASS));
efl_event_reset(obj);
return obj;
}
EOLIAN static void
_efl_event_pointer_efl_event_reset(Eo *obj, Efl_Event_Pointer_Data *pd)
{
free(pd->legacy);
memset(pd, 0, sizeof(*pd));
pd->eo = obj;
pd->wheel.dir = EFL_ORIENT_VERTICAL;
}
EOLIAN static Efl_Event *
_efl_event_pointer_efl_event_dup(Eo *obj, Efl_Event_Pointer_Data *pd)
{
Efl_Event_Pointer_Data *ev;
Efl_Event_Pointer *evt;
evt = _efl_event_pointer_instance_get((Eo_Class *) EFL_EVENT_POINTER_CLASS,
NULL, obj, (void **) &ev);
if (!evt) return NULL;
memcpy(ev, pd, sizeof(*ev));
ev->eo = evt;
return evt;
}
EOLIAN static void
_efl_event_pointer_action_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Pointer_Action act)
{
pd->action = act;
}
EOLIAN static Efl_Pointer_Action
_efl_event_pointer_action_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->action;
}
EOLIAN static void
_efl_event_pointer_button_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int but)
{
pd->button = but;
}
EOLIAN static int
_efl_event_pointer_button_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->button;
}
EOLIAN static void
_efl_event_pointer_button_pressed_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int button, Eina_Bool pressed)
{
if (button < 0) return;
if (button > 31) return;
if (pressed)
pd->button_flags |= (1 << button);
else
pd->button_flags &= ~(1 << button);
}
EOLIAN static Eina_Bool
_efl_event_pointer_button_pressed_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int button)
{
if (button < 0) return EINA_FALSE;
if (button > 31) return EINA_FALSE;
return (pd->button_flags & (1 << button)) != 0;
}
EOLIAN static void
_efl_event_pointer_position_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int x, int y)
{
pd->cur.x = (double) x;
pd->cur.y = (double) y;
}
EOLIAN static void
_efl_event_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int *x, int *y)
{
if (x) *x = (int) pd->cur.x;
if (y) *y = (int) pd->cur.y;
}
EOLIAN static void
_efl_event_pointer_position_precise_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double x, double y)
{
pd->cur.x = x;
pd->cur.y = y;
}
EOLIAN static void
_efl_event_pointer_position_precise_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *x, double *y)
{
if (x) *x = pd->cur.x;
if (y) *y = pd->cur.y;
}
EOLIAN static void
_efl_event_pointer_previous_position_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int x, int y)
{
pd->prev.x = (double) x;
pd->prev.y = (double) y;
}
EOLIAN static void
_efl_event_pointer_previous_position_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int *x, int *y)
{
if (x) *x = (int) pd->prev.x;
if (y) *y = (int) pd->prev.y;
}
EOLIAN static void
_efl_event_pointer_previous_position_precise_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double x, double y)
{
pd->prev.x = x;
pd->prev.y = y;
}
EOLIAN static void
_efl_event_pointer_previous_position_precise_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *x, double *y)
{
if (x) *x = pd->prev.x;
if (y) *y = pd->prev.y;
}
EOLIAN static void
_efl_event_pointer_device_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Input_Device *dev)
{
/* ref? */
pd->device = dev;
}
EOLIAN static Efl_Input_Device *
_efl_event_pointer_device_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->device;
}
EOLIAN static void
_efl_event_pointer_source_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Gfx *src)
{
/* ref? */
pd->source = src;
}
EOLIAN static Efl_Gfx *
_efl_event_pointer_source_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->source;
}
EOLIAN static void
_efl_event_pointer_button_flags_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Pointer_Flags flags)
{
pd->button_flags = flags;
}
EOLIAN static Efl_Pointer_Flags
_efl_event_pointer_button_flags_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->button_flags;
}
EOLIAN static void
_efl_event_pointer_event_flags_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Event_Flags flags)
{
pd->event_flags = flags;
}
EOLIAN static Efl_Event_Flags
_efl_event_pointer_event_flags_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->event_flags;
}
EOLIAN static void
_efl_event_pointer_efl_event_timestamp_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double ms)
{
pd->timestamp = (unsigned int) ms;
}
EOLIAN static double
_efl_event_pointer_efl_event_timestamp_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return (double) pd->timestamp;
}
EOLIAN static void
_efl_event_pointer_wheel_direction_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Orient dir)
{
pd->wheel.dir = dir;
}
EOLIAN static Efl_Orient
_efl_event_pointer_wheel_direction_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->wheel.dir;
}
EOLIAN static void
_efl_event_pointer_wheel_distance_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int dist)
{
pd->wheel.z = dist;
}
EOLIAN static int
_efl_event_pointer_wheel_distance_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->wheel.z;
}
EOLIAN static int
_efl_event_pointer_finger_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return pd->finger;
}
EOLIAN static void
_efl_event_pointer_finger_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int id)
{
pd->finger = id;
}
EOLIAN static void
_efl_event_pointer_touch_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *r, double *rx, double *ry, double *press, double *angle)
{
if (r) *r = pd->radius;
if (rx) *rx = pd->radius_x;
if (ry) *ry = pd->radius_y;
if (press) *press = pd->pressure;
if (angle) *angle = pd->angle;
}
EOLIAN static void
_efl_event_pointer_touch_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double r, double rx, double ry, double press, double angle)
{
pd->radius = r;
pd->radius_x = rx;
pd->radius_y = ry;
pd->pressure = press;
pd->angle = angle;
}
EOLIAN static Eina_Bool
_efl_event_pointer_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_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_event_pointer_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, const char *name)
{
if (!pd->locks) return EINA_FALSE;
return evas_key_lock_is_set(pd->locks, name);
}
EOLIAN static void
_efl_event_pointer_double_click_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
{
if (val)
pd->button_flags |= EFL_POINTER_FLAGS_DOUBLE_CLICK;
else
pd->button_flags &= ~EFL_POINTER_FLAGS_DOUBLE_CLICK;
}
EOLIAN static Eina_Bool
_efl_event_pointer_double_click_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return !!(pd->button_flags & EFL_POINTER_FLAGS_DOUBLE_CLICK);
}
EOLIAN static void
_efl_event_pointer_triple_click_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
{
if (val)
pd->button_flags |= EFL_POINTER_FLAGS_TRIPLE_CLICK;
else
pd->button_flags &= ~EFL_POINTER_FLAGS_TRIPLE_CLICK;
}
EOLIAN static Eina_Bool
_efl_event_pointer_triple_click_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return !!(pd->button_flags & EFL_POINTER_FLAGS_TRIPLE_CLICK);
}
EOLIAN static void
_efl_event_pointer_on_hold_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
{
if (val)
pd->event_flags |= EFL_EVENT_FLAGS_ON_HOLD;
else
pd->event_flags &= ~EFL_EVENT_FLAGS_ON_HOLD;
}
EOLIAN static Eina_Bool
_efl_event_pointer_on_hold_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return !!(pd->event_flags & EFL_EVENT_FLAGS_ON_HOLD);
}
EOLIAN static void
_efl_event_pointer_on_scroll_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
{
if (val)
pd->event_flags |= EFL_EVENT_FLAGS_ON_SCROLL;
else
pd->event_flags &= ~EFL_EVENT_FLAGS_ON_SCROLL;
}
EOLIAN static Eina_Bool
_efl_event_pointer_on_scroll_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
{
return !!(pd->event_flags & EFL_EVENT_FLAGS_ON_SCROLL);
}
#include "efl_event_pointer.eo.c"

View File

@ -0,0 +1,173 @@
import efl_orientation;
import efl_event_types;
class Efl.Event.Pointer (Eo.Base, Efl.Event, Efl.Input.State)
{
[[Event data carried over with any pointer event (mouse, touch, ...)
@since 1.18
]]
methods {
@property action {
[[The action represented by this event.]]
values {
act: Efl.Pointer.Action;
}
}
@property button {
[[The mouse button that triggered the event.]]
values {
but: int; [[1 to 32, 0 if not a button event.]]
}
}
@property button_pressed {
[[Whether a mouse button is pressed at the moment of the event.]]
keys {
button: int;
}
values {
pressed: bool;
}
}
@property position {
[[Position where the event happened, relative to the window.]]
values {
x: int;
y: int;
}
}
@property position_precise {
[[Position where the event happened, with subpixel precision
Note: Same value as @.position, relative to the window.
]]
values {
x: double;
y: double;
}
}
@property previous_position {
[[Position of the previous event, valid for move events.
Relative to the window. May be equal to @.position.
]]
values {
x: int;
y: int;
}
}
@property previous_position_precise {
[[Position of the previous event, with subpixel precision.
Valid for move events, may not be valid for other events.
Relative to the window. May be equal to @.position_precise.
]]
values {
x: double;
y: double;
}
}
@property device {
[[Pointing device that originated this event.]]
values {
dev: Efl.Input.Device;
}
}
@property finger {
[[Finger ID in case of a multi touch event.]]
values {
id: int;
}
}
@property touch {
[[Touch information about a specific finger or pointer.]]
values {
radius: double;
rad_x: double;
rad_y: double;
pressure: double;
angle: double;
}
}
@property source {
[[The object where this event first originated, in case of
propagation or repetition of the event.
]]
values {
src: Eo.Base; [[Source object: $Efl.Gfx]]
}
}
@property button_flags {
[[Double or triple click information.]]
values {
flags: Efl.Pointer.Flags;
}
}
@property double_click {
[[$true if @.button_flags indicates a double click (2nd press).
This is just a helper function around @.button_flags.
]]
values {
val: bool;
}
}
@property triple_click {
[[$true if @.button_flags indicates a triple click (3rd press).
This is just a helper function around @.button_flags.
]]
values {
val: bool;
}
}
@property event_flags {
[[Extra flags for this event, may be changed by the user.]]
values {
flags: Efl.Event.Flags;
}
}
@property on_hold {
[[$true if @.event_flags indicates the event is on hold.]]
values {
val: bool;
}
}
@property on_scroll {
[[$true if @.event_flags indicates the event happened while scrolling.]]
values {
val: bool;
}
}
@property wheel_direction {
values {
dir: Efl.Orient; [[Horizontal or Vertical only.]]
}
}
@property wheel_distance {
values {
dist: int;
}
}
instance_get @class {
[[Creates an instance of this events or returns a fresh one from
a memory pool.
]]
params {
@in owner: Eo.Base; [[The parent object.]]
@out priv: void*; [[Pointer to the internal data of the object.]]
}
return: own(Efl.Event.Pointer);
}
}
implements {
Eo.Base.constructor;
class.destructor;
Efl.Event.reset;
Efl.Event.dup;
Efl.Event.timestamp.set;
Efl.Event.timestamp.get;
Efl.Input.State.modifier_enabled.get;
Efl.Input.State.lock_enabled.get;
}
}

View File

@ -1,6 +1,9 @@
#include "evas_common_private.h"
#include "evas_private.h"
#define EFL_INTERNAL_UNSTABLE
#include "interfaces/efl_common_internal.h"
int _evas_event_counter = 0;
EVAS_MEMPOOL(_mp_pc);
@ -58,14 +61,6 @@ typedef struct
Evas_Callback_Type type;
} _eo_evas_object_cb_info;
static Eina_Bool
_eo_evas_object_cb(void *data, const Eo_Event *event)
{
_eo_evas_object_cb_info *info = data;
if (info->func) info->func(info->data, evas_object_evas_get(event->object), event->object, event->info);
return EINA_TRUE;
}
typedef struct
{
EINA_INLIST;
@ -74,6 +69,87 @@ typedef struct
Evas_Callback_Type type;
} _eo_evas_cb_info;
static inline void *
_pointer_event_get(const _eo_evas_object_cb_info *info, const Eo_Event *event,
const Eo_Event_Description **pdesc)
{
if (!info->data) return NULL;
/* See also evas_events.c: _pointer_event_create() */
#define EV_CASE(TYPE, NEWTYPE, Type) \
case EVAS_CALLBACK_ ## TYPE: \
*pdesc = EFL_EVENT_POINTER_ ## NEWTYPE; \
return ((Evas_Event_ ## Type *) event->info)->reserved
switch (info->type)
{
EV_CASE(MOUSE_MOVE, MOVE, Mouse_Move);
EV_CASE(MOUSE_OUT, OUT, Mouse_Out);
EV_CASE(MOUSE_IN, IN, Mouse_In);
EV_CASE(MOUSE_DOWN, DOWN, Mouse_Down);
EV_CASE(MOUSE_UP, UP, Mouse_Up);
EV_CASE(MULTI_MOVE, MOVE, Multi_Move);
EV_CASE(MULTI_DOWN, DOWN, Multi_Down);
EV_CASE(MULTI_UP, UP, Multi_Up);
EV_CASE(MOUSE_WHEEL, WHEEL, Mouse_Wheel);
default: return NULL;
}
#undef EV_CASE
}
static void
_event_flags_adjust(void *ev, const Efl_Event_Pointer_Data *pedata)
{
#define EV_CASE(NEWTYPE, Type) \
case EFL_POINTER_ACTION_ ## NEWTYPE: \
((Evas_Event_ ## Type *) ev)->event_flags = pedata->event_flags; \
break;
switch (pedata->action)
{
EV_CASE(MOVE, Mouse_Move);
EV_CASE(OUT, Mouse_Out);
EV_CASE(IN, Mouse_In);
EV_CASE(DOWN, Mouse_Down);
EV_CASE(UP, Mouse_Up);
EV_CASE(WHEEL, Mouse_Wheel);
default: break;
}
#undef EV_CASE
}
static Eina_Bool
_eo_evas_object_cb(void *data, const Eo_Event *event)
{
_eo_evas_object_cb_info *info = data;
const Eo_Event_Description *desc;
Evas *evas = evas_object_evas_get(event->object);
void *pe;
pe = _pointer_event_get(info, event, &desc);
if (pe)
{
Efl_Event_Pointer_Data *pedata;
Efl_Event_Flags flags;
pedata = eo_data_scope_get(pe, EFL_EVENT_POINTER_CLASS);
flags = pedata->event_flags;
eo_event_callback_call(event->object, desc, pe);
if (flags != pedata->event_flags)
_event_flags_adjust(event->info, pedata);
}
if (info->func)
{
info->func(info->data, evas, event->object, event->info);
// if event_flags changed, pe will be fixed in evas_events.c
}
return EINA_TRUE;
}
static Eina_Bool
_eo_evas_cb(void *data, const Eo_Event *event)
{

View File

@ -1,6 +1,8 @@
import evas_types;
import efl_event_types;
class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator,
Efl.Input.Interface)
{
legacy_prefix: evas;
data: Evas_Public_Data;
@ -113,7 +115,7 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
]]
}
values {
flags: Evas.Event_Flags; [[The default flags to use.]]
flags: Efl.Event.Flags; [[The default flags to use.]]
}
}
@property output_method {
@ -409,8 +411,8 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
canvas.
When this function is called it will return a value of either
$false or $true, depending on if @.event_feed_mouse_in or
@.event_feed_mouse_out have been called to feed in a mouse
$false or $true, depending on if event_feed_mouse_in or
event_feed_mouse_out have been called to feed in a mouse
enter event into the canvas.
A return value of $true indicates the mouse is logically
@ -503,8 +505,7 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
any host system's pointing device abilities.
A canvas by default begins with no mouse buttons being
pressed and only calls to @.event_feed_mouse_down
and @.event_feed_mouse_up will alter that.
pressed and only pointer move events can alter that.
The least significant bit corresponds to the first mouse
button (button 1) and the most significant bit corresponds
@ -547,20 +548,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@in y: int; [[The vertical coordinate of the position.]]
}
}
event_feed_mouse_wheel {
[[Mouse wheel event feed.
This function will set some evas properties that is necessary
when the mouse wheel is scrolled up or down. It prepares
information to be treated by the callback function.
]]
params {
@in direction: int; [[The wheel mouse direction.]]
@in z: int; [[How much mouse wheel was scrolled up or down.]]
@in timestamp: uint; [[The timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
key_lock_on {
[[Enables or turns on programmatically the lock key with name
$keyname.
@ -575,22 +562,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@in keyname: const(char)* @nonull; [[The name of the lock to enable.]]
}
}
event_feed_key_down {
[[Key down event feed.
This function will set some evas properties that is necessary
when a key is pressed. It prepares information to be treated
by the callback function.
]]
params {
@in keyname: const(char)*; [[Name of the key.]]
@in key: const(char)*; [[The key pressed.]]
@in string: const(char)*; [[A string.]]
@in compose: const(char)*; [[The compose string.]]
@in timestamp: uint; [[Timestamp of the mouse up event.]]
@in data: const(void)*; [[Data for canvas.]]
}
}
key_modifier_mask_get @const {
[[Creates a bit mask from the $keyname modifier key. Values
returned from different calls to it may be ORed together,
@ -650,75 +621,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@in keyname: const(char)* @nonull; [[The name of the modifier to disable.]]
}
}
event_feed_hold {
[[Hold event feed.
This function makes the object to stop sending events.
]]
params {
@in hold: int; [[The hold.]]
@in timestamp: uint; [[The timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
event_feed_mouse_move {
[[Mouse move event feed.
This function will set some evas properties that is necessary
when the mouse is moved from its last position. It prepares
information to be treated by the callback function.
]]
params {
@in x: int; [[The horizontal position of the mouse pointer.]]
@in y: int; [[The vertical position of the mouse pointer.]]
@in timestamp: uint; [[The timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
event_feed_key_up {
[[Key up event feed.
This function will set some evas properties that is necessary
when a key is released. It prepares information to be treated
by the callback function.
]]
params {
@in keyname: const(char)*; [[Name of the key.]]
@in key: const(char)*; [[The key released.]]
@in string: const(char)*; [[A string.]]
@in compose: const(char)*; [[Compose.]]
@in timestamp: uint; [[Timestamp of the mouse up event.]]
@in data: const(void)*; [[Data for canvas.]]
}
}
event_feed_mouse_out {
[[Mouse out event feed.
This function will set some evas properties that is necessar
when the mouse out event happens. It prepares information to
be treated by the callback function.
]]
params {
@in timestamp: uint; [[Timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
event_input_multi_move {
params {
@in d: int;
@in x: int;
@in y: int;
@in rad: double;
@in radx: double;
@in rady: double;
@in pres: double;
@in ang: double;
@in fx: double;
@in fy: double;
@in timestamp: uint;
@in data: const(void)*;
}
}
objects_at_xy_get @const {
[[Retrieve a list of Evas objects lying over a given position in
a canvas.
@ -748,40 +650,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
]]
}
}
event_input_multi_up {
params {
@in d: int;
@in x: int;
@in y: int;
@in rad: double;
@in radx: double;
@in rady: double;
@in pres: double;
@in ang: double;
@in fx: double;
@in fy: double;
@in flags: Evas.Button_Flags;
@in timestamp: uint;
@in data: const(void)*;
}
}
event_feed_multi_down {
params {
@in d: int;
@in x: int;
@in y: int;
@in rad: double;
@in radx: double;
@in rady: double;
@in pres: double;
@in ang: double;
@in fx: double;
@in fy: double;
@in flags: Evas.Button_Flags;
@in timestamp: uint;
@in data: const(void)*;
}
}
render_async {
[[Render the given Evas canvas asynchronously.
@ -833,26 +701,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
focus_out {
[[Inform to the evas that it lost the focus.]]
}
event_input_mouse_move {
[[Mouse move event feed from input.
Similar to the @.event_feed_mouse_move, this function will
inform Evas about mouse move events which were received by
the input system, relative to the 0,0 of the window, not to the
canvas 0,0. It will take care of doing any special transformation
like adding the framespace offset to the mouse event.
@since 1.8
]]
params {
@in x: int; [[The horizontal position of the mouse pointer
relative to the 0,0 of the window/surface.]]
@in y: int; [[The vertical position of the mouse pointer
relative to the 0,0 of the window/surface.]]
@in timestamp: uint; [[The timestamp of the mouse move event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
norender {
[[Update the canvas internal objects but not triggering immediate
renderization.
@ -881,23 +729,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
*/
return: uint; [[The number of touched point on the evas.]]
}
event_input_multi_down {
params {
@in d: int;
@in x: int;
@in y: int;
@in rad: double;
@in radx: double;
@in rady: double;
@in pres: double;
@in ang: double;
@in fx: double;
@in fy: double;
@in flags: Evas.Button_Flags;
@in timestamp: uint;
@in data: const(void)*;
}
}
nochange_pop {
[[Pop the nochange flag down 1.
@ -986,47 +817,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@in keyname: const(char)* @nonull; [[The name of the modifier to enable.]]
}
}
event_feed_mouse_up {
[[Mouse up event feed.
This function will set some evas properties that is necessary
when the mouse button is released. It prepares information to
be treated by the callback function.
]]
params {
@in b: int; [[The button number.]]
@in flags: Evas.Button_Flags; [[Evas button flags.]]
@in timestamp: uint; [[The timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
event_feed_mouse_down {
[[Mouse down event feed.
This function will set some evas properties that is necessary
when the mouse button is pressed. It prepares information to
be treated by the callback function.
]]
params {
@in b: int; [[The button number.]]
@in flags: Evas.Button_Flags; [[Evas button flags.]]
@in timestamp: uint; [[The timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
event_refeed_event {
[[Re feed event.
This function re-feeds the event pointed by event_copy.
This function call evas_event_feed_* functions, so it can
cause havoc if not used wisely. Please use it responsibly.
]]
params {
@in event_copy: void *; [[The event to refeed.]]
@in event_type: Evas.Callback_Type; [[Event type.]]
}
}
font_available_list @const {
[[List of available font descriptions known or found by this evas.
@ -1197,22 +987,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@in x: Evas.Coord; [[The canvas x coordinate.]]
}
}
event_feed_multi_move {
params {
@in d: int;
@in x: int;
@in y: int;
@in rad: double;
@in radx: double;
@in rady: double;
@in pres: double;
@in ang: double;
@in fx: double;
@in fy: double;
@in timestamp: uint;
@in data: const(void)*;
}
}
render_updates {
[[Force immediate renderization of the given Evas canvas.
@ -1380,18 +1154,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@.render_idle_flush might discard too.
]]
}
event_feed_mouse_in {
[[Mouse in event feed.
This function will set some evas properties that is necessary
when the mouse in event happens. It prepares information to be
treated by the callback function.
]]
params {
@in timestamp: uint; [[The timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
object_top_in_rectangle_get @const {
[[Retrieve the Evas object stacked at the top of a given
rectangular region in a canvas
@ -1435,23 +1197,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
[[Force renderization of the given canvas.]]
}
event_feed_multi_up {
params {
@in d: int;
@in x: int;
@in y: int;
@in rad: double;
@in radx: double;
@in rady: double;
@in pres: double;
@in ang: double;
@in fx: double;
@in fy: double;
@in flags: Evas.Button_Flags;
@in timestamp: uint;
@in data: const(void)*;
}
}
font_path_prepend {
[[Prepends a font path to the list of font paths used by the
given evas.
@ -1477,17 +1222,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@.damage_rectangle_add).
]]
}
event_feed_mouse_cancel {
[[Mouse cancel event feed.
This function will call @.event_feed_mouse_up when a
mouse cancel event happens.
]]
params {
@in timestamp: uint; [[The timestamp of the mouse up event.]]
@in data: const(void)*; [[The data for canvas.]]
}
}
coord_screen_x_to_world @const {
[[Convert/scale an output screen coordinate into canvas
coordinates.
@ -1574,62 +1308,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
@in y: Evas.Coord; [[The canvas y coordinate.]]
}
}
event_feed_key_down_with_keycode {
[[Key down event feed with keycode.
This function will set some evas properties that is necessary
when a key is pressed. It prepares information to be treated
by the callback function.
@since 1.10
]]
params {
@in keyname: const(char)*; [[Name of the key.]]
@in key: const(char)*; [[The key released.]]
@in string: const(char)*; [[A string.]]
@in compose: const(char)*; [[Compose.]]
@in timestamp: uint; [[Timestamp of the mouse up event.]]
@in data: const(void)*; [[Data for canvas.]]
@in keycode: uint; [[Key scan code numeric value for canvas.]]
}
}
event_feed_key_up_with_keycode {
[[Key up event feed with keycode.
This function will set some evas properties that is necessary
when a key is released. It prepares information to be treated
by the callback function.
@since 1.10
]]
params {
@in keyname: const(char)*; [[Name of the key.]]
@in key: const(char)*; [[The key released.]]
@in string: const(char)*; [[A string.]]
@in compose: const(char)*; [[Compose.]]
@in timestamp: uint; [[Timestamp of the mouse up event.]]
@in data: const(void)*; [[Data for canvas.]]
@in keycode: uint; [[Key scan code numeric value for canvas.]]
}
}
event_feed_axis_update {
[[Input device axis update event feed.
This function will set some evas properties that is necessary
when an e.g. stylus axis is updated. It prepares information
to be treated by the callback function.
@since 1.13
]]
params {
@in timestamp: uint; [[Timestamp of the axis event.]]
@in device: int; [[System-provided device identifier.]]
@in toolid: int; [[Type of tool currently being used.]]
@in naxes: int; [[Number of elements in the \p axis array.]]
@in axis: const(Evas.Axis)*; [[Array containing the current value of all updated axes.]]
@in data: const(void)*; [[Data for canvas.]]
}
}
}
implements {
Eo.Base.constructor;

View File

@ -1,66 +1,84 @@
#include "evas_common_private.h"
#include "evas_private.h"
#define EFL_INTERNAL_UNSTABLE
#include "interfaces/efl_common_internal.h"
/* WARNING: This API is not used across EFL, hard to test! */
#ifdef DEBUG_UNTESTED_
// booh
#define SAFETY_CHECK(obj, klass, ...) \
do { MAGIC_CHECK(dev, Evas_Device, 1); \
return __VA_ARGS__; \
MAGIC_CHECK_END(); \
} while (0)
#else
#define SAFETY_CHECK(obj, klass, ...) \
do { if (!obj) return __VA_ARGS__; } while (0)
#endif
/* FIXME: Ideally no work besides calling the Efl_Input_Device API
* should be done here. But unfortunately, some knowledge of Evas is required
* here (callbacks and canvas private data).
*/
static Eina_Bool
_del_cb(void *data, const Eo_Event *ev)
{
Evas_Public_Data *e = data;
// can not be done in std destructor
e->devices = eina_list_remove(e->devices, ev->object);
return EO_CALLBACK_CONTINUE;
}
EAPI Evas_Device *
evas_device_add(Evas *eo_e)
{
Efl_Input_Device_Data *d;
Evas_Public_Data *e;
Evas_Device *dev;
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return NULL;
MAGIC_CHECK_END();
dev = calloc(1, sizeof(Evas_Device));
if (!dev) return NULL;
dev->magic = MAGIC_DEV;
dev->evas = eo_e;
dev->ref = 1;
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
dev = eo_add(EFL_INPUT_DEVICE_CLASS, eo_e);
d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
d->evas = eo_e;
e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
e->devices = eina_list_append(e->devices, dev);
eo_event_callback_add(dev, EO_EVENT_DEL, _del_cb, e);
evas_event_callback_call(eo_e, EVAS_CALLBACK_DEVICE_CHANGED, dev);
return dev;
}
EAPI void
evas_device_del(Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
if (dev->ref == 1)
{
Evas_Device *dev2;
EINA_LIST_FREE(dev->children, dev2)
{
dev2->parent = NULL;
evas_device_del(dev2);
}
if (dev->src)
{
_evas_device_unref(dev->src);
dev->src = NULL;
}
dev->parent = NULL;
}
_evas_device_unref(dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
eo_unref(dev);
}
EAPI void
evas_device_push(Evas *eo_e, Evas_Device *dev)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
if (!e->cur_device)
{
e->cur_device = eina_array_new(4);
if (!e->cur_device) return;
}
dev->ref++;
eo_ref(dev);
eina_array_push(e->cur_device, dev);
}
@ -68,28 +86,27 @@ EAPI void
evas_device_pop(Evas *eo_e)
{
Evas_Device *dev;
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS);
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
dev = eina_array_pop(e->cur_device);
if (dev) _evas_device_unref(dev);
if (dev) eo_unref(dev);
}
EAPI const Eina_List *
evas_device_list(Evas *eo_e, const Evas_Device *dev)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return NULL;
MAGIC_CHECK_END();
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
if (dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS, NULL);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
return d->children;
}
if (dev) return dev->children;
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
return e->devices;
}
@ -97,141 +114,123 @@ evas_device_list(Evas *eo_e, const Evas_Device *dev)
EAPI void
evas_device_name_set(Evas_Device *dev, const char *name)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
eina_stringshare_replace(&(dev->name), name);
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_name_set(dev, name);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const char *
evas_device_name_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->name;
return efl_input_device_name_get(dev);
}
EAPI void
evas_device_description_set(Evas_Device *dev, const char *desc)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
eina_stringshare_replace(&(dev->desc), desc);
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_description_set(dev, desc);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const char *
evas_device_description_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->desc;
return efl_input_device_description_get(dev);
}
EAPI void
evas_device_parent_set(Evas_Device *dev, Evas_Device *parent)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
Evas_Public_Data *e = eo_data_scope_get(dev->evas, EVAS_CANVAS_CLASS);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
Evas_Public_Data *e = eo_data_scope_get(d->evas, EVAS_CANVAS_CLASS);
if (parent)
{
MAGIC_CHECK(parent, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
SAFETY_CHECK(parent, EFL_INPUT_DEVICE_CLASS);
}
/* FIXME: move this to Efl.Input.Device */
if (d->parent == parent) return;
if (d->parent)
{
Efl_Input_Device_Data *p = eo_data_scope_get(d->parent, EFL_INPUT_DEVICE_CLASS);
p->children = eina_list_remove(p->children, dev);
}
if (dev->parent == parent) return;
if (dev->parent)
dev->parent->children = eina_list_remove(dev->parent->children, dev);
else if (parent)
e->devices = eina_list_remove(e->devices, dev);
dev->parent = parent;
d->parent = parent;
if (parent)
parent->children = eina_list_append(parent->children, dev);
{
Efl_Input_Device_Data *p = eo_data_scope_get(parent, EFL_INPUT_DEVICE_CLASS);
p->children = eina_list_append(p->children, dev);
}
else
e->devices = eina_list_append(e->devices, dev);
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const Evas_Device *
evas_device_parent_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->parent;
return efl_input_device_parent_get(dev);
}
EAPI void
evas_device_class_set(Evas_Device *dev, Evas_Device_Class clas)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
dev->clas = clas;
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_type_set(dev, clas);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI Evas_Device_Class
evas_device_class_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return EVAS_DEVICE_CLASS_NONE;
MAGIC_CHECK_END();
return dev->clas;
return efl_input_device_type_get(dev);
}
EAPI void
evas_device_subclass_set(Evas_Device *dev, Evas_Device_Subclass clas)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
dev->subclas = clas;
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_subtype_set(dev, clas);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI Evas_Device_Subclass
evas_device_subclass_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return EVAS_DEVICE_SUBCLASS_NONE;
MAGIC_CHECK_END();
return dev->subclas;
return efl_input_device_subtype_get(dev);
}
EAPI void
evas_device_emulation_source_set(Evas_Device *dev, Evas_Device *src)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
if (src)
{
MAGIC_CHECK(src, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
}
if (dev->src == src) return;
if (dev->src) _evas_device_unref(dev->src);
dev->src = src;
if (dev->src) dev->src->ref++;
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_source_set(dev, src);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const Evas_Device *
evas_device_emulation_source_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->src;
return efl_input_device_source_get(dev);
}
void
@ -243,7 +242,7 @@ _evas_device_cleanup(Evas *eo_e)
if (e->cur_device)
{
while ((dev = eina_array_pop(e->cur_device)))
_evas_device_unref(dev);
eo_unref(dev);
eina_array_free(e->cur_device);
e->cur_device = NULL;
}
@ -264,21 +263,3 @@ _evas_device_top_get(const Evas *eo_e)
if (num < 1) return NULL;
return eina_array_data_get(e->cur_device, num - 1);
}
void
_evas_device_ref(Evas_Device *dev)
{
dev->ref++;
}
void
_evas_device_unref(Evas_Device *dev)
{
dev->ref--;
if (dev->ref > 0) return;
if (dev->name) eina_stringshare_del(dev->name);
if (dev->desc) eina_stringshare_del(dev->desc);
dev->magic = 0;
free(dev);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,448 @@
#include "evas_common_private.h"
#include "evas_private.h"
#define EFL_INTERNAL_UNSTABLE
#include "interfaces/efl_common_internal.h"
Eina_Bool
efl_event_pointer_legacy_info_set(Efl_Event_Pointer *evt, const void *event_info, Evas_Callback_Type type)
{
Efl_Event_Pointer_Data *ev = eo_data_scope_get(evt, EFL_EVENT_POINTER_CLASS);
if (!ev || !event_info) return EINA_FALSE;
/* FIXME/TODO:
* Some events definitely don't have all the info they could have. Need
* to get it from ecore!
*/
#if defined(DEBUG)
# define CHKACT(a) do { if (evdata->action != EFL_POINTER_ACTION_ ## a) abort(); } while (0)
#else
# define CHKACT(a) do {} while(0)
#endif
switch (type)
{
case EVAS_CALLBACK_MOUSE_IN:
CHKACT(IN);
{
const Evas_Event_Mouse_In *e = event_info;
ev->action = EFL_POINTER_ACTION_IN;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->source = e->event_src;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MOUSE_OUT:
CHKACT(OUT);
{
const Evas_Event_Mouse_Out *e = event_info;
ev->action = EFL_POINTER_ACTION_OUT;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->source = e->event_src;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MOUSE_DOWN:
CHKACT(DOWN);
{
const Evas_Event_Mouse_Down *e = event_info;
ev->action = EFL_POINTER_ACTION_DOWN;
ev->button = e->button;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->source = e->event_src;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MOUSE_UP:
CHKACT(UP);
{
const Evas_Event_Mouse_Up *e = event_info;
ev->action = EFL_POINTER_ACTION_UP;
ev->button = e->button;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->source = e->event_src;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MOUSE_MOVE:
CHKACT(MOVE);
{
const Evas_Event_Mouse_Move *e = event_info;
ev->action = EFL_POINTER_ACTION_MOVE;
ev->pressed_buttons = e->buttons;
ev->cur.x = e->cur.canvas.x;
ev->cur.y = e->cur.canvas.y;
ev->prev.x = e->prev.canvas.x;
ev->prev.y = e->prev.canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->source = e->event_src;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MOUSE_WHEEL:
CHKACT(WHEEL);
{
const Evas_Event_Mouse_Wheel *e = event_info;
ev->action = EFL_POINTER_ACTION_WHEEL;
ev->wheel.dir = (e->direction ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL);
ev->wheel.z = e->z;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MULTI_DOWN:
CHKACT(DOWN);
{
const Evas_Event_Multi_Down *e = event_info;
ev->action = EFL_POINTER_ACTION_DOWN;
ev->finger = e->device;
ev->radius = e->radius;
ev->radius_x = e->radius_x;
ev->radius_y = e->radius_y;
ev->pressure = e->pressure;
ev->angle = e->angle;
ev->cur.x = e->canvas.xsub;
ev->cur.y = e->canvas.ysub;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MULTI_UP:
CHKACT(UP);
{
const Evas_Event_Multi_Up *e = event_info;
ev->action = EFL_POINTER_ACTION_UP;
ev->finger = e->device;
ev->radius = e->radius;
ev->radius_x = e->radius_x;
ev->radius_y = e->radius_y;
ev->pressure = e->pressure;
ev->angle = e->angle;
ev->cur.x = e->canvas.xsub;
ev->cur.y = e->canvas.ysub;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
case EVAS_CALLBACK_MULTI_MOVE:
CHKACT(MOVE);
{
const Evas_Event_Multi_Move *e = event_info;
ev->action = EFL_POINTER_ACTION_MOVE;
ev->finger = e->device;
ev->radius = e->radius;
ev->radius_x = e->radius_x;
ev->radius_y = e->radius_y;
ev->pressure = e->pressure;
ev->angle = e->angle;
ev->cur.x = e->cur.canvas.xsub;
ev->cur.y = e->cur.canvas.ysub;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->device = e->dev;
ev->modifiers = e->modifiers;
ev->locks = e->locks;
break;
}
default:
ERR("invalid event type %d", type);
return EINA_FALSE;
}
return EINA_TRUE;
}
const void *
efl_event_pointer_legacy_info_get(const Efl_Event_Pointer *evt, Evas_Callback_Type *ptype, Eina_Bool multi)
{
Efl_Event_Pointer_Data *ev = eo_data_scope_get(evt, EFL_EVENT_POINTER_CLASS);
if (!ev) return NULL;
switch (ev->action)
{
case EFL_POINTER_ACTION_IN:
{
Evas_Event_Mouse_In *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MOUSE_IN;
ev->legacy = e;
e->reserved = ev->eo;
e->buttons = ev->pressed_buttons;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->event_src = ev->source;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
}
break;
case EFL_POINTER_ACTION_OUT:
{
Evas_Event_Mouse_Out *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MOUSE_OUT;
ev->legacy = e;
e->reserved = ev->eo;
e->buttons = ev->pressed_buttons;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->event_src = ev->source;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
}
break;
case EFL_POINTER_ACTION_DOWN:
if (!ev->finger || !multi)
{
Evas_Event_Mouse_Down *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MOUSE_DOWN;
ev->legacy = e;
e->reserved = ev->eo;
e->button = ev->button;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->flags = ev->button_flags;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->event_src = ev->source;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
}
else
{
Evas_Event_Multi_Down *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MULTI_DOWN;
ev->legacy = e;
e->reserved = ev->eo;
e->device = ev->finger;
e->radius = ev->radius;
e->radius_x = ev->radius_x;
e->radius_y = ev->radius_y;
e->pressure = ev->pressure;
e->angle = ev->angle;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
e->canvas.xsub = ev->cur.x;
e->canvas.ysub = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->flags = ev->button_flags;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
}
break;
case EFL_POINTER_ACTION_UP:
if (!ev->finger || !multi)
{
Evas_Event_Mouse_Up *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MOUSE_UP;
ev->legacy = e;
e->reserved = ev->eo;
e->button = ev->button;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->flags = ev->button_flags;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->event_src = ev->source;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
}
else
{
Evas_Event_Multi_Down *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MULTI_UP;
ev->legacy = e;
e->reserved = ev->eo;
e->device = ev->finger;
e->radius = ev->radius;
e->radius_x = ev->radius_x;
e->radius_y = ev->radius_y;
e->pressure = ev->pressure;
e->angle = ev->angle;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
e->canvas.xsub = ev->cur.x;
e->canvas.ysub = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->flags = ev->button_flags;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
break;
}
break;
case EFL_POINTER_ACTION_MOVE:
if (!ev->finger || !multi)
{
Evas_Event_Mouse_Move *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MOUSE_MOVE;
ev->legacy = e;
e->reserved = ev->eo;
e->buttons = ev->pressed_buttons;
e->cur.canvas.x = ev->cur.x;
e->cur.canvas.y = ev->cur.y;
e->cur.output.x = ev->cur.x;
e->cur.output.y = ev->cur.y;
e->prev.canvas.x = ev->prev.x;
e->prev.canvas.y = ev->prev.y;
e->prev.output.x = ev->prev.x;
e->prev.output.y = ev->prev.y;
e->data = ev->data;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->event_src = ev->source;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
}
else
{
Evas_Event_Multi_Move *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MULTI_MOVE;
ev->legacy = e;
e->reserved = ev->eo;
e->device = ev->finger;
e->radius = ev->radius;
e->radius_x = ev->radius_x;
e->radius_y = ev->radius_y;
e->pressure = ev->pressure;
e->angle = ev->angle;
e->cur.canvas.x = ev->cur.x;
e->cur.canvas.y = ev->cur.y;
e->cur.canvas.xsub = ev->cur.x;
e->cur.canvas.ysub = ev->cur.y;
e->cur.output.x = ev->cur.x;
e->cur.output.y = ev->cur.y;
e->data = ev->data;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
}
break;
case EFL_POINTER_ACTION_WHEEL:
{
Evas_Event_Mouse_Wheel *e = calloc(1, sizeof(*e));
if (ptype) *ptype = EVAS_CALLBACK_MOUSE_WHEEL;
ev->legacy = e;
e->reserved = ev->eo;
e->direction = (ev->wheel.dir == EFL_ORIENT_VERTICAL);
e->z = ev->wheel.z;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->timestamp = ev->timestamp;
e->event_flags = ev->event_flags;
e->dev = ev->device;
e->modifiers = ev->modifiers;
e->locks = ev->locks;
break;
}
default:
ERR("invalid event type %d", ev->action);
return NULL;
}
return ev->legacy;
}

View File

@ -199,6 +199,8 @@ _evas_canvas_eo_base_constructor(Eo *eo_obj, Evas_Public_Data *e)
eina_lock_new(&(e->lock_objects));
eina_spinlock_new(&(e->render.lock));
_evas_canvas_event_init(eo_obj, e);
return eo_obj;
}
@ -230,6 +232,7 @@ _evas_canvas_eo_base_destructor(Eo *eo_e, Evas_Public_Data *e)
evas_render_idle_flush(eo_e);
_evas_post_event_callback_free(eo_e);
_evas_canvas_event_shutdown(eo_e, e);
del = EINA_TRUE;
e->walking_list++;

View File

@ -1,6 +1,7 @@
import evas_types;
abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator)
abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack,
Efl.Animator, Efl.Input.Interface)
{
legacy_prefix: evas_object;
eo_prefix: evas_obj;
@ -1247,6 +1248,7 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, Ef
Efl.Gfx.Stack.lower;
}
events {
/* FIXME: remove events from Efl.Input.Interface */
mouse,in; [[Mouse In Event ]]
mouse,out; [[Mouse Out Event ]]
mouse,down; [[Mouse Button Down Event ]]

View File

@ -128,24 +128,6 @@ struct Evas.Map; [[An opaque handle to map points
\@ref evas_map_dup.
]]
enum Evas.Button_Flags {
[[Flags for Mouse Button events]]
legacy: Evas_Button;
none = 0, [[No extra mouse button data]]
double_click = (1 << 0), [[This mouse button press was the 2nd press of a double click]]
triple_click = (1 << 1) [[This mouse button press was the 3rd press of a triple click]]
}
enum Evas.Event_Flags {
[[Flags for Events]]
legacy: Evas_Event_Flag;
none = 0, [[No fancy flags set]]
on_hold = (1 << 0), [[This event is being delivered but should be put "on hold" until the on hold flag is unset. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything]]
on_scroll = (1 << 1) [[This event flag indicates the event occurs while scrolling; for example, DOWN event occurs during scrolling; the event should be used for informational purposes and maybe some indications visually, but not actually perform anything]]
}
enum Evas.Touch_Point_State {
[[State of Evas_Coord_Touch_Point]]
legacy: Evas_Touch_Point;

View File

@ -1208,20 +1208,6 @@ struct _Evas_Font_Description
Eina_Bool is_new : 1;
};
struct _Evas_Device
{
DATA32 magic;
Evas *evas;
Evas_Device *parent;
Evas_Device *src;
Eina_List *children;
const char *name;
const char *desc;
int ref;
Evas_Device_Class clas;
Evas_Device_Subclass subclas;
};
struct _Evas_Object_Filter_Data
{
Eina_Stringshare *name;
@ -1895,6 +1881,9 @@ struct _Evas_Proxy_Render_Data
Eina_Bool source_clip : 1;
};
void _evas_canvas_event_init(Evas *eo_e, Evas_Public_Data *e);
void _evas_canvas_event_shutdown(Evas *eo_e, Evas_Public_Data *e);
int evas_async_events_init(void);
int evas_async_events_shutdown(void);
int evas_async_target_del(const void *target);
@ -1946,8 +1935,10 @@ void _evas_touch_point_remove(Evas *e, int id);
void _evas_device_cleanup(Evas *e);
Evas_Device *_evas_device_top_get(const Evas *e);
void _evas_device_ref(Evas_Device *dev);
void _evas_device_unref(Evas_Device *dev);
/* legacy/eo events */
Eina_Bool efl_event_pointer_legacy_info_set(Efl_Event_Pointer *evt, const void *event_info, Evas_Callback_Type type);
const void *efl_event_pointer_legacy_info_get(const Efl_Event_Pointer *evt, Evas_Callback_Type *ptype, Eina_Bool multi);
Eina_Bool evas_vg_loader_svg(Evas_Object *vg, const Eina_File *f, const char *key EINA_UNUSED);

View File

@ -762,6 +762,7 @@ ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int
(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(ee->prop.window, _ecore_evas_input_direct_cb);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
ecore_evases = eina_list_append(ecore_evases, ee);

View File

@ -770,6 +770,7 @@ ecore_evas_drm_new_internal(const char *device, unsigned int parent EINA_UNUSED,
(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(ee->prop.window, _ecore_evas_input_direct_cb);
ecore_drm2_output_crtc_size_get(edata->output, &mw, &mh);

View File

@ -744,6 +744,7 @@ ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h)
(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(1, _ecore_evas_input_direct_cb);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
return ee;
}

View File

@ -544,6 +544,7 @@ ecore_evas_psl1ght_new_internal(const char *name, int w, int h)
(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(0, _ecore_evas_input_direct_cb);
ee->engine.func->fn_render = _ecore_evas_psl1ght_render;
_ecore_evas_register(ee);

View File

@ -715,6 +715,7 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
(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(SDL_GetWindowID(swd->w), _ecore_evas_input_direct_cb);
SDL_SetWindowData(swd->w, "_Ecore_Evas", ee);
SDL_ShowCursor(SDL_ENABLE);

View File

@ -449,6 +449,7 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
(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(ee->prop.window, _ecore_evas_input_direct_cb);
wdata->sync_handler = ecore_event_handler_add(ECORE_WL2_EVENT_SYNC_DONE, _ee_cb_sync_done, ee);
ee_list = eina_list_append(ee_list, ee);

View File

@ -5,6 +5,8 @@
# include "config.h"
#endif
#define ECORE_EVAS_INTERNAL
#ifndef ELEMENTARY_H
//#define LOGFNS 1
#ifdef LOGFNS

View File

@ -358,6 +358,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
(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(ee->prop.window, _ecore_evas_input_direct_cb);
wdata->sync_handler = ecore_event_handler_add(ECORE_WL2_EVENT_SYNC_DONE, _ee_cb_sync_done, ee);
ee_list = eina_list_append(ee_list, ee);

View File

@ -1377,6 +1377,7 @@ _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_backend_init)(Ecore_Evas
(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(ee->prop.window, _ecore_evas_input_direct_cb);
return ee;
}

View File

@ -1261,6 +1261,38 @@ _ecore_evas_x_event_client_message(void *data EINA_UNUSED, int type EINA_UNUSED,
return ECORE_CALLBACK_PASS_ON;
}
static inline void
_feed_cancel_out(const Ecore_X_Event_Mouse_Out *e, Eina_Bool cancel)
{
/* equivalent to:
* if (cancel) evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
* evas_event_feed_mouse_out(ee->evas, e->time, NULL);
* but this goes through ecore_event_evas and direct eo event callback
*/
if (cancel)
{
Ecore_Event_Mouse_Button ev = {
.event_window = (Ecore_Window) e->event_win,
.modifiers = e->modifiers,
.timestamp = e->time,
.window = (Ecore_Window) e->win,
.x = e->x,
.y = e->y,
};
ecore_event_evas_mouse_button_cancel(NULL, ECORE_EVENT_MOUSE_BUTTON_CANCEL, &ev);
}
Ecore_Event_Mouse_IO io = {
.event_window = (Ecore_Window) e->event_win,
.modifiers = e->modifiers,
.timestamp = e->time,
.window = (Ecore_Window) e->win,
.x = e->x,
.y = e->y
};
ecore_event_evas_mouse_out(NULL, ECORE_EVENT_MOUSE_OUT, &io);
}
static Eina_Bool
_fake_out(void *data)
{
@ -1272,9 +1304,8 @@ _fake_out(void *data)
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
if (e->mode == ECORE_X_EVENT_MODE_GRAB)
evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
_feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB));
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
ee->in = EINA_FALSE;
@ -1348,10 +1379,17 @@ _ecore_evas_x_event_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void
/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
if (!ee->in)
{
Ecore_Event_Mouse_IO io = {
.event_window = (Ecore_Window) e->event_win,
.modifiers = e->modifiers,
.timestamp = e->time,
.window = (Ecore_Window) e->win,
.x = e->x,
.y = e->y
};
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
ecore_event_evas_mouse_in(NULL, ECORE_EVENT_MOUSE_IN, &io);
ee->in = EINA_TRUE;
}
return ECORE_CALLBACK_PASS_ON;
@ -1434,9 +1472,7 @@ _ecore_evas_x_event_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, void
return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
if (e->mode == ECORE_X_EVENT_MODE_GRAB)
evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
_feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB));
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
ee->in = EINA_FALSE;
@ -1732,8 +1768,15 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, vo
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
if (ee->in)
{
evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
Ecore_X_Event_Mouse_Out out = {
.event_win = e->event_win,
.modifiers = 0,
.time = e->time,
.win = e->win,
.x = 0,
.y = 0,
};
_feed_cancel_out(&out, EINA_TRUE);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
ee->in = EINA_FALSE;
@ -2629,6 +2672,8 @@ _alpha_do(Ecore_Evas *ee, int alpha)
(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(ee->prop.window, _ecore_evas_input_direct_cb);
if (ee->prop.borderless)
ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
if (ee->visible || ee->should_be_visible)
@ -2783,6 +2828,8 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
(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(ee->prop.window, _ecore_evas_input_direct_cb);
if (ee->prop.borderless)
ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
if (ee->visible || ee->should_be_visible)
@ -4111,6 +4158,8 @@ ecore_evas_software_x11_new_internal(const char *disp_name, Ecore_X_Window paren
(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(ee->prop.window, _ecore_evas_input_direct_cb);
return ee;
}
@ -4428,6 +4477,7 @@ _ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window w
(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(win, _ecore_evas_input_direct_cb);
}
}
#endif
@ -4562,6 +4612,7 @@ ecore_evas_gl_x11_options_new_internal(const char *disp_name, Ecore_X_Window par
(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(ee->prop.window, _ecore_evas_input_direct_cb);
return ee;
}