summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-05-31 19:08:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-05-31 19:08:37 +0900
commitb8d1db365b86c8c0a7d98fa021e377419e563b60 (patch)
tree35b2db4c8658fbbe15657f75b577950b837a04df
parent5e90b860636d9ca353e00ff34630117559b7f748 (diff)
parentb0a32b0bd0acc987965e6bb68721e0c459ec0217 (diff)
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'
-rw-r--r--src/Makefile_Efl.am10
-rw-r--r--src/Makefile_Evas.am3
-rw-r--r--src/lib/ecore/ecore_private.h3
-rw-r--r--src/lib/ecore_evas/ecore_evas.c275
-rw-r--r--src/lib/ecore_evas/ecore_evas_private.h1
-rw-r--r--src/lib/ecore_input_evas/Ecore_Input_Evas.h5
-rw-r--r--src/lib/ecore_input_evas/ecore_input_evas.c181
-rw-r--r--src/lib/efl/Efl.h9
-rw-r--r--src/lib/efl/interfaces/efl_common_internal.h70
-rw-r--r--src/lib/efl/interfaces/efl_event.eo37
-rw-r--r--src/lib/efl/interfaces/efl_event_types.eot35
-rw-r--r--src/lib/efl/interfaces/efl_input_device.c106
-rw-r--r--src/lib/efl/interfaces/efl_input_device.eo90
-rw-r--r--src/lib/efl/interfaces/efl_input_interface.eo17
-rw-r--r--src/lib/efl/interfaces/efl_input_state.eo27
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c5
-rw-r--r--src/lib/elementary/elm_widget.eo3
-rw-r--r--src/lib/elementary/elm_win.c37
-rw-r--r--src/lib/elementary/elm_win.eo7
-rw-r--r--src/lib/evas/Evas_Common.h75
-rw-r--r--src/lib/evas/Evas_Eo.h2
-rw-r--r--src/lib/evas/Evas_Legacy.h211
-rw-r--r--src/lib/evas/canvas/efl_event_pointer.c401
-rw-r--r--src/lib/evas/canvas/efl_event_pointer.eo173
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c92
-rw-r--r--src/lib/evas/canvas/evas_canvas.eo336
-rw-r--r--src/lib/evas/canvas/evas_device.c259
-rw-r--r--src/lib/evas/canvas/evas_events.c789
-rw-r--r--src/lib/evas/canvas/evas_events_legacy.c448
-rw-r--r--src/lib/evas/canvas/evas_main.c3
-rw-r--r--src/lib/evas/canvas/evas_object.eo4
-rw-r--r--src/lib/evas/canvas/evas_types.eot18
-rw-r--r--src/lib/evas/include/evas_private.h23
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c1
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c1
-rw-r--r--src/modules/ecore_evas/engines/fb/ecore_evas_fb.c1
-rw-r--r--src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c1
-rw-r--r--src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c1
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c1
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h2
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c1
-rw-r--r--src/modules/ecore_evas/engines/win32/ecore_evas_win32.c1
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c73
43 files changed, 2981 insertions, 857 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index cddd82ad60..09efe7649d 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -4,6 +4,7 @@ efl_eolian_legacy_files = \
4 lib/efl/interfaces/efl_gfx.eo \ 4 lib/efl/interfaces/efl_gfx.eo \
5 lib/efl/interfaces/efl_image.eo \ 5 lib/efl/interfaces/efl_image.eo \
6 lib/efl/interfaces/efl_image_animated.eo \ 6 lib/efl/interfaces/efl_image_animated.eo \
7 lib/efl/interfaces/efl_input_device.eo \
7 $(NULL) 8 $(NULL)
8 9
9efl_eolian_files = \ 10efl_eolian_files = \
@@ -38,11 +39,15 @@ efl_eolian_files = \
38 lib/efl/interfaces/efl_vpath_file_core.eo \ 39 lib/efl/interfaces/efl_vpath_file_core.eo \
39 lib/efl/interfaces/efl_ui_spin.eo \ 40 lib/efl/interfaces/efl_ui_spin.eo \
40 lib/efl/interfaces/efl_ui_progress.eo \ 41 lib/efl/interfaces/efl_ui_progress.eo \
42 lib/efl/interfaces/efl_event.eo \
43 lib/efl/interfaces/efl_input_interface.eo \
44 lib/efl/interfaces/efl_input_state.eo \
41 $(efl_eolian_legacy_files) \ 45 $(efl_eolian_legacy_files) \
42 $(NULL) 46 $(NULL)
43 47
44efl_eolian_type_files = \ 48efl_eolian_type_files = \
45 lib/efl/interfaces/efl_gfx_types.eot \ 49 lib/efl/interfaces/efl_gfx_types.eot \
50 lib/efl/interfaces/efl_event_types.eot \
46 lib/efl/interfaces/efl_types.eot \ 51 lib/efl/interfaces/efl_types.eot \
47 $(NULL) 52 $(NULL)
48 53
@@ -62,6 +67,7 @@ EXTRA_DIST += \
62 lib/efl/Efl.h \ 67 lib/efl/Efl.h \
63 lib/efl/Makefile.am \ 68 lib/efl/Makefile.am \
64 lib/efl/Makefile.in \ 69 lib/efl/Makefile.in \
70 lib/efl/interfaces/efl_common_internal.h \
65 $(efl_eolian_files) \ 71 $(efl_eolian_files) \
66 $(efl_eolian_type_files) 72 $(efl_eolian_type_files)
67 73
@@ -77,7 +83,9 @@ lib/efl/interfaces/efl_gfx_shape.c \
77lib/efl/interfaces/efl_vpath_file.c \ 83lib/efl/interfaces/efl_vpath_file.c \
78lib/efl/interfaces/efl_vpath_manager.c \ 84lib/efl/interfaces/efl_vpath_manager.c \
79lib/efl/interfaces/efl_vpath_core.c \ 85lib/efl/interfaces/efl_vpath_core.c \
80lib/efl/interfaces/efl_vpath_file_core.c 86lib/efl/interfaces/efl_vpath_file_core.c \
87lib/efl/interfaces/efl_input_device.c \
88$(NULL)
81 89
82lib_efl_libefl_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_srcdir)/src/lib/efl @EFL_CFLAGS@ -DEFL_GFX_FILTER_BETA 90lib_efl_libefl_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_srcdir)/src/lib/efl @EFL_CFLAGS@ -DEFL_GFX_FILTER_BETA
83lib_efl_libefl_la_LIBADD = @EFL_LIBS@ 91lib_efl_libefl_la_LIBADD = @EFL_LIBS@
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 19fea04991..a408b492fa 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -43,6 +43,7 @@ evas_eolian_pub_files = \
43 lib/evas/canvas/efl_canvas_surface_wayland.eo \ 43 lib/evas/canvas/efl_canvas_surface_wayland.eo \
44 lib/evas/canvas/evas_filter.eo \ 44 lib/evas/canvas/evas_filter.eo \
45 lib/evas/canvas/evas_smart_clipped.eo \ 45 lib/evas/canvas/evas_smart_clipped.eo \
46 lib/evas/canvas/efl_event_pointer.eo \
46 $(NULL) 47 $(NULL)
47 48
48evas_eolian_legacy_files = \ 49evas_eolian_legacy_files = \
@@ -152,6 +153,7 @@ lib/evas/canvas/evas_common_interface.c \
152lib/evas/canvas/evas_data.c \ 153lib/evas/canvas/evas_data.c \
153lib/evas/canvas/evas_device.c \ 154lib/evas/canvas/evas_device.c \
154lib/evas/canvas/evas_events.c \ 155lib/evas/canvas/evas_events.c \
156lib/evas/canvas/evas_events_legacy.c \
155lib/evas/canvas/evas_focus.c \ 157lib/evas/canvas/evas_focus.c \
156lib/evas/canvas/evas_key.c \ 158lib/evas/canvas/evas_key.c \
157lib/evas/canvas/evas_key_grab.c \ 159lib/evas/canvas/evas_key_grab.c \
@@ -196,6 +198,7 @@ lib/evas/canvas/efl_canvas_surface.c \
196lib/evas/canvas/efl_canvas_surface_tbm.c \ 198lib/evas/canvas/efl_canvas_surface_tbm.c \
197lib/evas/canvas/efl_canvas_surface_x11.c \ 199lib/evas/canvas/efl_canvas_surface_x11.c \
198lib/evas/canvas/efl_canvas_surface_wayland.c \ 200lib/evas/canvas/efl_canvas_surface_wayland.c \
201lib/evas/canvas/efl_event_pointer.c \
199$(NULL) 202$(NULL)
200 203
201EXTRA_DIST += \ 204EXTRA_DIST += \
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index 062c8a2ef9..d1572f0389 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -366,6 +366,9 @@ extern Eo *_ecore_parent;
366#define ECORE_PARENT_CLASS ecore_parent_class_get() 366#define ECORE_PARENT_CLASS ecore_parent_class_get()
367EAPI const Eo_Class *ecore_parent_class_get(void) EINA_CONST; 367EAPI const Eo_Class *ecore_parent_class_get(void) EINA_CONST;
368 368
369// access to direct input cb
370#define ECORE_EVAS_INTERNAL
371
369#undef EAPI 372#undef EAPI
370#define EAPI 373#define EAPI
371 374
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index dffb915504..db13c1e91d 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -2,6 +2,8 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#define ECORE_EVAS_INTERNAL
6
5#include <stdlib.h> 7#include <stdlib.h>
6#include <string.h> 8#include <string.h>
7#include <sys/types.h> 9#include <sys/types.h>
@@ -34,6 +36,9 @@
34#include "ecore_evas_extn.h" 36#include "ecore_evas_extn.h"
35#include "ecore_evas_win32.h" 37#include "ecore_evas_win32.h"
36 38
39#define EFL_INTERNAL_UNSTABLE
40#include "interfaces/efl_common_internal.h"
41
37#ifndef O_BINARY 42#ifndef O_BINARY
38# define O_BINARY 0 43# define O_BINARY 0
39#endif 44#endif
@@ -3598,6 +3603,7 @@ ecore_evas_input_event_register(Ecore_Evas *ee)
3598 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, 3603 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3599 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, 3604 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3600 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); 3605 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3606 _ecore_event_window_direct_cb_set((Ecore_Window)ee, _ecore_evas_input_direct_cb);
3601} 3607}
3602 3608
3603EAPI void 3609EAPI void
@@ -4276,3 +4282,272 @@ ecore_evas_psl1ght_new(const char* name, int w, int h)
4276 4282
4277 return new(name, w, h); 4283 return new(name, w, h);
4278} 4284}
4285
4286
4287/* new input model with eo:
4288 * 1. pass all events from ecore_input_evas through
4289 * ecore_evas and send eo events from here
4290 * 2. those eo events can then be translated to legacy by evas
4291 * 3. let evas send legacy & eo events to the objects
4292 */
4293
4294#define EVENT_XY_SET(EV, MX, MY, FX, FY) do { \
4295 EV->cur.x = (MX) - (FX); EV->cur.y = (MY) - (FY); \
4296 } while (0)
4297
4298static inline void
4299_pointer_position_set(Efl_Event_Pointer_Data *ev, Ecore_Evas *ee, double mx, double my)
4300{
4301 int fx, fy, fw, fh;
4302
4303 evas_output_framespace_get(ee->evas, &fx, &fy, &fw, &fh);
4304 if (ee->rotation == 0)
4305 EVENT_XY_SET(ev, mx, my, fx, fy);
4306 else if (ee->rotation == 90)
4307 EVENT_XY_SET(ev, ee->h + fw - my - 1, mx, fx, fy);
4308 else if (ee->rotation == 180)
4309 EVENT_XY_SET(ev, ee->w + fw - mx - 1, ee->h + fh - my - 1, fx, fy);
4310 else if (ee->rotation == 270)
4311 EVENT_XY_SET(ev, my, ee->w + fh - mx - 1, fx, fy);
4312}
4313
4314static const Eo_Event_Description *
4315_event_description_get(Efl_Pointer_Action action)
4316{
4317 switch (action)
4318 {
4319 case EFL_POINTER_ACTION_MOVE:
4320 return EFL_EVENT_POINTER_MOVE;
4321 case EFL_POINTER_ACTION_DOWN:
4322 return EFL_EVENT_POINTER_DOWN;
4323 case EFL_POINTER_ACTION_UP:
4324 return EFL_EVENT_POINTER_UP;
4325 case EFL_POINTER_ACTION_CANCEL:
4326 return EFL_EVENT_POINTER_CANCEL;
4327 case EFL_POINTER_ACTION_IN:
4328 return EFL_EVENT_POINTER_IN;
4329 case EFL_POINTER_ACTION_OUT:
4330 return EFL_EVENT_POINTER_OUT;
4331 case EFL_POINTER_ACTION_WHEEL:
4332 return EFL_EVENT_POINTER_WHEEL;
4333 default: return NULL;
4334 }
4335}
4336
4337static Eina_Bool
4338_direct_mouse_updown(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info, Efl_Pointer_Action action)
4339{
4340 Efl_Event_Pointer_Data *ev;
4341 Efl_Event_Pointer *evt;
4342 Evas *e = ee->evas;
4343 Eina_Bool processed;
4344
4345 /* Unused information:
4346 * same_screen
4347 * root.{x,y}
4348 * root_window
4349 * event_window
4350 * same_screen
4351 * modifiers (already passed to evas, no need to do anything)
4352 */
4353
4354 evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
4355 if (!evt) return EINA_FALSE;
4356
4357 ev->action = action;
4358 ev->button = info->buttons;
4359 if (info->double_click) ev->button_flags |= EFL_POINTER_FLAGS_DOUBLE_CLICK;
4360 if (info->triple_click) ev->button_flags |= EFL_POINTER_FLAGS_TRIPLE_CLICK;
4361 ev->timestamp = info->timestamp;
4362 ev->finger = info->multi.device;
4363 _pointer_position_set(ev, ee, info->multi.x, info->multi.y);
4364 ev->radius = info->multi.radius;
4365 ev->radius_x = info->multi.radius_x;
4366 ev->radius_y = info->multi.radius_y;
4367 ev->pressure = info->multi.pressure;
4368 ev->angle = info->multi.angle - ee->rotation;
4369
4370 eo_event_callback_call(e, _event_description_get(ev->action), evt);
4371 processed = ev->evas_done;
4372 eo_unref(evt);
4373
4374 return processed;
4375}
4376
4377static Eina_Bool
4378_direct_mouse_down_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info)
4379{
4380 return _direct_mouse_updown(ee, info, EFL_POINTER_ACTION_DOWN);
4381}
4382
4383static Eina_Bool
4384_direct_mouse_up_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info)
4385{
4386 return _direct_mouse_updown(ee, info, EFL_POINTER_ACTION_UP);
4387}
4388
4389static Eina_Bool
4390_direct_mouse_cancel_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info)
4391{
4392 return _direct_mouse_updown(ee, info, EFL_POINTER_ACTION_CANCEL);
4393}
4394
4395static Eina_Bool
4396_direct_mouse_move_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Move *info)
4397{
4398 Efl_Event_Pointer_Data *ev;
4399 Efl_Event_Pointer *evt;
4400 Evas *e = ee->evas;
4401 Eina_Bool processed;
4402
4403 /* Unused information:
4404 * same_screen
4405 * root.{x,y}
4406 * root_window
4407 * event_window
4408 * same_screen
4409 * modifiers (already passed to evas, no need to do anything)
4410 */
4411
4412 evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
4413 if (!evt) return EINA_FALSE;
4414
4415 ev->action = EFL_POINTER_ACTION_MOVE;
4416 ev->timestamp = info->timestamp;
4417 ev->finger = info->multi.device;
4418 _pointer_position_set(ev, ee, info->multi.x, info->multi.y);
4419
4420 ev->radius = info->multi.radius;
4421 ev->radius_x = info->multi.radius_x;
4422 ev->radius_y = info->multi.radius_y;
4423 ev->pressure = info->multi.pressure;
4424 ev->angle = info->multi.angle - ee->rotation;
4425
4426 eo_event_callback_call(e, _event_description_get(ev->action), evt);
4427 processed = ev->evas_done;
4428 eo_unref(evt);
4429
4430 return processed;
4431}
4432
4433static Eina_Bool
4434_direct_mouse_wheel_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Wheel *info)
4435{
4436 Efl_Event_Pointer_Data *ev;
4437 Efl_Event_Pointer *evt;
4438 Evas *e = ee->evas;
4439 Eina_Bool processed;
4440
4441 /* Unused information:
4442 * same_screen
4443 * root.{x,y}
4444 * root_window
4445 * event_window
4446 * modifiers (already passed to evas, no need to do anything)
4447 */
4448
4449 evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
4450 if (!evt) return EINA_FALSE;
4451
4452 ev->action = EFL_POINTER_ACTION_WHEEL;
4453 ev->timestamp = info->timestamp;
4454 _pointer_position_set(ev, ee, info->x, info->y);
4455 ev->wheel.z = info->z;
4456 ev->wheel.dir = info->direction ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL;
4457
4458 eo_event_callback_call(e, _event_description_get(ev->action), evt);
4459 processed = ev->evas_done;
4460 eo_unref(evt);
4461
4462 return processed;
4463}
4464
4465static Eina_Bool
4466_direct_mouse_inout(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info, Efl_Pointer_Action action)
4467{
4468 Efl_Event_Pointer_Data *ev;
4469 Efl_Event_Pointer *evt;
4470 Evas *e = ee->evas;
4471 Eina_Bool processed;
4472
4473 /* Unused information:
4474 * event_window
4475 * modifiers (already passed to evas, no need to do anything)
4476 */
4477
4478 evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev);
4479 if (!evt) return EINA_FALSE;
4480
4481 ev->action = action;
4482 ev->timestamp = info->timestamp;
4483 _pointer_position_set(ev, ee, info->x, info->y);
4484
4485 eo_event_callback_call(e, _event_description_get(ev->action), evt);
4486 processed = ev->evas_done;
4487 eo_unref(evt);
4488
4489 return processed;
4490}
4491
4492static Eina_Bool
4493_direct_mouse_in_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info)
4494{
4495 return _direct_mouse_inout(ee, info, EFL_POINTER_ACTION_IN);
4496}
4497
4498static Eina_Bool
4499_direct_mouse_out_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info)
4500{
4501 return _direct_mouse_inout(ee, info, EFL_POINTER_ACTION_OUT);
4502}
4503
4504static Eina_Bool
4505_direct_key_down_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Key *info EINA_UNUSED)
4506{
4507 return EINA_FALSE;
4508}
4509
4510static Eina_Bool
4511_direct_key_up_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Key *info EINA_UNUSED)
4512{
4513 return EINA_FALSE;
4514}
4515
4516static Eina_Bool
4517_direct_axis_update_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Axis_Update *info EINA_UNUSED)
4518{
4519 /* TODO: Add joystick event type. */
4520 return EINA_FALSE;
4521}
4522
4523EAPI Eina_Bool
4524_ecore_evas_input_direct_cb(void *window, int type, const void *info)
4525{
4526 Ecore_Evas *ee = window;
4527
4528 if (type == ECORE_EVENT_MOUSE_MOVE)
4529 return _direct_mouse_move_cb(ee, (const Ecore_Event_Mouse_Move *) info);
4530 else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
4531 return _direct_mouse_down_cb(ee, (const Ecore_Event_Mouse_Button *) info);
4532 else if (type == ECORE_EVENT_MOUSE_BUTTON_UP)
4533 return _direct_mouse_up_cb(ee, (const Ecore_Event_Mouse_Button *) info);
4534 else if (type == ECORE_EVENT_MOUSE_WHEEL)
4535 return _direct_mouse_wheel_cb(ee, (const Ecore_Event_Mouse_Wheel *) info);
4536 else if (type == ECORE_EVENT_MOUSE_IN)
4537 return _direct_mouse_in_cb(ee, (const Ecore_Event_Mouse_IO *) info);
4538 else if (type == ECORE_EVENT_MOUSE_OUT)
4539 return _direct_mouse_out_cb(ee, (const Ecore_Event_Mouse_IO *) info);
4540 else if (type == ECORE_EVENT_KEY_DOWN)
4541 return _direct_key_down_cb(ee, (const Ecore_Event_Key *) info);
4542 else if (type == ECORE_EVENT_MOUSE_BUTTON_CANCEL)
4543 return _direct_mouse_cancel_cb(ee, (const Ecore_Event_Mouse_Button *) info);
4544 else if (type == ECORE_EVENT_KEY_UP)
4545 return _direct_key_up_cb(ee, (const Ecore_Event_Key *) info);
4546 else if (type == ECORE_EVENT_AXIS_UPDATE)
4547 return _direct_axis_update_cb(ee, (const Ecore_Event_Axis_Update *) info);
4548 else
4549 {
4550 ERR("unhandled input event type %d", type);
4551 return EINA_FALSE;
4552 }
4553}
diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h
index a179733121..fea4792aa0 100644
--- a/src/lib/ecore_evas/ecore_evas_private.h
+++ b/src/lib/ecore_evas/ecore_evas_private.h
@@ -390,6 +390,7 @@ EAPI void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
390 double mx, double my, 390 double mx, double my,
391 Evas_Button_Flags flags, 391 Evas_Button_Flags flags,
392 unsigned int timestamp); 392 unsigned int timestamp);
393EAPI Eina_Bool _ecore_evas_input_direct_cb(void *window, int type, const void *info);
393 394
394EAPI extern Eina_Bool _ecore_evas_app_comp_sync; 395EAPI extern Eina_Bool _ecore_evas_app_comp_sync;
395 396
diff --git a/src/lib/ecore_input_evas/Ecore_Input_Evas.h b/src/lib/ecore_input_evas/Ecore_Input_Evas.h
index db4029f58c..c9b0c053fd 100644
--- a/src/lib/ecore_input_evas/Ecore_Input_Evas.h
+++ b/src/lib/ecore_input_evas/Ecore_Input_Evas.h
@@ -59,6 +59,11 @@ EAPI void ecore_event_window_ignore_events(Ecore_Window id, int ignore_even
59 59
60EAPI void ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers); 60EAPI void ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers);
61 61
62#ifdef ECORE_EVAS_INTERNAL
63typedef Eina_Bool (*Ecore_Event_Direct_Input_Cb)(void *window, int type, const void *info);
64EAPI void _ecore_event_window_direct_cb_set(Ecore_Window id, Ecore_Event_Direct_Input_Cb fptr);
65#endif
66
62#ifdef __cplusplus 67#ifdef __cplusplus
63} 68}
64#endif 69#endif
diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c
index bea13cb2ea..b0d86b6a12 100644
--- a/src/lib/ecore_input_evas/ecore_input_evas.c
+++ b/src/lib/ecore_input_evas/ecore_input_evas.c
@@ -2,6 +2,8 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#define ECORE_EVAS_INTERNAL
6
5#include <string.h> 7#include <string.h>
6#include <stdlib.h> 8#include <stdlib.h>
7 9
@@ -22,6 +24,7 @@ struct _Ecore_Input_Window
22 Ecore_Event_Multi_Move_Cb move_multi; 24 Ecore_Event_Multi_Move_Cb move_multi;
23 Ecore_Event_Multi_Down_Cb down_multi; 25 Ecore_Event_Multi_Down_Cb down_multi;
24 Ecore_Event_Multi_Up_Cb up_multi; 26 Ecore_Event_Multi_Up_Cb up_multi;
27 Ecore_Event_Direct_Input_Cb direct;
25 int ignore_event; 28 int ignore_event;
26}; 29};
27 30
@@ -359,6 +362,16 @@ ecore_event_window_unregister(Ecore_Window id)
359 eina_hash_del(_window_hash, &id, NULL); 362 eina_hash_del(_window_hash, &id, NULL);
360} 363}
361 364
365EAPI void
366_ecore_event_window_direct_cb_set(Ecore_Window id, Ecore_Event_Direct_Input_Cb fptr)
367{
368 Ecore_Input_Window *lookup;
369
370 lookup = eina_hash_find(_window_hash, &id);
371 if (!lookup) return;
372 lookup->direct = fptr;
373}
374
362EAPI void * 375EAPI void *
363ecore_event_window_match(Ecore_Window id) 376ecore_event_window_match(Ecore_Window id)
364{ 377{
@@ -399,23 +412,36 @@ _ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
399 if (!lookup) return ECORE_CALLBACK_PASS_ON; 412 if (!lookup) return ECORE_CALLBACK_PASS_ON;
400 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); 413 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
401 if (press == ECORE_DOWN) 414 if (press == ECORE_DOWN)
402 evas_event_feed_key_down_with_keycode(lookup->evas, 415 {
403 e->keyname, 416 if (!lookup->direct ||
404 e->key, 417 !lookup->direct(lookup->window, ECORE_EVENT_KEY_DOWN, e))
405 e->string, 418 {
406 e->compose, 419 evas_event_feed_key_down_with_keycode(lookup->evas,
407 e->timestamp, 420 e->keyname,
408 e->data, 421 e->key,
409 e->keycode); 422 e->string,
423 e->compose,
424 e->timestamp,
425 e->data,
426 e->keycode);
427 }
428 }
410 else 429 else
411 evas_event_feed_key_up_with_keycode(lookup->evas, 430 {
412 e->keyname, 431 if (!lookup->direct ||
413 e->key, 432 !lookup->direct(lookup->window, ECORE_EVENT_KEY_DOWN, e))
414 e->string, 433 {
415 e->compose, 434 evas_event_feed_key_up_with_keycode(lookup->evas,
416 e->timestamp, 435 e->keyname,
417 e->data, 436 e->key,
418 e->keycode); 437 e->string,
438 e->compose,
439 e->timestamp,
440 e->data,
441 e->keycode);
442 }
443 }
444
419 return ECORE_CALLBACK_PASS_ON; 445 return ECORE_CALLBACK_PASS_ON;
420} 446}
421 447
@@ -430,7 +456,11 @@ _ecore_event_evas_mouse_button_cancel(Ecore_Event_Mouse_Button *e)
430 if (!lookup) return ECORE_CALLBACK_PASS_ON; 456 if (!lookup) return ECORE_CALLBACK_PASS_ON;
431 457
432 INF("ButtonEvent cancel, device(%d), button(%d)", e->multi.device, e->buttons); 458 INF("ButtonEvent cancel, device(%d), button(%d)", e->multi.device, e->buttons);
433 evas_event_feed_mouse_cancel(lookup->evas, e->timestamp, NULL); 459 if (!lookup->direct ||
460 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_CANCEL, e))
461 {
462 evas_event_feed_mouse_cancel(lookup->evas, e->timestamp, NULL);
463 }
434 464
435 //the number of last event is small, simple check is ok. 465 //the number of last event is small, simple check is ok.
436 EINA_LIST_FOREACH(_last_events, l, eel) 466 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
494 { 524 {
495 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); 525 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
496 if (press == ECORE_DOWN) 526 if (press == ECORE_DOWN)
497 evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, 527 {
498 e->timestamp, NULL); 528 if (!lookup->direct ||
529 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_DOWN, e))
530 {
531 evas_event_feed_mouse_down(lookup->evas, e->buttons, flags,
532 e->timestamp, NULL);
533 }
534 }
499 else 535 else
500 evas_event_feed_mouse_up(lookup->evas, e->buttons, flags, 536 {
501 e->timestamp, NULL); 537 if (!lookup->direct ||
538 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_UP, e))
539 {
540 evas_event_feed_mouse_up(lookup->evas, e->buttons, flags,
541 e->timestamp, NULL);
542 }
543 }
502 } 544 }
503 else 545 else
504 { 546 {
505 if (press == ECORE_DOWN) 547 if (press == ECORE_DOWN)
506 { 548 {
507 if (lookup->down_multi) 549 if (!lookup->direct ||
508 lookup->down_multi(lookup->window, e->multi.device, 550 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_DOWN, e))
509 e->x, e->y, e->multi.radius, 551 {
510 e->multi.radius_x, e->multi.radius_y, 552 if (lookup->down_multi)
511 e->multi.pressure, e->multi.angle, 553 lookup->down_multi(lookup->window, e->multi.device,
512 e->multi.x, e->multi.y, flags, 554 e->x, e->y, e->multi.radius,
513 e->timestamp); 555 e->multi.radius_x, e->multi.radius_y,
514 else 556 e->multi.pressure, e->multi.angle,
515 evas_event_input_multi_down(lookup->evas, e->multi.device, 557 e->multi.x, e->multi.y, flags,
516 e->x, e->y, e->multi.radius, 558 e->timestamp);
517 e->multi.radius_x, e->multi.radius_y, 559 else
518 e->multi.pressure, e->multi.angle, 560 evas_event_input_multi_down(lookup->evas, e->multi.device,
519 e->multi.x, e->multi.y, flags, 561 e->x, e->y, e->multi.radius,
520 e->timestamp, NULL); 562 e->multi.radius_x, e->multi.radius_y,
563 e->multi.pressure, e->multi.angle,
564 e->multi.x, e->multi.y, flags,
565 e->timestamp, NULL);
566 }
521 } 567 }
522 else 568 else
523 { 569 {
524 if (lookup->up_multi) 570 if (!lookup->direct ||
525 lookup->up_multi(lookup->window, e->multi.device, 571 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_UP, e))
526 e->x, e->y, e->multi.radius, 572 {
527 e->multi.radius_x, e->multi.radius_y, 573 if (lookup->up_multi)
528 e->multi.pressure, e->multi.angle, 574 lookup->up_multi(lookup->window, e->multi.device,
529 e->multi.x, e->multi.y, flags, 575 e->x, e->y, e->multi.radius,
530 e->timestamp); 576 e->multi.radius_x, e->multi.radius_y,
531 else 577 e->multi.pressure, e->multi.angle,
532 evas_event_input_multi_up(lookup->evas, e->multi.device, 578 e->multi.x, e->multi.y, flags,
533 e->x, e->y, e->multi.radius, 579 e->timestamp);
534 e->multi.radius_x, e->multi.radius_y, 580 else
535 e->multi.pressure, e->multi.angle, 581 evas_event_input_multi_up(lookup->evas, e->multi.device,
536 e->multi.x, e->multi.y, flags, 582 e->x, e->y, e->multi.radius,
537 e->timestamp, NULL); 583 e->multi.radius_x, e->multi.radius_y,
584 e->multi.pressure, e->multi.angle,
585 e->multi.x, e->multi.y, flags,
586 e->timestamp, NULL);
587 }
538 } 588 }
539 } 589 }
540 return ECORE_CALLBACK_PASS_ON; 590 return ECORE_CALLBACK_PASS_ON;
@@ -549,6 +599,9 @@ ecore_event_evas_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *
549 e = event; 599 e = event;
550 lookup = _ecore_event_window_match(e->event_window); 600 lookup = _ecore_event_window_match(e->event_window);
551 if (!lookup) return ECORE_CALLBACK_PASS_ON; 601 if (!lookup) return ECORE_CALLBACK_PASS_ON;
602 if (lookup->direct &&
603 lookup->direct(lookup->window, ECORE_EVENT_MOUSE_MOVE, e))
604 return ECORE_CALLBACK_PASS_ON;
552 if (e->multi.device == 0) 605 if (e->multi.device == 0)
553 { 606 {
554 _ecore_event_evas_push_mouse_move(e); 607 _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)
609 switch (io) 662 switch (io)
610 { 663 {
611 case ECORE_IN: 664 case ECORE_IN:
612 evas_event_feed_mouse_in(lookup->evas, e->timestamp, NULL); 665 if (!lookup->direct ||
666 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_IN, e))
667 {
668 evas_event_feed_mouse_in(lookup->evas, e->timestamp, NULL);
669 }
613 break; 670 break;
614 case ECORE_OUT: 671 case ECORE_OUT:
615 evas_event_feed_mouse_out(lookup->evas, e->timestamp, NULL); 672 if (!lookup->direct ||
673 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_OUT, e))
674 {
675 evas_event_feed_mouse_out(lookup->evas, e->timestamp, NULL);
676 }
616 break; 677 break;
617 default: 678 default:
618 break; 679 break;
@@ -644,7 +705,12 @@ ecore_event_evas_mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void
644 lookup = _ecore_event_window_match(e->event_window); 705 lookup = _ecore_event_window_match(e->event_window);
645 if (!lookup) return ECORE_CALLBACK_PASS_ON; 706 if (!lookup) return ECORE_CALLBACK_PASS_ON;
646 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); 707 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
647 evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL); 708 if (!lookup->direct ||
709 !lookup->direct(lookup->window, ECORE_EVENT_MOUSE_WHEEL, e))
710 {
711 evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL);
712 }
713
648 return ECORE_CALLBACK_PASS_ON; 714 return ECORE_CALLBACK_PASS_ON;
649} 715}
650 716
@@ -669,9 +735,14 @@ ecore_event_evas_axis_update(void *data EINA_UNUSED, int type EINA_UNUSED, void
669 e = event; 735 e = event;
670 lookup = _ecore_event_window_match(e->event_window); 736 lookup = _ecore_event_window_match(e->event_window);
671 if (!lookup) return ECORE_CALLBACK_PASS_ON; 737 if (!lookup) return ECORE_CALLBACK_PASS_ON;
672 evas_event_feed_axis_update(lookup->evas, e->timestamp, e->device, 738 if (!lookup->direct ||
673 e->toolid, e->naxis, 739 !lookup->direct(lookup->window, ECORE_EVENT_AXIS_UPDATE, e))
674 (Evas_Axis *)e->axis, NULL); 740 {
741 evas_event_feed_axis_update(lookup->evas, e->timestamp, e->device,
742 e->toolid, e->naxis,
743 (Evas_Axis *)e->axis, NULL);
744 }
745
675 return ECORE_CALLBACK_PASS_ON; 746 return ECORE_CALLBACK_PASS_ON;
676} 747}
677 748
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 6962c8f620..7d8d55b8e5 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -125,14 +125,23 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color,
125#include "interfaces/efl_pack_linear.eo.h" 125#include "interfaces/efl_pack_linear.eo.h"
126#include "interfaces/efl_pack_grid.eo.h" 126#include "interfaces/efl_pack_grid.eo.h"
127 127
128/* Input events */
129#include "interfaces/efl_event_types.eot.h"
130#include "interfaces/efl_input_device.eo.h"
131#include "interfaces/efl_input_state.eo.h"
132#include "interfaces/efl_input_interface.eo.h"
133#include "interfaces/efl_event.eo.h"
134
128#else 135#else
129 136
130#ifndef EFL_NOLEGACY_API_SUPPORT 137#ifndef EFL_NOLEGACY_API_SUPPORT
131#include "interfaces/efl_gfx_types.eot.h" 138#include "interfaces/efl_gfx_types.eot.h"
139#include "interfaces/efl_event_types.eot.h"
132#include "interfaces/efl_gfx_fill.eo.legacy.h" 140#include "interfaces/efl_gfx_fill.eo.legacy.h"
133#include "interfaces/efl_gfx.eo.legacy.h" 141#include "interfaces/efl_gfx.eo.legacy.h"
134#include "interfaces/efl_image.eo.legacy.h" 142#include "interfaces/efl_image.eo.legacy.h"
135#include "interfaces/efl_image_animated.eo.legacy.h" 143#include "interfaces/efl_image_animated.eo.legacy.h"
144#include "interfaces/efl_input_device.eo.legacy.h"
136#endif 145#endif
137 146
138typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; 147typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
diff --git a/src/lib/efl/interfaces/efl_common_internal.h b/src/lib/efl/interfaces/efl_common_internal.h
new file mode 100644
index 0000000000..c34efd1f7c
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_common_internal.h
@@ -0,0 +1,70 @@
1/* This header file is intended for EFL internal use, and is not part of
2 * EFL stable API.
3 * Place here structs and enums that need to be shared between core EFL
4 * components, such as Ecore, Evas, etc...
5 */
6
7#ifndef EFL_COMMON_INTERNAL_H
8#define EFL_COMMON_INTERNAL_H
9
10#ifndef EFL_INTERNAL_UNSTABLE
11# error This file can not be included outside EFL
12#endif
13
14#include <Efl.h>
15
16typedef struct _Efl_Event_Pointer_Data Efl_Event_Pointer_Data;
17typedef struct _Efl_Input_Device_Data Efl_Input_Device_Data;
18typedef struct _Efl_Input_State_Data Efl_Input_State_Data;
19
20#ifndef _EVAS_TYPES_EOT_H_
21typedef struct _Evas_Modifier Evas_Modifier;
22typedef struct _Evas_Lock Evas_Lock;
23#endif
24
25struct _Efl_Event_Pointer_Data
26{
27 Eo *eo;
28 unsigned int timestamp; /* FIXME: store as double? */
29 int button;
30 unsigned int pressed_buttons;
31 int finger;
32 double radius, radius_x, radius_y;
33 double pressure;
34 double angle;
35 struct {
36 double x, y;
37 } cur, prev;
38 struct {
39 Efl_Orient dir;
40 int z;
41 } wheel;
42 Efl_Gfx *source; /* could it be ecore? */
43 Efl_Input_Device *device;
44 Efl_Pointer_Action action;
45 Efl_Pointer_Flags button_flags;
46 Efl_Event_Flags event_flags;
47 void *data; /* evas data - whatever that is */
48 const Eo_Event_Description *event_desc;
49 Eina_Bool window_pos; /* true if positions are window-relative
50 (see input vs. feed: this is "input") */
51 Evas_Modifier *modifiers;
52 Evas_Lock *locks;
53 void *legacy; /* DO NOT TOUCH (may contain the legacy event_info) */
54 Eina_Bool evas_done; /* set by evas */
55};
56
57struct _Efl_Input_Device_Data
58{
59 Eo *eo;
60 Eo *evas; /* Evas */
61 Efl_Input_Device *parent; /* no ref */
62 Efl_Input_Device *source; /* ref */
63 Eina_List *children; /* ref */
64 Eina_Stringshare *name;
65 Eina_Stringshare *desc;
66 Efl_Input_Device_Class klass;
67 Efl_Input_Device_Sub_Class subclass;
68};
69
70#endif
diff --git a/src/lib/efl/interfaces/efl_event.eo b/src/lib/efl/interfaces/efl_event.eo
new file mode 100644
index 0000000000..1e50274a0a
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_event.eo
@@ -0,0 +1,37 @@
1import eo_base;
2
3interface Efl.Event
4{
5 [[Represents a generic event data.
6
7 Note: Most Eo Events do not carry Eo objects, rather simple data
8 structures. This class is intended to carry more complex event
9 data, such as pointer events.
10
11 @since 1.18
12 ]]
13 legacy_prefix: null;
14 methods {
15 @property timestamp {
16 [[The time at which an event was generated.
17
18 If the event is generated by a server (eg. X.org or Wayland), then
19 the time may be set by the server. Usually this time will be based
20 on the monotonic clock, if available, but this class can not
21 guarantee it.
22 ]]
23 set { [[Call this when generating events manually.]] }
24 get {}
25 values {
26 ms: double; [[Time in milliseconds when the event happened.]]
27 }
28 }
29 reset {
30 [[Resets the internal data to 0 or default values.]]
31 }
32 dup {
33 [[Creates a copy of this event.]]
34 return: own(Efl.Event);
35 }
36 }
37}
diff --git a/src/lib/efl/interfaces/efl_event_types.eot b/src/lib/efl/interfaces/efl_event_types.eot
new file mode 100644
index 0000000000..3d52929ea0
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_event_types.eot
@@ -0,0 +1,35 @@
1/* FIXME: Do we need this? Or just use the Eo Event Description as a type? */
2enum Efl.Pointer.Action
3{
4 [[Pointer event type.
5
6 @since 1.18
7 ]]
8 none, [[Not a valid event.]]
9 move, [[Mouse or equivalent pointer moved.]]
10 down, [[Mouse button or equivalent pointer pressed down.
11 Always followed by up or cancel.]]
12 up, [[Mouse button or equivalent pointer released. See also cancel.]]
13 cancel, [[Special event happening after a down if the up counterpart
14 can not happen (eg. another window forcibly stole the focus).]]
15 in, [[Mouse or pointer entered the object.]]
16 out, [[Mouse or pointer exited the object.]]
17 wheel, [[Mouse wheel scroll, horizontally or vertically.]]
18 axis, [[Joystick event.]]
19}
20
21enum Efl.Pointer.Flags
22{
23 /* Evas.Button_Flags */
24 none = 0, [[No extra mouse button data]]
25 double_click = (1 << 0), [[This mouse button press was the 2nd press of a double click]]
26 triple_click = (1 << 1), [[This mouse button press was the 3rd press of a triple click]]
27}
28
29enum Efl.Event.Flags
30{
31 /* Evas.Event_Flags */
32 none = 0, [[No fancy flags set]]
33 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]]
34 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]]
35}
diff --git a/src/lib/efl/interfaces/efl_input_device.c b/src/lib/efl/interfaces/efl_input_device.c
new file mode 100644
index 0000000000..ee97b1e5c2
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_input_device.c
@@ -0,0 +1,106 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Efl.h>
6
7#define EFL_INTERNAL_UNSTABLE
8#include "efl_common_internal.h"
9
10/* Efl Input Device = Evas Device */
11
12EOLIAN static Eo_Base *
13_efl_input_device_eo_base_constructor(Eo *obj, Efl_Input_Device_Data *pd)
14{
15 obj = eo_constructor(eo_super(obj, EFL_INPUT_DEVICE_CLASS));
16 pd->eo = obj;
17 return obj;
18}
19
20EOLIAN static void
21_efl_input_device_eo_base_destructor(Eo *obj, Efl_Input_Device_Data *pd)
22{
23 Eo *eo_child;
24
25 eina_stringshare_del(pd->name);
26 eina_stringshare_del(pd->desc);
27 EINA_LIST_FREE(pd->children, eo_child)
28 {
29 Efl_Input_Device_Data *child = eo_data_scope_get(eo_child, EFL_INPUT_DEVICE_CLASS);
30 child->parent = NULL;
31 eo_unref(eo_child);
32 }
33 eo_unref(pd->source);
34
35 return eo_destructor(eo_super(obj, EFL_INPUT_DEVICE_CLASS));
36}
37
38EOLIAN static void
39_efl_input_device_device_type_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device_Class klass)
40{
41 pd->klass= klass;
42}
43
44EOLIAN static Efl_Input_Device_Class
45_efl_input_device_device_type_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
46{
47 return pd->klass;
48}
49
50EOLIAN static void
51_efl_input_device_device_subtype_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device_Sub_Class klass)
52{
53 pd->subclass = klass;
54}
55
56EOLIAN static Efl_Input_Device_Sub_Class
57_efl_input_device_device_subtype_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
58{
59 return pd->subclass;
60}
61
62EOLIAN static void
63_efl_input_device_source_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device *src)
64{
65 if (pd->source == src) return;
66 eo_unref(pd->source);
67 pd->source = eo_ref(src);
68}
69
70EOLIAN static Efl_Input_Device *
71_efl_input_device_source_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
72{
73 return pd->source;
74}
75
76EOLIAN static void
77_efl_input_device_name_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *name)
78{
79 eina_stringshare_replace(&pd->name, name);
80}
81
82EOLIAN static const char *
83_efl_input_device_name_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
84{
85 return pd->name;
86}
87
88EOLIAN static void
89_efl_input_device_description_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *desc)
90{
91 eina_stringshare_replace(&pd->desc, desc);
92}
93
94EOLIAN static const char *
95_efl_input_device_description_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
96{
97 return pd->desc;
98}
99
100EOLIAN static Efl_Input_Device *
101_efl_input_device_parent_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
102{
103 return pd->parent;
104}
105
106#include "interfaces/efl_input_device.eo.c"
diff --git a/src/lib/efl/interfaces/efl_input_device.eo b/src/lib/efl/interfaces/efl_input_device.eo
new file mode 100644
index 0000000000..732d2dd45e
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_input_device.eo
@@ -0,0 +1,90 @@
1enum Efl.Input.Device.Class
2{
3 [[General type of input device.
4
5 Legacy support since 1.8.
6
7 @since 1.18
8 ]]
9 none, [[Not a device.]]
10 seat, [[The user/seat (the user themselves).]]
11 keyboard, [[A regular keyboard, numberpad or attached buttons.]]
12 mouse, [[A mouse, trackball or touchpad relative motion device.]]
13 touch, [[A touchscreen with fingers or stylus.]]
14 pen, [[A special pen device.]]
15 pointer, [[A laser pointer, wii-style or "minority report" pointing device.]]
16 gamepad, [[A gamepad controller or joystick.]]
17}
18
19enum Efl.Input.Device.Sub_Class
20{
21 [[Specific type of input device.
22
23 Legacy support since 1.8.
24
25 @since 1.18
26 ]]
27 none, [[Not a device.]]
28 finger, [[The normal flat of your finger.]]
29 fingernail, [[A fingernail.]]
30 knuckle, [[A Knuckle.]]
31 palm, [[The palm of a users hand.]]
32 hand_size, [[The side of your hand.]]
33 hand_flat, [[The flat of your hand.]]
34 pen_tip, [[The tip of a pen.]]
35 trackpad, [[A trackpad style mouse.]]
36 trackpoint, [[A trackpoint style mouse.]]
37 trackball, [[A trackball style mouse.]]
38}
39
40
41/* This represents Evas_Device */
42/* FIXME: no parent, no children and no Evas */
43
44class Efl.Input.Device (Eo.Base)
45{
46 [[Represents a pointing device, such as a touch finger, a pen or a mouse.
47
48 @since 1.18
49 ]]
50 legacy_prefix: null;
51 methods {
52 /* FIXME: device_class makes compilation error because of class_get() */
53 @property device_type {
54 values {
55 klass: Efl.Input.Device.Class;
56 }
57 }
58 @property device_subtype {
59 values {
60 klass: Efl.Input.Device.Sub_Class;
61 }
62 }
63 @property source {
64 values {
65 src: Efl.Input.Device;
66 }
67 }
68 @property name {
69 values {
70 name: const(char)*;
71 }
72 }
73 @property description {
74 values {
75 desc: const(char)*;
76 }
77 }
78 @property parent {
79 /* set {} */
80 get {}
81 values {
82 parent: Efl.Input.Device;
83 }
84 }
85 }
86 implements {
87 Eo.Base.constructor;
88 Eo.Base.destructor;
89 }
90}
diff --git a/src/lib/efl/interfaces/efl_input_interface.eo b/src/lib/efl/interfaces/efl_input_interface.eo
new file mode 100644
index 0000000000..ad1281b6a5
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_input_interface.eo
@@ -0,0 +1,17 @@
1interface Efl.Input.Interface ()
2{
3 [[An object implementing this interface can send pointer events.
4
5 Windows and canvas objects may send input events.
6 ]]
7 event_prefix: efl;
8 events {
9 pointer,move: Efl.Event.Pointer;
10 pointer,down: Efl.Event.Pointer;
11 pointer,up: Efl.Event.Pointer;
12 pointer,cancel: Efl.Event.Pointer;
13 pointer,in: Efl.Event.Pointer;
14 pointer,out: Efl.Event.Pointer;
15 pointer,wheel: Efl.Event.Pointer;
16 }
17}
diff --git a/src/lib/efl/interfaces/efl_input_state.eo b/src/lib/efl/interfaces/efl_input_state.eo
new file mode 100644
index 0000000000..0622adc5e0
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_input_state.eo
@@ -0,0 +1,27 @@
1interface Efl.Input.State ()
2{
3 eo_prefix: efl_input;
4 methods {
5 /* FIXME: legacy name was 'modifier_is_set' */
6 @property modifier_enabled {
7 [[Indicates whether a key modifier is on, such as Ctrl, Shift,...]]
8 get {}
9 keys {
10 name: string;
11 }
12 values {
13 is_set: bool; [[$true if the key modifier is pressed.]]
14 }
15 }
16 @property lock_enabled {
17 [[Indicates whether a key lock is on, such as NumLock, CapsLock, ...]]
18 get {}
19 keys {
20 name: string;
21 }
22 values {
23 is_set: bool; [[$true if the key lock is on.]]
24 }
25 }
26 }
27}
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index 3b5ce16073..f82474e9f7 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -34,6 +34,7 @@ EAPI const Eo_Event_Description _EFL_GFX_CHANGED =
34EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED = 34EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
35 EO_EVENT_DESCRIPTION("Graphics path changed"); 35 EO_EVENT_DESCRIPTION("Graphics path changed");
36 36
37/* Packing & containers */
37#include "interfaces/efl_container.eo.c" 38#include "interfaces/efl_container.eo.c"
38#include "interfaces/efl_pack.eo.c" 39#include "interfaces/efl_pack.eo.c"
39#include "interfaces/efl_pack_layout.eo.c" 40#include "interfaces/efl_pack_layout.eo.c"
@@ -47,6 +48,10 @@ EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
47#include "interfaces/efl_ui_spin.eo.c" 48#include "interfaces/efl_ui_spin.eo.c"
48#include "interfaces/efl_ui_progress.eo.c" 49#include "interfaces/efl_ui_progress.eo.c"
49 50
51#include "interfaces/efl_event.eo.c"
52#include "interfaces/efl_input_state.eo.c"
53#include "interfaces/efl_input_interface.eo.c"
54
50EAPI void 55EAPI void
51__efl_internal_init(void) 56__efl_internal_init(void)
52{ 57{
diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo
index 94edf90b10..9e207b6b76 100644
--- a/src/lib/elementary/elm_widget.eo
+++ b/src/lib/elementary/elm_widget.eo
@@ -1,5 +1,6 @@
1import edje_types; 1import edje_types;
2import elm_general; 2import elm_general;
3import efl_event_types;
3 4
4/* FIXME: This shouldn't be here. */ 5/* FIXME: This shouldn't be here. */
5type list_data_get_func_type: __undefined_type; 6type list_data_get_func_type: __undefined_type;
@@ -630,7 +631,7 @@ abstract Elm.Widget (Evas.Object.Smart, Elm.Interface.Atspi_Accessible, Elm.Inte
630 params { 631 params {
631 @in type: Evas.Callback_Type; 632 @in type: Evas.Callback_Type;
632 @in event_info: void *; 633 @in event_info: void *;
633 @in event_flags: Evas.Event_Flags *; 634 @in event_flags: Efl.Event.Flags *;
634 } 635 }
635 } 636 }
636 signal_callback_add { 637 signal_callback_add {
diff --git a/src/lib/elementary/elm_win.c b/src/lib/elementary/elm_win.c
index f9f0afc2a7..cf229bb165 100644
--- a/src/lib/elementary/elm_win.c
+++ b/src/lib/elementary/elm_win.c
@@ -1625,6 +1625,25 @@ _elm_win_elm_widget_event(Eo *obj, Elm_Win_Data *_pd EINA_UNUSED, Evas_Object *s
1625 return EINA_TRUE; 1625 return EINA_TRUE;
1626} 1626}
1627 1627
1628static Eina_Bool
1629_evas_event_pointer_cb(void *data, const Eo_Event *ev)
1630{
1631 Eo *win = data;
1632 Eo *evt = ev->info;
1633
1634 eo_event_callback_call(win, ev->desc, evt);
1635 return EO_CALLBACK_CONTINUE;
1636}
1637
1638EO_CALLBACKS_ARRAY_DEFINE(_elm_win_evas_forward_callbacks,
1639{ EFL_EVENT_POINTER_MOVE, _evas_event_pointer_cb },
1640{ EFL_EVENT_POINTER_DOWN, _evas_event_pointer_cb },
1641{ EFL_EVENT_POINTER_UP, _evas_event_pointer_cb },
1642{ EFL_EVENT_POINTER_IN, _evas_event_pointer_cb },
1643{ EFL_EVENT_POINTER_OUT, _evas_event_pointer_cb },
1644{ EFL_EVENT_POINTER_CANCEL, _evas_event_pointer_cb },
1645{ EFL_EVENT_POINTER_WHEEL, _evas_event_pointer_cb })
1646
1628static void 1647static void
1629_deferred_ecore_evas_free(void *data) 1648_deferred_ecore_evas_free(void *data)
1630{ 1649{
@@ -1972,6 +1991,8 @@ _elm_win_evas_object_smart_del(Eo *obj, Elm_Win_Data *sd)
1972 EVAS_CALLBACK_CHANGED_SIZE_HINTS, 1991 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1973 _elm_win_on_resize_obj_changed_size_hints, 1992 _elm_win_on_resize_obj_changed_size_hints,
1974 obj); 1993 obj);
1994 eo_event_callback_array_del(sd->evas, _elm_win_evas_forward_callbacks(), obj);
1995
1975 evas_object_del(sd->box); 1996 evas_object_del(sd->box);
1976 evas_object_del(sd->edje); 1997 evas_object_del(sd->edje);
1977 1998
@@ -4028,6 +4049,8 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
4028 if (_elm_config->atspi_mode) 4049 if (_elm_config->atspi_mode)
4029 elm_interface_atspi_window_created_signal_emit(obj); 4050 elm_interface_atspi_window_created_signal_emit(obj);
4030 4051
4052 eo_event_callback_array_add(sd->evas, _elm_win_evas_forward_callbacks(), obj);
4053
4031 evas_object_show(sd->edje); 4054 evas_object_show(sd->edje);
4032 4055
4033 if (type == ELM_WIN_FAKE) 4056 if (type == ELM_WIN_FAKE)
@@ -5548,6 +5571,20 @@ _elm_win_elm_interface_atspi_accessible_name_get(Eo *obj, Elm_Win_Data *sd EINA_
5548 return name ? strdup(name) : NULL; 5571 return name ? strdup(name) : NULL;
5549} 5572}
5550 5573
5574EOLIAN static Eina_Bool
5575_elm_win_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, const char *name)
5576{
5577 const Evas_Modifier *m = evas_key_modifier_get(pd->evas);
5578 return evas_key_modifier_is_set(m, name);
5579}
5580
5581EOLIAN static Eina_Bool
5582_elm_win_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, const char *name)
5583{
5584 const Evas_Lock *m = evas_key_lock_get(pd->evas);
5585 return evas_key_lock_is_set(m, name);
5586}
5587
5551#ifndef EFL_TEAMWORK_VERSION 5588#ifndef EFL_TEAMWORK_VERSION
5552# define EFL_TEAMWORK_VERSION 2 5589# define EFL_TEAMWORK_VERSION 2
5553#endif 5590#endif
diff --git a/src/lib/elementary/elm_win.eo b/src/lib/elementary/elm_win.eo
index 6fe5b41422..1a468260aa 100644
--- a/src/lib/elementary/elm_win.eo
+++ b/src/lib/elementary/elm_win.eo
@@ -149,7 +149,8 @@ enum Elm.Illume_Command
149} 149}
150 150
151class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window, 151class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
152 Elm.Interface.Atspi_Widget_Action, Efl.Pack) 152 Elm.Interface.Atspi_Widget_Action, Efl.Pack,
153 Efl.Input.State, Efl.Input.Interface)
153{ 154{
154 legacy_prefix: elm_win; 155 legacy_prefix: elm_win;
155 eo_prefix: elm_obj_win; 156 eo_prefix: elm_obj_win;
@@ -830,7 +831,7 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
830 name: const(char)* @nullable; 831 name: const(char)* @nullable;
831 } 832 }
832 } 833 }
833 @property type { 834 @property type { /* FIXME: before finalize */
834 [[The type of the window. 835 [[The type of the window.
835 836
836 It is a hint of how the Window Manager should handle it. 837 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,
1042 Efl.Container.content_count; 1043 Efl.Container.content_count;
1043 Efl.Pack.unpack; 1044 Efl.Pack.unpack;
1044 Efl.Pack.pack; 1045 Efl.Pack.pack;
1046 Efl.Input.State.modifier_enabled.get;
1047 Efl.Input.State.lock_enabled.get;
1045 } 1048 }
1046 constructors { 1049 constructors {
1047 .name; 1050 .name;
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index d3141d1157..ac07077cdf 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -232,7 +232,6 @@ struct _Evas_Precision_Position /** A position with precision*/
232}; 232};
233 233
234typedef struct _Evas_Pixel_Import_Source Evas_Pixel_Import_Source; /**< A source description of pixels for importing pixels */ 234typedef struct _Evas_Pixel_Import_Source Evas_Pixel_Import_Source; /**< A source description of pixels for importing pixels */
235typedef struct _Evas_Device Evas_Device; /**< A source device handle - where the event came from */
236typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down; /**< Event structure for #EVAS_CALLBACK_MOUSE_DOWN event callbacks */ 235typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down; /**< Event structure for #EVAS_CALLBACK_MOUSE_DOWN event callbacks */
237typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up; /**< Event structure for #EVAS_CALLBACK_MOUSE_UP event callbacks */ 236typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up; /**< Event structure for #EVAS_CALLBACK_MOUSE_UP event callbacks */
238typedef struct _Evas_Event_Mouse_In Evas_Event_Mouse_In; /**< Event structure for #EVAS_CALLBACK_MOUSE_IN event callbacks */ 237typedef 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
248typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */ 247typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */
249typedef struct _Evas_Event_Axis_Update Evas_Event_Axis_Update; /**< Event structure for #EVAS_CALLBACK_AXIS_UPDATE event callbacks @since 1.13 */ 248typedef struct _Evas_Event_Axis_Update Evas_Event_Axis_Update; /**< Event structure for #EVAS_CALLBACK_AXIS_UPDATE event callbacks @since 1.13 */
250 249
250/* Opaque types */
251typedef Eo Evas_Device; /**< A source device handle - where the event came from */
252
251typedef Efl_Image_Content_Hint Evas_Image_Content_Hint; 253typedef Efl_Image_Content_Hint Evas_Image_Content_Hint;
252#define EVAS_IMAGE_CONTENT_HINT_NONE EFL_IMAGE_CONTENT_HINT_NONE 254#define EVAS_IMAGE_CONTENT_HINT_NONE EFL_IMAGE_CONTENT_HINT_NONE
253#define EVAS_IMAGE_CONTENT_HINT_DYNAMIC EFL_IMAGE_CONTENT_HINT_DYNAMIC 255#define EVAS_IMAGE_CONTENT_HINT_DYNAMIC EFL_IMAGE_CONTENT_HINT_DYNAMIC
@@ -315,32 +317,42 @@ typedef enum _Evas_Engine_Render_Mode
315 EVAS_RENDER_MODE_NONBLOCKING = 1, /**< The rendering is non blocking mode*/ 317 EVAS_RENDER_MODE_NONBLOCKING = 1, /**< The rendering is non blocking mode*/
316} Evas_Engine_Render_Mode; /**< behaviour of the renderer*/ 318} Evas_Engine_Render_Mode; /**< behaviour of the renderer*/
317 319
318typedef enum _Evas_Device_Class 320typedef Efl_Input_Device_Class Evas_Device_Class;
319{ 321
320 EVAS_DEVICE_CLASS_NONE, /**< Not a device @since 1.8 */ 322#define EVAS_DEVICE_CLASS_NONE EFL_INPUT_DEVICE_CLASS_NONE /**< Not a device @since 1.8 */
321 EVAS_DEVICE_CLASS_SEAT, /**< The user/seat (the user themselves) @since 1.8 */ 323#define EVAS_DEVICE_CLASS_SEAT EFL_INPUT_DEVICE_CLASS_SEAT /**< The user/seat (the user themselves) @since 1.8 */
322 EVAS_DEVICE_CLASS_KEYBOARD, /**< A regular keyboard, numberpad or attached buttons @since 1.8 */ 324#define EVAS_DEVICE_CLASS_KEYBOARD EFL_INPUT_DEVICE_CLASS_KEYBOARD /**< A regular keyboard, numberpad or attached buttons @since 1.8 */
323 EVAS_DEVICE_CLASS_MOUSE, /**< A mouse, trackball or touchpad relative motion device @since 1.8 */ 325#define EVAS_DEVICE_CLASS_MOUSE EFL_INPUT_DEVICE_CLASS_MOUSE /**< A mouse, trackball or touchpad relative motion device @since 1.8 */
324 EVAS_DEVICE_CLASS_TOUCH, /**< A touchscreen with fingers or stylus @since 1.8 */ 326#define EVAS_DEVICE_CLASS_TOUCH EFL_INPUT_DEVICE_CLASS_TOUCH /**< A touchscreen with fingers or stylus @since 1.8 */
325 EVAS_DEVICE_CLASS_PEN, /**< A special pen device @since 1.8 */ 327#define EVAS_DEVICE_CLASS_PEN EFL_INPUT_DEVICE_CLASS_PEN /**< A special pen device @since 1.8 */
326 EVAS_DEVICE_CLASS_POINTER, /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */ 328#define EVAS_DEVICE_CLASS_POINTER EFL_INPUT_DEVICE_CLASS_POINTER /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */
327 EVAS_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */ 329#define EVAS_DEVICE_CLASS_GAMEPAD EFL_INPUT_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */
328} Evas_Device_Class; /**< A general class of device @since 1.8 */ 330
329 331typedef Efl_Input_Device_Sub_Class Evas_Device_Subclass;
330typedef enum _Evas_Device_Subclass 332
331{ 333#define EVAS_DEVICE_SUBCLASS_NONE EFL_INPUT_DEVICE_SUBCLASS_NONE /**< Not a device @since 1.8 */
332 EVAS_DEVICE_SUBCLASS_NONE, /**< Not a device @since 1.8 */ 334#define EVAS_DEVICE_SUBCLASS_FINGER EFL_INPUT_DEVICE_SUBCLASS_FINGER /**< The normal flat of your finger @since 1.8 */
333 EVAS_DEVICE_SUBCLASS_FINGER, /**< The normal flat of your finger @since 1.8 */ 335#define EVAS_DEVICE_SUBCLASS_FINGERNAIL EFL_INPUT_DEVICE_SUBCLASS_FINGERNAIL /**< A fingernail @since 1.8 */
334 EVAS_DEVICE_SUBCLASS_FINGERNAIL, /**< A fingernail @since 1.8 */ 336#define EVAS_DEVICE_SUBCLASS_KNUCKLE EFL_INPUT_DEVICE_SUBCLASS_KNUCKLE /**< A Knuckle @since 1.8 */
335 EVAS_DEVICE_SUBCLASS_KNUCKLE, /**< A Knuckle @since 1.8 */ 337#define EVAS_DEVICE_SUBCLASS_PALM EFL_INPUT_DEVICE_SUBCLASS_PALM /**< The palm of a users hand @since 1.8 */
336 EVAS_DEVICE_SUBCLASS_PALM, /**< The palm of a users hand @since 1.8 */ 338#define EVAS_DEVICE_SUBCLASS_HAND_SIZE EFL_INPUT_DEVICE_SUBCLASS_HAND_SIZE /**< The side of your hand @since 1.8 */
337 EVAS_DEVICE_SUBCLASS_HAND_SIZE, /**< The side of your hand @since 1.8 */ 339#define EVAS_DEVICE_SUBCLASS_HAND_FLAT EFL_INPUT_DEVICE_SUBCLASS_HAND_FLAT /**< The flat of your hand @since 1.8 */
338 EVAS_DEVICE_SUBCLASS_HAND_FLAT, /**< The flat of your hand @since 1.8 */ 340#define EVAS_DEVICE_SUBCLASS_PEN_TIP EFL_INPUT_DEVICE_SUBCLASS_PEN_TIP /**< The tip of a pen @since 1.8 */
339 EVAS_DEVICE_SUBCLASS_PEN_TIP, /**< The tip of a pen @since 1.8 */ 341#define EVAS_DEVICE_SUBCLASS_TRACKPAD EFL_INPUT_DEVICE_SUBCLASS_TRACKPAD /**< A trackpad style mouse @since 1.8 */
340 EVAS_DEVICE_SUBCLASS_TRACKPAD, /**< A trackpad style mouse @since 1.8 */ 342#define EVAS_DEVICE_SUBCLASS_TRACKPOINT EFL_INPUT_DEVICE_SUBCLASS_TRACKPOINT /**< A trackpoint style mouse @since 1.8 */
341 EVAS_DEVICE_SUBCLASS_TRACKPOINT, /**< A trackpoint style mouse @since 1.8 */ 343#define EVAS_DEVICE_SUBCLASS_TRACKBALL EFL_INPUT_DEVICE_SUBCLASS_TRACKBALL /**< A trackball style mouse @since 1.8 */
342 EVAS_DEVICE_SUBCLASS_TRACKBALL, /**< A trackball style mouse @since 1.8 */ 344
343} Evas_Device_Subclass; /**< A general subclass of device @since 1.8 */ 345typedef Efl_Pointer_Flags Evas_Button_Flags;
346
347#define EVAS_BUTTON_NONE EFL_POINTER_FLAGS_NONE
348#define EVAS_BUTTON_DOUBLE_CLICK EFL_POINTER_FLAGS_DOUBLE_CLICK
349#define EVAS_BUTTON_TRIPLE_CLICK EFL_POINTER_FLAGS_TRIPLE_CLICK
350
351typedef Efl_Event_Flags Evas_Event_Flags;
352
353#define EVAS_EVENT_FLAG_NONE EFL_EVENT_FLAGS_NONE
354#define EVAS_EVENT_FLAG_ON_HOLD EFL_EVENT_FLAGS_ON_HOLD
355#define EVAS_EVENT_FLAG_ON_SCROLL EFL_EVENT_FLAGS_ON_SCROLL
344 356
345struct _Evas_Engine_Info /** Generic engine information. Generic info is useless */ 357struct _Evas_Engine_Info /** Generic engine information. Generic info is useless */
346{ 358{
@@ -363,6 +375,7 @@ struct _Evas_Event_Mouse_Down /** Mouse button press event */
363 Evas_Event_Flags event_flags; 375 Evas_Event_Flags event_flags;
364 Evas_Device *dev; 376 Evas_Device *dev;
365 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */ 377 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
378 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
366}; 379};
367 380
368struct _Evas_Event_Mouse_Up /** Mouse button release event */ 381struct _Evas_Event_Mouse_Up /** Mouse button release event */
@@ -381,6 +394,7 @@ struct _Evas_Event_Mouse_Up /** Mouse button release event */
381 Evas_Event_Flags event_flags; 394 Evas_Event_Flags event_flags;
382 Evas_Device *dev; 395 Evas_Device *dev;
383 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */ 396 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
397 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
384}; 398};
385 399
386struct _Evas_Event_Mouse_In /** Mouse enter event */ 400struct _Evas_Event_Mouse_In /** Mouse enter event */
@@ -397,6 +411,7 @@ struct _Evas_Event_Mouse_In /** Mouse enter event */
397 Evas_Event_Flags event_flags; 411 Evas_Event_Flags event_flags;
398 Evas_Device *dev; 412 Evas_Device *dev;
399 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */ 413 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
414 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
400}; 415};
401 416
402struct _Evas_Event_Mouse_Out /** Mouse leave event */ 417struct _Evas_Event_Mouse_Out /** Mouse leave event */
@@ -413,6 +428,7 @@ struct _Evas_Event_Mouse_Out /** Mouse leave event */
413 Evas_Event_Flags event_flags; 428 Evas_Event_Flags event_flags;
414 Evas_Device *dev; 429 Evas_Device *dev;
415 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */ 430 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
431 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
416}; 432};
417 433
418struct _Evas_Event_Mouse_Move /** Mouse move event */ 434struct _Evas_Event_Mouse_Move /** Mouse move event */
@@ -429,6 +445,7 @@ struct _Evas_Event_Mouse_Move /** Mouse move event */
429 Evas_Event_Flags event_flags; 445 Evas_Event_Flags event_flags;
430 Evas_Device *dev; 446 Evas_Device *dev;
431 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */ 447 Evas_Object *event_src; /**< The Evas Object which actually triggered the event, used in cases of proxy event propagation */
448 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
432}; 449};
433 450
434struct _Evas_Event_Mouse_Wheel /** Wheel event */ 451struct _Evas_Event_Mouse_Wheel /** Wheel event */
@@ -445,6 +462,7 @@ struct _Evas_Event_Mouse_Wheel /** Wheel event */
445 unsigned int timestamp; 462 unsigned int timestamp;
446 Evas_Event_Flags event_flags; 463 Evas_Event_Flags event_flags;
447 Evas_Device *dev; 464 Evas_Device *dev;
465 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
448}; 466};
449 467
450struct _Evas_Event_Multi_Down /** Multi button press event */ 468struct _Evas_Event_Multi_Down /** Multi button press event */
@@ -464,6 +482,7 @@ struct _Evas_Event_Multi_Down /** Multi button press event */
464 unsigned int timestamp; 482 unsigned int timestamp;
465 Evas_Event_Flags event_flags; 483 Evas_Event_Flags event_flags;
466 Evas_Device *dev; 484 Evas_Device *dev;
485 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
467}; 486};
468 487
469struct _Evas_Event_Multi_Up /** Multi button release event */ 488struct _Evas_Event_Multi_Up /** Multi button release event */
@@ -483,6 +502,7 @@ struct _Evas_Event_Multi_Up /** Multi button release event */
483 unsigned int timestamp; 502 unsigned int timestamp;
484 Evas_Event_Flags event_flags; 503 Evas_Event_Flags event_flags;
485 Evas_Device *dev; 504 Evas_Device *dev;
505 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
486}; 506};
487 507
488struct _Evas_Event_Multi_Move /** Multi button down event */ 508struct _Evas_Event_Multi_Move /** Multi button down event */
@@ -499,6 +519,7 @@ struct _Evas_Event_Multi_Move /** Multi button down event */
499 unsigned int timestamp; 519 unsigned int timestamp;
500 Evas_Event_Flags event_flags; 520 Evas_Event_Flags event_flags;
501 Evas_Device *dev; 521 Evas_Device *dev;
522 void *reserved; /**< Reserved field for internal use only. @since 1.18 */
502}; 523};
503 524
504struct _Evas_Event_Key_Down /** Key press event */ 525struct _Evas_Event_Key_Down /** Key press event */
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 948a07d513..3556936944 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -299,3 +299,5 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x,
299#include "canvas/efl_vg_gradient.eo.h" 299#include "canvas/efl_vg_gradient.eo.h"
300#include "canvas/efl_vg_gradient_linear.eo.h" 300#include "canvas/efl_vg_gradient_linear.eo.h"
301#include "canvas/efl_vg_gradient_radial.eo.h" 301#include "canvas/efl_vg_gradient_radial.eo.h"
302
303#include "canvas/efl_event_pointer.eo.h"
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index d5f93885e0..211452aceb 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -336,6 +336,217 @@ EAPI int evas_event_freeze_get(const Evas *e) EINA_WARN_UNUSED_RESU
336 * out on new objects if the state change demands it. 336 * out on new objects if the state change demands it.
337 */ 337 */
338EAPI void evas_event_thaw_eval(Evas *e) EINA_ARG_NONNULL(1); 338EAPI void evas_event_thaw_eval(Evas *e) EINA_ARG_NONNULL(1);
339
340/**
341 * @brief Mouse move event feed.
342 *
343 * This function will set some evas properties that is necessary when the mouse
344 * is moved from its last position. It prepares information to be treated by
345 * the callback function.
346 *
347 * @param[in] y The vertical position of the mouse pointer.
348 * @param[in] timestamp The timestamp of the mouse up event.
349 * @param[in] data The data for canvas.
350 */
351EAPI void evas_event_feed_mouse_move(Evas *obj, int x, int y, unsigned int timestamp, const void *data);
352
353/**
354 * @brief Mouse move event feed from input.
355 *
356 * Similar to the @ref evas_event_feed_mouse_move, this function will inform
357 * Evas about mouse move events which were received by the input system,
358 * relative to the 0,0 of the window, not to the canvas 0,0. It will take care
359 * of doing any special transformation like adding the framespace offset to the
360 * mouse event.
361 *
362 * @param[in] y The vertical position of the mouse pointer relative to the 0,0
363 * of the window/surface.
364 * @param[in] timestamp The timestamp of the mouse move event.
365 * @param[in] data The data for canvas.
366 *
367 * @since 1.8
368 */
369EAPI void evas_event_input_mouse_move(Evas *obj, int x, int y, unsigned int timestamp, const void *data);
370
371/**
372 * @brief Mouse up event feed.
373 *
374 * This function will set some evas properties that is necessary when the mouse
375 * button is released. It prepares information to be treated by the callback
376 * function.
377 *
378 * @param[in] flags Evas button flags.
379 * @param[in] timestamp The timestamp of the mouse up event.
380 * @param[in] data The data for canvas.
381 */
382EAPI void evas_event_feed_mouse_up(Evas *obj, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
383
384/**
385 * @brief Mouse down event feed.
386 *
387 * This function will set some evas properties that is necessary when the mouse
388 * button is pressed. It prepares information to be treated by the callback
389 * function.
390 *
391 * @param[in] flags Evas button flags.
392 * @param[in] timestamp The timestamp of the mouse up event.
393 * @param[in] data The data for canvas.
394 */
395EAPI void evas_event_feed_mouse_down(Evas *obj, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
396
397/**
398 * @brief Mouse wheel event feed.
399 *
400 * This function will set some evas properties that is necessary when the mouse
401 * wheel is scrolled up or down. It prepares information to be treated by the
402 * callback function.
403 *
404 * @param[in] z How much mouse wheel was scrolled up or down.
405 * @param[in] timestamp The timestamp of the mouse up event.
406 * @param[in] data The data for canvas.
407 */
408EAPI void evas_event_feed_mouse_wheel(Evas *obj, int direction, int z, unsigned int timestamp, const void *data);
409
410/**
411 * @brief Mouse in event feed.
412 *
413 * This function will set some evas properties that is necessary when the mouse
414 * in event happens. It prepares information to be treated by the callback
415 * function.
416 *
417 * @param[in] data The data for canvas.
418 */
419EAPI void evas_event_feed_mouse_in(Evas *obj, unsigned int timestamp, const void *data);
420
421/**
422 * @brief Mouse out event feed.
423 *
424 * This function will set some evas properties that is necessar when the mouse
425 * out event happens. It prepares information to be treated by the callback
426 * function.
427 *
428 * @param[in] data The data for canvas.
429 */
430EAPI void evas_event_feed_mouse_out(Evas *obj, unsigned int timestamp, const void *data);
431
432/**
433 * @brief Mouse cancel event feed.
434 *
435 * This function will call generate a mouse up event.
436 *
437 * @param[in] data The data for canvas.
438 */
439EAPI void evas_event_feed_mouse_cancel(Evas *obj, unsigned int timestamp, const void *data);
440
441/* multi touch events - no doc */
442EAPI 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);
443EAPI 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);
444EAPI 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);
445EAPI 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);
446EAPI 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);
447EAPI 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);
448
449/**
450 * @brief Key down event feed.
451 *
452 * This function will set some evas properties that is necessary when a key is
453 * pressed. It prepares information to be treated by the callback function.
454 *
455 * @param[in] key The key pressed.
456 * @param[in] string A string.
457 * @param[in] compose The compose string.
458 * @param[in] timestamp Timestamp of the mouse up event.
459 * @param[in] data Data for canvas.
460 */
461EAPI 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);
462
463/**
464 * @brief Key up event feed.
465 *
466 * This function will set some evas properties that is necessary when a key is
467 * released. It prepares information to be treated by the callback function.
468 *
469 * @param[in] key The key released.
470 * @param[in] string A string.
471 * @param[in] compose Compose.
472 * @param[in] timestamp Timestamp of the mouse up event.
473 * @param[in] data Data for canvas.
474 */
475EAPI 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);
476
477/**
478 * @brief Key down event feed with keycode.
479 *
480 * This function will set some evas properties that is necessary when a key is
481 * pressed. It prepares information to be treated by the callback function.
482 *
483 * @param[in] key The key released.
484 * @param[in] string A string.
485 * @param[in] compose Compose.
486 * @param[in] timestamp Timestamp of the mouse up event.
487 * @param[in] data Data for canvas.
488 * @param[in] keycode Key scan code numeric value for canvas.
489 *
490 * @since 1.10
491 */
492EAPI 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);
493
494/**
495 * @brief Key up event feed with keycode.
496 *
497 * This function will set some evas properties that is necessary when a key is
498 * released. It prepares information to be treated by the callback function.
499 *
500 * @param[in] key The key released.
501 * @param[in] string A string.
502 * @param[in] compose Compose.
503 * @param[in] timestamp Timestamp of the mouse up event.
504 * @param[in] data Data for canvas.
505 * @param[in] keycode Key scan code numeric value for canvas.
506 *
507 * @since 1.10
508 */
509EAPI 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);
510
511/**
512 * @brief Input device axis update event feed.
513 *
514 * This function will set some evas properties that is necessary when an e.g.
515 * stylus axis is updated. It prepares information to be treated by the
516 * callback function.
517 *
518 * @param[in] device System-provided device identifier.
519 * @param[in] toolid Type of tool currently being used.
520 * @param[in] naxes Number of elements in the \p axis array.
521 * @param[in] axis Array containing the current value of all updated axes.
522 * @param[in] data Data for canvas.
523 *
524 * @since 1.13
525 */
526EAPI void evas_event_feed_axis_update(Evas *obj, unsigned int timestamp, int device, int toolid, int naxes, const Evas_Axis *axis, const void *data);
527
528/**
529 * @brief Hold event feed.
530 *
531 * This function makes the object to stop sending events.
532 *
533 * @param[in] timestamp The timestamp of the mouse up event.
534 * @param[in] data The data for canvas.
535 */
536EAPI void evas_event_feed_hold(Evas *obj, int hold, unsigned int timestamp, const void *data);
537
538/**
539 * @brief Re feed event.
540 *
541 * This function re-feeds the event pointed by event_copy.
542 *
543 * This function call evas_event_feed_* functions, so it can cause havoc if not
544 * used wisely. Please use it responsibly.
545 *
546 * @param[in] event_type Event type.
547 */
548EAPI void evas_event_refeed_event(Evas *obj, void *event_copy, Evas_Callback_Type event_type);
549
339/** 550/**
340 * @} 551 * @}
341 */ 552 */
diff --git a/src/lib/evas/canvas/efl_event_pointer.c b/src/lib/evas/canvas/efl_event_pointer.c
new file mode 100644
index 0000000000..213fa77632
--- /dev/null
+++ b/src/lib/evas/canvas/efl_event_pointer.c
@@ -0,0 +1,401 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Evas.h>
6
7#define EFL_INTERNAL_UNSTABLE
8#include "interfaces/efl_common_internal.h"
9
10#define MY_CLASS EFL_EVENT_POINTER_CLASS
11
12
13/* Pointer Event
14 *
15 * This is a storage class only, should not require ANY knowledge about
16 * Ecore, Evas or anything else.
17 *
18 * This is intended to replace Ecore and Evas structs for mouse events.
19 *
20 * Do not add any logic here.
21 */
22
23static Efl_Event_Pointer *s_cached_event = NULL;
24
25static void
26_del_hook(Eo *evt)
27{
28 if (!s_cached_event)
29 {
30 if (eo_parent_get(evt))
31 {
32 eo_ref(evt);
33 eo_parent_set(evt, NULL);
34 }
35 s_cached_event = evt;
36 }
37 else
38 {
39 eo_del_intercept_set(evt, NULL);
40 eo_unref(evt);
41 }
42}
43
44EOLIAN static Efl_Event_Pointer *
45_efl_event_pointer_instance_get(Eo_Class *klass EINA_UNUSED, void *pd EINA_UNUSED,
46 Eo *owner, void **priv)
47{
48 Efl_Event_Pointer *evt;
49
50 if (s_cached_event)
51 {
52 evt = s_cached_event;
53 s_cached_event = NULL;
54 efl_event_reset(evt);
55 eo_parent_set(evt, owner);
56 }
57 else
58 {
59 evt = eo_add(EFL_EVENT_POINTER_CLASS, owner);
60 eo_del_intercept_set(evt, _del_hook);
61 }
62
63 if (priv)
64 *priv = eo_data_scope_get(evt, EFL_EVENT_POINTER_CLASS);
65
66 return evt;
67}
68
69EOLIAN static void
70_efl_event_pointer_class_destructor(Eo_Class *klass EINA_UNUSED)
71{
72 // this is a strange situation...
73 eo_unref(s_cached_event);
74 s_cached_event = NULL;
75}
76
77EOLIAN static Eo_Base *
78_efl_event_pointer_eo_base_constructor(Eo *obj, Efl_Event_Pointer_Data *pd EINA_UNUSED)
79{
80 eo_constructor(eo_super(obj, MY_CLASS));
81 efl_event_reset(obj);
82 return obj;
83}
84
85EOLIAN static void
86_efl_event_pointer_efl_event_reset(Eo *obj, Efl_Event_Pointer_Data *pd)
87{
88 free(pd->legacy);
89 memset(pd, 0, sizeof(*pd));
90 pd->eo = obj;
91 pd->wheel.dir = EFL_ORIENT_VERTICAL;
92}
93
94EOLIAN static Efl_Event *
95_efl_event_pointer_efl_event_dup(Eo *obj, Efl_Event_Pointer_Data *pd)
96{
97 Efl_Event_Pointer_Data *ev;
98 Efl_Event_Pointer *evt;
99
100 evt = _efl_event_pointer_instance_get((Eo_Class *) EFL_EVENT_POINTER_CLASS,
101 NULL, obj, (void **) &ev);
102 if (!evt) return NULL;
103
104 memcpy(ev, pd, sizeof(*ev));
105 ev->eo = evt;
106
107 return evt;
108}
109
110EOLIAN static void
111_efl_event_pointer_action_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Pointer_Action act)
112{
113 pd->action = act;
114}
115
116EOLIAN static Efl_Pointer_Action
117_efl_event_pointer_action_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
118{
119 return pd->action;
120}
121
122EOLIAN static void
123_efl_event_pointer_button_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int but)
124{
125 pd->button = but;
126}
127
128EOLIAN static int
129_efl_event_pointer_button_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
130{
131 return pd->button;
132}
133
134EOLIAN static void
135_efl_event_pointer_button_pressed_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int button, Eina_Bool pressed)
136{
137 if (button < 0) return;
138 if (button > 31) return;
139 if (pressed)
140 pd->button_flags |= (1 << button);
141 else
142 pd->button_flags &= ~(1 << button);
143}
144
145EOLIAN static Eina_Bool
146_efl_event_pointer_button_pressed_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int button)
147{
148 if (button < 0) return EINA_FALSE;
149 if (button > 31) return EINA_FALSE;
150 return (pd->button_flags & (1 << button)) != 0;
151}
152
153EOLIAN static void
154_efl_event_pointer_position_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int x, int y)
155{
156 pd->cur.x = (double) x;
157 pd->cur.y = (double) y;
158}
159
160EOLIAN static void
161_efl_event_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int *x, int *y)
162{
163 if (x) *x = (int) pd->cur.x;
164 if (y) *y = (int) pd->cur.y;
165}
166
167EOLIAN static void
168_efl_event_pointer_position_precise_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double x, double y)
169{
170 pd->cur.x = x;
171 pd->cur.y = y;
172}
173
174EOLIAN static void
175_efl_event_pointer_position_precise_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *x, double *y)
176{
177 if (x) *x = pd->cur.x;
178 if (y) *y = pd->cur.y;
179}
180
181EOLIAN static void
182_efl_event_pointer_previous_position_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int x, int y)
183{
184 pd->prev.x = (double) x;
185 pd->prev.y = (double) y;
186}
187
188EOLIAN static void
189_efl_event_pointer_previous_position_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int *x, int *y)
190{
191 if (x) *x = (int) pd->prev.x;
192 if (y) *y = (int) pd->prev.y;
193}
194
195EOLIAN static void
196_efl_event_pointer_previous_position_precise_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double x, double y)
197{
198 pd->prev.x = x;
199 pd->prev.y = y;
200}
201
202EOLIAN static void
203_efl_event_pointer_previous_position_precise_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *x, double *y)
204{
205 if (x) *x = pd->prev.x;
206 if (y) *y = pd->prev.y;
207}
208
209EOLIAN static void
210_efl_event_pointer_device_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Input_Device *dev)
211{
212 /* ref? */
213 pd->device = dev;
214}
215
216EOLIAN static Efl_Input_Device *
217_efl_event_pointer_device_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
218{
219 return pd->device;
220}
221
222EOLIAN static void
223_efl_event_pointer_source_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Gfx *src)
224{
225 /* ref? */
226 pd->source = src;
227}
228
229EOLIAN static Efl_Gfx *
230_efl_event_pointer_source_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
231{
232 return pd->source;
233}
234
235EOLIAN static void
236_efl_event_pointer_button_flags_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Pointer_Flags flags)
237{
238 pd->button_flags = flags;
239}
240
241EOLIAN static Efl_Pointer_Flags
242_efl_event_pointer_button_flags_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
243{
244 return pd->button_flags;
245}
246
247EOLIAN static void
248_efl_event_pointer_event_flags_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Event_Flags flags)
249{
250 pd->event_flags = flags;
251}
252
253EOLIAN static Efl_Event_Flags
254_efl_event_pointer_event_flags_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
255{
256 return pd->event_flags;
257}
258
259EOLIAN static void
260_efl_event_pointer_efl_event_timestamp_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double ms)
261{
262 pd->timestamp = (unsigned int) ms;
263}
264
265EOLIAN static double
266_efl_event_pointer_efl_event_timestamp_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
267{
268 return (double) pd->timestamp;
269}
270
271EOLIAN static void
272_efl_event_pointer_wheel_direction_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Orient dir)
273{
274 pd->wheel.dir = dir;
275}
276
277EOLIAN static Efl_Orient
278_efl_event_pointer_wheel_direction_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
279{
280 return pd->wheel.dir;
281}
282
283EOLIAN static void
284_efl_event_pointer_wheel_distance_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int dist)
285{
286 pd->wheel.z = dist;
287}
288
289EOLIAN static int
290_efl_event_pointer_wheel_distance_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
291{
292 return pd->wheel.z;
293}
294
295EOLIAN static int
296_efl_event_pointer_finger_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
297{
298 return pd->finger;
299}
300
301EOLIAN static void
302_efl_event_pointer_finger_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int id)
303{
304 pd->finger = id;
305}
306
307EOLIAN static void
308_efl_event_pointer_touch_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *r, double *rx, double *ry, double *press, double *angle)
309{
310 if (r) *r = pd->radius;
311 if (rx) *rx = pd->radius_x;
312 if (ry) *ry = pd->radius_y;
313 if (press) *press = pd->pressure;
314 if (angle) *angle = pd->angle;
315}
316
317EOLIAN static void
318_efl_event_pointer_touch_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double r, double rx, double ry, double press, double angle)
319{
320 pd->radius = r;
321 pd->radius_x = rx;
322 pd->radius_y = ry;
323 pd->pressure = press;
324 pd->angle = angle;
325}
326
327EOLIAN static Eina_Bool
328_efl_event_pointer_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, const char *name)
329{
330 if (!pd->modifiers) return EINA_FALSE;
331 return evas_key_modifier_is_set(pd->modifiers, name);
332}
333
334EOLIAN static Eina_Bool
335_efl_event_pointer_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, const char *name)
336{
337 if (!pd->locks) return EINA_FALSE;
338 return evas_key_lock_is_set(pd->locks, name);
339}
340
341EOLIAN static void
342_efl_event_pointer_double_click_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
343{
344 if (val)
345 pd->button_flags |= EFL_POINTER_FLAGS_DOUBLE_CLICK;
346 else
347 pd->button_flags &= ~EFL_POINTER_FLAGS_DOUBLE_CLICK;
348}
349
350EOLIAN static Eina_Bool
351_efl_event_pointer_double_click_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
352{
353 return !!(pd->button_flags & EFL_POINTER_FLAGS_DOUBLE_CLICK);
354}
355
356EOLIAN static void
357_efl_event_pointer_triple_click_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
358{
359 if (val)
360 pd->button_flags |= EFL_POINTER_FLAGS_TRIPLE_CLICK;
361 else
362 pd->button_flags &= ~EFL_POINTER_FLAGS_TRIPLE_CLICK;
363}
364
365EOLIAN static Eina_Bool
366_efl_event_pointer_triple_click_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
367{
368 return !!(pd->button_flags & EFL_POINTER_FLAGS_TRIPLE_CLICK);
369}
370
371EOLIAN static void
372_efl_event_pointer_on_hold_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
373{
374 if (val)
375 pd->event_flags |= EFL_EVENT_FLAGS_ON_HOLD;
376 else
377 pd->event_flags &= ~EFL_EVENT_FLAGS_ON_HOLD;
378}
379
380EOLIAN static Eina_Bool
381_efl_event_pointer_on_hold_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
382{
383 return !!(pd->event_flags & EFL_EVENT_FLAGS_ON_HOLD);
384}
385
386EOLIAN static void
387_efl_event_pointer_on_scroll_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Eina_Bool val)
388{
389 if (val)
390 pd->event_flags |= EFL_EVENT_FLAGS_ON_SCROLL;
391 else
392 pd->event_flags &= ~EFL_EVENT_FLAGS_ON_SCROLL;
393}
394
395EOLIAN static Eina_Bool
396_efl_event_pointer_on_scroll_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
397{
398 return !!(pd->event_flags & EFL_EVENT_FLAGS_ON_SCROLL);
399}
400
401#include "efl_event_pointer.eo.c"
diff --git a/src/lib/evas/canvas/efl_event_pointer.eo b/src/lib/evas/canvas/efl_event_pointer.eo
new file mode 100644
index 0000000000..b7675ee76a
--- /dev/null
+++ b/src/lib/evas/canvas/efl_event_pointer.eo
@@ -0,0 +1,173 @@
1import efl_orientation;
2import efl_event_types;
3
4class Efl.Event.Pointer (Eo.Base, Efl.Event, Efl.Input.State)
5{
6 [[Event data carried over with any pointer event (mouse, touch, ...)
7
8 @since 1.18
9 ]]
10 methods {
11 @property action {
12 [[The action represented by this event.]]
13 values {
14 act: Efl.Pointer.Action;
15 }
16 }
17 @property button {
18 [[The mouse button that triggered the event.]]
19 values {
20 but: int; [[1 to 32, 0 if not a button event.]]
21 }
22 }
23 @property button_pressed {
24 [[Whether a mouse button is pressed at the moment of the event.]]
25 keys {
26 button: int;
27 }
28 values {
29 pressed: bool;
30 }
31 }
32 @property position {
33 [[Position where the event happened, relative to the window.]]
34 values {
35 x: int;
36 y: int;
37 }
38 }
39 @property position_precise {
40 [[Position where the event happened, with subpixel precision
41
42 Note: Same value as @.position, relative to the window.
43 ]]
44 values {
45 x: double;
46 y: double;
47 }
48 }
49 @property previous_position {
50 [[Position of the previous event, valid for move events.
51
52 Relative to the window. May be equal to @.position.
53 ]]
54 values {
55 x: int;
56 y: int;
57 }
58 }
59 @property previous_position_precise {
60 [[Position of the previous event, with subpixel precision.
61
62 Valid for move events, may not be valid for other events.
63 Relative to the window. May be equal to @.position_precise.
64 ]]
65 values {
66 x: double;
67 y: double;
68 }
69 }
70 @property device {
71 [[Pointing device that originated this event.]]
72 values {
73 dev: Efl.Input.Device;
74 }
75 }
76 @property finger {
77 [[Finger ID in case of a multi touch event.]]
78 values {
79 id: int;
80 }
81 }
82 @property touch {
83 [[Touch information about a specific finger or pointer.]]
84 values {
85 radius: double;
86 rad_x: double;
87 rad_y: double;
88 pressure: double;
89 angle: double;
90 }
91 }
92 @property source {
93 [[The object where this event first originated, in case of
94 propagation or repetition of the event.
95 ]]
96 values {
97 src: Eo.Base; [[Source object: $Efl.Gfx]]
98 }
99 }
100 @property button_flags {
101 [[Double or triple click information.]]
102 values {
103 flags: Efl.Pointer.Flags;
104 }
105 }
106 @property double_click {
107 [[$true if @.button_flags indicates a double click (2nd press).
108
109 This is just a helper function around @.button_flags.
110 ]]
111 values {
112 val: bool;
113 }
114 }
115 @property triple_click {
116 [[$true if @.button_flags indicates a triple click (3rd press).
117
118 This is just a helper function around @.button_flags.
119 ]]
120 values {
121 val: bool;
122 }
123 }
124 @property event_flags {
125 [[Extra flags for this event, may be changed by the user.]]
126 values {
127 flags: Efl.Event.Flags;
128 }
129 }
130 @property on_hold {
131 [[$true if @.event_flags indicates the event is on hold.]]
132 values {
133 val: bool;
134 }
135 }
136 @property on_scroll {
137 [[$true if @.event_flags indicates the event happened while scrolling.]]
138 values {
139 val: bool;
140 }
141 }
142 @property wheel_direction {
143 values {
144 dir: Efl.Orient; [[Horizontal or Vertical only.]]
145 }
146 }
147 @property wheel_distance {
148 values {
149 dist: int;
150 }
151 }
152 instance_get @class {
153 [[Creates an instance of this events or returns a fresh one from
154 a memory pool.
155 ]]
156 params {
157 @in owner: Eo.Base; [[The parent object.]]
158 @out priv: void*; [[Pointer to the internal data of the object.]]
159 }
160 return: own(Efl.Event.Pointer);
161 }
162 }
163 implements {
164 Eo.Base.constructor;
165 class.destructor;
166 Efl.Event.reset;
167 Efl.Event.dup;
168 Efl.Event.timestamp.set;
169 Efl.Event.timestamp.get;
170 Efl.Input.State.modifier_enabled.get;
171 Efl.Input.State.lock_enabled.get;
172 }
173}
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index 1081ccec66..94abde70f0 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -1,6 +1,9 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_private.h" 2#include "evas_private.h"
3 3
4#define EFL_INTERNAL_UNSTABLE
5#include "interfaces/efl_common_internal.h"
6
4int _evas_event_counter = 0; 7int _evas_event_counter = 0;
5 8
6EVAS_MEMPOOL(_mp_pc); 9EVAS_MEMPOOL(_mp_pc);
@@ -58,14 +61,6 @@ typedef struct
58 Evas_Callback_Type type; 61 Evas_Callback_Type type;
59} _eo_evas_object_cb_info; 62} _eo_evas_object_cb_info;
60 63
61static Eina_Bool
62_eo_evas_object_cb(void *data, const Eo_Event *event)
63{
64 _eo_evas_object_cb_info *info = data;
65 if (info->func) info->func(info->data, evas_object_evas_get(event->object), event->object, event->info);
66 return EINA_TRUE;
67}
68
69typedef struct 64typedef struct
70{ 65{
71 EINA_INLIST; 66 EINA_INLIST;
@@ -74,6 +69,87 @@ typedef struct
74 Evas_Callback_Type type; 69 Evas_Callback_Type type;
75} _eo_evas_cb_info; 70} _eo_evas_cb_info;
76 71
72
73static inline void *
74_pointer_event_get(const _eo_evas_object_cb_info *info, const Eo_Event *event,
75 const Eo_Event_Description **pdesc)
76{
77 if (!info->data) return NULL;
78
79 /* See also evas_events.c: _pointer_event_create() */
80
81#define EV_CASE(TYPE, NEWTYPE, Type) \
82 case EVAS_CALLBACK_ ## TYPE: \
83 *pdesc = EFL_EVENT_POINTER_ ## NEWTYPE; \
84 return ((Evas_Event_ ## Type *) event->info)->reserved
85 switch (info->type)
86 {
87 EV_CASE(MOUSE_MOVE, MOVE, Mouse_Move);
88 EV_CASE(MOUSE_OUT, OUT, Mouse_Out);
89 EV_CASE(MOUSE_IN, IN, Mouse_In);
90 EV_CASE(MOUSE_DOWN, DOWN, Mouse_Down);
91 EV_CASE(MOUSE_UP, UP, Mouse_Up);
92 EV_CASE(MULTI_MOVE, MOVE, Multi_Move);
93 EV_CASE(MULTI_DOWN, DOWN, Multi_Down);
94 EV_CASE(MULTI_UP, UP, Multi_Up);
95 EV_CASE(MOUSE_WHEEL, WHEEL, Mouse_Wheel);
96 default: return NULL;
97 }
98#undef EV_CASE
99
100}
101
102static void
103_event_flags_adjust(void *ev, const Efl_Event_Pointer_Data *pedata)
104{
105#define EV_CASE(NEWTYPE, Type) \
106 case EFL_POINTER_ACTION_ ## NEWTYPE: \
107 ((Evas_Event_ ## Type *) ev)->event_flags = pedata->event_flags; \
108 break;
109
110 switch (pedata->action)
111 {
112 EV_CASE(MOVE, Mouse_Move);
113 EV_CASE(OUT, Mouse_Out);
114 EV_CASE(IN, Mouse_In);
115 EV_CASE(DOWN, Mouse_Down);
116 EV_CASE(UP, Mouse_Up);
117 EV_CASE(WHEEL, Mouse_Wheel);
118 default: break;
119 }
120
121#undef EV_CASE
122}
123
124static Eina_Bool
125_eo_evas_object_cb(void *data, const Eo_Event *event)
126{
127 _eo_evas_object_cb_info *info = data;
128 const Eo_Event_Description *desc;
129 Evas *evas = evas_object_evas_get(event->object);
130 void *pe;
131
132 pe = _pointer_event_get(info, event, &desc);
133 if (pe)
134 {
135 Efl_Event_Pointer_Data *pedata;
136 Efl_Event_Flags flags;
137
138 pedata = eo_data_scope_get(pe, EFL_EVENT_POINTER_CLASS);
139 flags = pedata->event_flags;
140 eo_event_callback_call(event->object, desc, pe);
141 if (flags != pedata->event_flags)
142 _event_flags_adjust(event->info, pedata);
143 }
144 if (info->func)
145 {
146 info->func(info->data, evas, event->object, event->info);
147 // if event_flags changed, pe will be fixed in evas_events.c
148 }
149
150 return EINA_TRUE;
151}
152
77static Eina_Bool 153static Eina_Bool
78_eo_evas_cb(void *data, const Eo_Event *event) 154_eo_evas_cb(void *data, const Eo_Event *event)
79{ 155{
diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo
index 9bcfe4029a..d4a51dcc47 100644
--- a/src/lib/evas/canvas/evas_canvas.eo
+++ b/src/lib/evas/canvas/evas_canvas.eo
@@ -1,6 +1,8 @@
1import evas_types; 1import evas_types;
2import efl_event_types;
2 3
3class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator) 4class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator,
5 Efl.Input.Interface)
4{ 6{
5 legacy_prefix: evas; 7 legacy_prefix: evas;
6 data: Evas_Public_Data; 8 data: Evas_Public_Data;
@@ -113,7 +115,7 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
113 ]] 115 ]]
114 } 116 }
115 values { 117 values {
116 flags: Evas.Event_Flags; [[The default flags to use.]] 118 flags: Efl.Event.Flags; [[The default flags to use.]]
117 } 119 }
118 } 120 }
119 @property output_method { 121 @property output_method {
@@ -409,8 +411,8 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
409 canvas. 411 canvas.
410 412
411 When this function is called it will return a value of either 413 When this function is called it will return a value of either
412 $false or $true, depending on if @.event_feed_mouse_in or 414 $false or $true, depending on if event_feed_mouse_in or
413 @.event_feed_mouse_out have been called to feed in a mouse 415 event_feed_mouse_out have been called to feed in a mouse
414 enter event into the canvas. 416 enter event into the canvas.
415 417
416 A return value of $true indicates the mouse is logically 418 A return value of $true indicates the mouse is logically
@@ -503,8 +505,7 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
503 any host system's pointing device abilities. 505 any host system's pointing device abilities.
504 506
505 A canvas by default begins with no mouse buttons being 507 A canvas by default begins with no mouse buttons being
506 pressed and only calls to @.event_feed_mouse_down 508 pressed and only pointer move events can alter that.
507 and @.event_feed_mouse_up will alter that.
508 509
509 The least significant bit corresponds to the first mouse 510 The least significant bit corresponds to the first mouse
510 button (button 1) and the most significant bit corresponds 511 button (button 1) and the most significant bit corresponds
@@ -547,20 +548,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
547 @in y: int; [[The vertical coordinate of the position.]] 548 @in y: int; [[The vertical coordinate of the position.]]
548 } 549 }
549 } 550 }
550 event_feed_mouse_wheel {
551 [[Mouse wheel event feed.
552
553 This function will set some evas properties that is necessary
554 when the mouse wheel is scrolled up or down. It prepares
555 information to be treated by the callback function.
556 ]]
557 params {
558 @in direction: int; [[The wheel mouse direction.]]
559 @in z: int; [[How much mouse wheel was scrolled up or down.]]
560 @in timestamp: uint; [[The timestamp of the mouse up event.]]
561 @in data: const(void)*; [[The data for canvas.]]
562 }
563 }
564 key_lock_on { 551 key_lock_on {
565 [[Enables or turns on programmatically the lock key with name 552 [[Enables or turns on programmatically the lock key with name
566 $keyname. 553 $keyname.
@@ -575,22 +562,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
575 @in keyname: const(char)* @nonull; [[The name of the lock to enable.]] 562 @in keyname: const(char)* @nonull; [[The name of the lock to enable.]]
576 } 563 }
577 } 564 }
578 event_feed_key_down {
579 [[Key down event feed.
580
581 This function will set some evas properties that is necessary
582 when a key is pressed. It prepares information to be treated
583 by the callback function.
584 ]]
585 params {
586 @in keyname: const(char)*; [[Name of the key.]]
587 @in key: const(char)*; [[The key pressed.]]
588 @in string: const(char)*; [[A string.]]
589 @in compose: const(char)*; [[The compose string.]]
590 @in timestamp: uint; [[Timestamp of the mouse up event.]]
591 @in data: const(void)*; [[Data for canvas.]]
592 }
593 }
594 key_modifier_mask_get @const { 565 key_modifier_mask_get @const {
595 [[Creates a bit mask from the $keyname modifier key. Values 566 [[Creates a bit mask from the $keyname modifier key. Values
596 returned from different calls to it may be ORed together, 567 returned from different calls to it may be ORed together,
@@ -650,75 +621,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
650 @in keyname: const(char)* @nonull; [[The name of the modifier to disable.]] 621 @in keyname: const(char)* @nonull; [[The name of the modifier to disable.]]
651 } 622 }
652 } 623 }
653 event_feed_hold {
654 [[Hold event feed.
655
656 This function makes the object to stop sending events.
657 ]]
658 params {
659 @in hold: int; [[The hold.]]
660 @in timestamp: uint; [[The timestamp of the mouse up event.]]
661 @in data: const(void)*; [[The data for canvas.]]
662 }
663 }
664 event_feed_mouse_move {
665 [[Mouse move event feed.
666
667 This function will set some evas properties that is necessary
668 when the mouse is moved from its last position. It prepares
669 information to be treated by the callback function.
670 ]]
671 params {
672 @in x: int; [[The horizontal position of the mouse pointer.]]
673 @in y: int; [[The vertical position of the mouse pointer.]]
674 @in timestamp: uint; [[The timestamp of the mouse up event.]]
675 @in data: const(void)*; [[The data for canvas.]]
676 }
677 }
678 event_feed_key_up {
679 [[Key up event feed.
680
681 This function will set some evas properties that is necessary
682 when a key is released. It prepares information to be treated
683 by the callback function.
684 ]]
685 params {
686 @in keyname: const(char)*; [[Name of the key.]]
687 @in key: const(char)*; [[The key released.]]
688 @in string: const(char)*; [[A string.]]
689 @in compose: const(char)*; [[Compose.]]
690 @in timestamp: uint; [[Timestamp of the mouse up event.]]
691 @in data: const(void)*; [[Data for canvas.]]
692 }
693 }
694 event_feed_mouse_out {
695 [[Mouse out event feed.
696
697 This function will set some evas properties that is necessar
698 when the mouse out event happens. It prepares information to
699 be treated by the callback function.
700 ]]
701 params {
702 @in timestamp: uint; [[Timestamp of the mouse up event.]]
703 @in data: const(void)*; [[The data for canvas.]]
704 }
705 }
706 event_input_multi_move {
707 params {
708 @in d: int;
709 @in x: int;
710 @in y: int;
711 @in rad: double;
712 @in radx: double;
713 @in rady: double;
714 @in pres: double;
715 @in ang: double;
716 @in fx: double;
717 @in fy: double;
718 @in timestamp: uint;
719 @in data: const(void)*;
720 }
721 }
722 objects_at_xy_get @const { 624 objects_at_xy_get @const {
723 [[Retrieve a list of Evas objects lying over a given position in 625 [[Retrieve a list of Evas objects lying over a given position in
724 a canvas. 626 a canvas.
@@ -748,40 +650,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
748 ]] 650 ]]
749 } 651 }
750 } 652 }
751 event_input_multi_up {
752 params {
753 @in d: int;
754 @in x: int;
755 @in y: int;
756 @in rad: double;
757 @in radx: double;
758 @in rady: double;
759 @in pres: double;
760 @in ang: double;
761 @in fx: double;
762 @in fy: double;
763 @in flags: Evas.Button_Flags;
764 @in timestamp: uint;
765 @in data: const(void)*;
766 }
767 }
768 event_feed_multi_down {
769 params {
770 @in d: int;
771 @in x: int;
772 @in y: int;
773 @in rad: double;
774 @in radx: double;
775 @in rady: double;
776 @in pres: double;
777 @in ang: double;
778 @in fx: double;
779 @in fy: double;
780 @in flags: Evas.Button_Flags;
781 @in timestamp: uint;
782 @in data: const(void)*;
783 }
784 }
785 render_async { 653 render_async {
786 [[Render the given Evas canvas asynchronously. 654 [[Render the given Evas canvas asynchronously.
787 655
@@ -833,26 +701,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
833 focus_out { 701 focus_out {
834 [[Inform to the evas that it lost the focus.]] 702 [[Inform to the evas that it lost the focus.]]
835 } 703 }
836 event_input_mouse_move {
837 [[Mouse move event feed from input.
838
839 Similar to the @.event_feed_mouse_move, this function will
840 inform Evas about mouse move events which were received by
841 the input system, relative to the 0,0 of the window, not to the
842 canvas 0,0. It will take care of doing any special transformation
843 like adding the framespace offset to the mouse event.
844
845 @since 1.8
846 ]]
847 params {
848 @in x: int; [[The horizontal position of the mouse pointer
849 relative to the 0,0 of the window/surface.]]
850 @in y: int; [[The vertical position of the mouse pointer
851 relative to the 0,0 of the window/surface.]]
852 @in timestamp: uint; [[The timestamp of the mouse move event.]]
853 @in data: const(void)*; [[The data for canvas.]]
854 }
855 }
856 norender { 704 norender {
857 [[Update the canvas internal objects but not triggering immediate 705 [[Update the canvas internal objects but not triggering immediate
858 renderization. 706 renderization.
@@ -881,23 +729,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
881 */ 729 */
882 return: uint; [[The number of touched point on the evas.]] 730 return: uint; [[The number of touched point on the evas.]]
883 } 731 }
884 event_input_multi_down {
885 params {
886 @in d: int;
887 @in x: int;
888 @in y: int;
889 @in rad: double;
890 @in radx: double;
891 @in rady: double;
892 @in pres: double;
893 @in ang: double;
894 @in fx: double;
895 @in fy: double;
896 @in flags: Evas.Button_Flags;
897 @in timestamp: uint;
898 @in data: const(void)*;
899 }
900 }
901 nochange_pop { 732 nochange_pop {
902 [[Pop the nochange flag down 1. 733 [[Pop the nochange flag down 1.
903 734
@@ -986,47 +817,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
986 @in keyname: const(char)* @nonull; [[The name of the modifier to enable.]] 817 @in keyname: const(char)* @nonull; [[The name of the modifier to enable.]]
987 } 818 }
988 } 819 }
989 event_feed_mouse_up {
990 [[Mouse up event feed.
991
992 This function will set some evas properties that is necessary
993 when the mouse button is released. It prepares information to
994 be treated by the callback function.
995 ]]
996 params {
997 @in b: int; [[The button number.]]
998 @in flags: Evas.Button_Flags; [[Evas button flags.]]
999 @in timestamp: uint; [[The timestamp of the mouse up event.]]
1000 @in data: const(void)*; [[The data for canvas.]]
1001 }
1002 }
1003 event_feed_mouse_down {
1004 [[Mouse down event feed.
1005
1006 This function will set some evas properties that is necessary
1007 when the mouse button is pressed. It prepares information to
1008 be treated by the callback function.
1009 ]]
1010 params {
1011 @in b: int; [[The button number.]]
1012 @in flags: Evas.Button_Flags; [[Evas button flags.]]
1013 @in timestamp: uint; [[The timestamp of the mouse up event.]]
1014 @in data: const(void)*; [[The data for canvas.]]
1015 }
1016 }
1017 event_refeed_event {
1018 [[Re feed event.
1019
1020 This function re-feeds the event pointed by event_copy.
1021
1022 This function call evas_event_feed_* functions, so it can
1023 cause havoc if not used wisely. Please use it responsibly.
1024 ]]
1025 params {
1026 @in event_copy: void *; [[The event to refeed.]]
1027 @in event_type: Evas.Callback_Type; [[Event type.]]
1028 }
1029 }
1030 font_available_list @const { 820 font_available_list @const {
1031 [[List of available font descriptions known or found by this evas. 821 [[List of available font descriptions known or found by this evas.
1032 822
@@ -1197,22 +987,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
1197 @in x: Evas.Coord; [[The canvas x coordinate.]] 987 @in x: Evas.Coord; [[The canvas x coordinate.]]
1198 } 988 }
1199 } 989 }
1200 event_feed_multi_move {
1201 params {
1202 @in d: int;
1203 @in x: int;
1204 @in y: int;
1205 @in rad: double;
1206 @in radx: double;
1207 @in rady: double;
1208 @in pres: double;
1209 @in ang: double;
1210 @in fx: double;
1211 @in fy: double;
1212 @in timestamp: uint;
1213 @in data: const(void)*;
1214 }
1215 }
1216 render_updates { 990 render_updates {
1217 [[Force immediate renderization of the given Evas canvas. 991 [[Force immediate renderization of the given Evas canvas.
1218 992
@@ -1380,18 +1154,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
1380 @.render_idle_flush might discard too. 1154 @.render_idle_flush might discard too.
1381 ]] 1155 ]]
1382 } 1156 }
1383 event_feed_mouse_in {
1384 [[Mouse in event feed.
1385
1386 This function will set some evas properties that is necessary
1387 when the mouse in event happens. It prepares information to be
1388 treated by the callback function.
1389 ]]
1390 params {
1391 @in timestamp: uint; [[The timestamp of the mouse up event.]]
1392 @in data: const(void)*; [[The data for canvas.]]
1393 }
1394 }
1395 object_top_in_rectangle_get @const { 1157 object_top_in_rectangle_get @const {
1396 [[Retrieve the Evas object stacked at the top of a given 1158 [[Retrieve the Evas object stacked at the top of a given
1397 rectangular region in a canvas 1159 rectangular region in a canvas
@@ -1435,23 +1197,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
1435 [[Force renderization of the given canvas.]] 1197 [[Force renderization of the given canvas.]]
1436 1198
1437 } 1199 }
1438 event_feed_multi_up {
1439 params {
1440 @in d: int;
1441 @in x: int;
1442 @in y: int;
1443 @in rad: double;
1444 @in radx: double;
1445 @in rady: double;
1446 @in pres: double;
1447 @in ang: double;
1448 @in fx: double;
1449 @in fy: double;
1450 @in flags: Evas.Button_Flags;
1451 @in timestamp: uint;
1452 @in data: const(void)*;
1453 }
1454 }
1455 font_path_prepend { 1200 font_path_prepend {
1456 [[Prepends a font path to the list of font paths used by the 1201 [[Prepends a font path to the list of font paths used by the
1457 given evas. 1202 given evas.
@@ -1477,17 +1222,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
1477 @.damage_rectangle_add). 1222 @.damage_rectangle_add).
1478 ]] 1223 ]]
1479 } 1224 }
1480 event_feed_mouse_cancel {
1481 [[Mouse cancel event feed.
1482
1483 This function will call @.event_feed_mouse_up when a
1484 mouse cancel event happens.
1485 ]]
1486 params {
1487 @in timestamp: uint; [[The timestamp of the mouse up event.]]
1488 @in data: const(void)*; [[The data for canvas.]]
1489 }
1490 }
1491 coord_screen_x_to_world @const { 1225 coord_screen_x_to_world @const {
1492 [[Convert/scale an output screen coordinate into canvas 1226 [[Convert/scale an output screen coordinate into canvas
1493 coordinates. 1227 coordinates.
@@ -1574,62 +1308,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
1574 @in y: Evas.Coord; [[The canvas y coordinate.]] 1308 @in y: Evas.Coord; [[The canvas y coordinate.]]
1575 } 1309 }
1576 } 1310 }
1577 event_feed_key_down_with_keycode {
1578 [[Key down event feed with keycode.
1579
1580 This function will set some evas properties that is necessary
1581 when a key is pressed. It prepares information to be treated
1582 by the callback function.
1583
1584 @since 1.10
1585 ]]
1586 params {
1587 @in keyname: const(char)*; [[Name of the key.]]
1588 @in key: const(char)*; [[The key released.]]
1589 @in string: const(char)*; [[A string.]]
1590 @in compose: const(char)*; [[Compose.]]
1591 @in timestamp: uint; [[Timestamp of the mouse up event.]]
1592 @in data: const(void)*; [[Data for canvas.]]
1593 @in keycode: uint; [[Key scan code numeric value for canvas.]]
1594 }
1595 }
1596 event_feed_key_up_with_keycode {
1597 [[Key up event feed with keycode.
1598
1599 This function will set some evas properties that is necessary
1600 when a key is released. It prepares information to be treated
1601 by the callback function.
1602
1603 @since 1.10
1604 ]]
1605 params {
1606 @in keyname: const(char)*; [[Name of the key.]]
1607 @in key: const(char)*; [[The key released.]]
1608 @in string: const(char)*; [[A string.]]
1609 @in compose: const(char)*; [[Compose.]]
1610 @in timestamp: uint; [[Timestamp of the mouse up event.]]
1611 @in data: const(void)*; [[Data for canvas.]]
1612 @in keycode: uint; [[Key scan code numeric value for canvas.]]
1613 }
1614 }
1615 event_feed_axis_update {
1616 [[Input device axis update event feed.
1617
1618 This function will set some evas properties that is necessary
1619 when an e.g. stylus axis is updated. It prepares information
1620 to be treated by the callback function.
1621
1622 @since 1.13
1623 ]]
1624 params {
1625 @in timestamp: uint; [[Timestamp of the axis event.]]
1626 @in device: int; [[System-provided device identifier.]]
1627 @in toolid: int; [[Type of tool currently being used.]]
1628 @in naxes: int; [[Number of elements in the \p axis array.]]
1629 @in axis: const(Evas.Axis)*; [[Array containing the current value of all updated axes.]]
1630 @in data: const(void)*; [[Data for canvas.]]
1631 }
1632 }
1633 } 1311 }
1634 implements { 1312 implements {
1635 Eo.Base.constructor; 1313 Eo.Base.constructor;
diff --git a/src/lib/evas/canvas/evas_device.c b/src/lib/evas/canvas/evas_device.c
index b57a587b7c..a2dfafee59 100644
--- a/src/lib/evas/canvas/evas_device.c
+++ b/src/lib/evas/canvas/evas_device.c
@@ -1,66 +1,84 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_private.h" 2#include "evas_private.h"
3 3
4#define EFL_INTERNAL_UNSTABLE
5#include "interfaces/efl_common_internal.h"
6
7/* WARNING: This API is not used across EFL, hard to test! */
8
9#ifdef DEBUG_UNTESTED_
10// booh
11#define SAFETY_CHECK(obj, klass, ...) \
12 do { MAGIC_CHECK(dev, Evas_Device, 1); \
13 return __VA_ARGS__; \
14 MAGIC_CHECK_END(); \
15 } while (0)
16
17#else
18#define SAFETY_CHECK(obj, klass, ...) \
19 do { if (!obj) return __VA_ARGS__; } while (0)
20#endif
21
22/* FIXME: Ideally no work besides calling the Efl_Input_Device API
23 * should be done here. But unfortunately, some knowledge of Evas is required
24 * here (callbacks and canvas private data).
25 */
26
27static Eina_Bool
28_del_cb(void *data, const Eo_Event *ev)
29{
30 Evas_Public_Data *e = data;
31
32 // can not be done in std destructor
33 e->devices = eina_list_remove(e->devices, ev->object);
34
35 return EO_CALLBACK_CONTINUE;
36}
37
4EAPI Evas_Device * 38EAPI Evas_Device *
5evas_device_add(Evas *eo_e) 39evas_device_add(Evas *eo_e)
6{ 40{
41 Efl_Input_Device_Data *d;
42 Evas_Public_Data *e;
7 Evas_Device *dev; 43 Evas_Device *dev;
8 44
9 MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); 45 SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
10 return NULL; 46
11 MAGIC_CHECK_END(); 47 dev = eo_add(EFL_INPUT_DEVICE_CLASS, eo_e);
12 dev = calloc(1, sizeof(Evas_Device)); 48
13 if (!dev) return NULL; 49 d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
14 dev->magic = MAGIC_DEV; 50 d->evas = eo_e;
15 dev->evas = eo_e; 51
16 dev->ref = 1; 52 e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
17 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
18 e->devices = eina_list_append(e->devices, dev); 53 e->devices = eina_list_append(e->devices, dev);
54 eo_event_callback_add(dev, EO_EVENT_DEL, _del_cb, e);
55
19 evas_event_callback_call(eo_e, EVAS_CALLBACK_DEVICE_CHANGED, dev); 56 evas_event_callback_call(eo_e, EVAS_CALLBACK_DEVICE_CHANGED, dev);
57
20 return dev; 58 return dev;
21} 59}
22 60
23EAPI void 61EAPI void
24evas_device_del(Evas_Device *dev) 62evas_device_del(Evas_Device *dev)
25{ 63{
26 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 64 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
27 return; 65
28 MAGIC_CHECK_END(); 66 eo_unref(dev);
29 if (dev->ref == 1)
30 {
31 Evas_Device *dev2;
32
33 EINA_LIST_FREE(dev->children, dev2)
34 {
35 dev2->parent = NULL;
36 evas_device_del(dev2);
37 }
38 if (dev->src)
39 {
40 _evas_device_unref(dev->src);
41 dev->src = NULL;
42 }
43 dev->parent = NULL;
44 }
45 _evas_device_unref(dev);
46} 67}
47 68
48EAPI void 69EAPI void
49evas_device_push(Evas *eo_e, Evas_Device *dev) 70evas_device_push(Evas *eo_e, Evas_Device *dev)
50{ 71{
51 MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); 72 SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS);
52 return; 73 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
53 MAGIC_CHECK_END(); 74
54 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
55 return;
56 MAGIC_CHECK_END();
57 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 75 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
58 if (!e->cur_device) 76 if (!e->cur_device)
59 { 77 {
60 e->cur_device = eina_array_new(4); 78 e->cur_device = eina_array_new(4);
61 if (!e->cur_device) return; 79 if (!e->cur_device) return;
62 } 80 }
63 dev->ref++; 81 eo_ref(dev);
64 eina_array_push(e->cur_device, dev); 82 eina_array_push(e->cur_device, dev);
65} 83}
66 84
@@ -68,28 +86,27 @@ EAPI void
68evas_device_pop(Evas *eo_e) 86evas_device_pop(Evas *eo_e)
69{ 87{
70 Evas_Device *dev; 88 Evas_Device *dev;
71 89
72 MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); 90 SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS);
73 return; 91
74 MAGIC_CHECK_END();
75 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 92 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
76 dev = eina_array_pop(e->cur_device); 93 dev = eina_array_pop(e->cur_device);
77 if (dev) _evas_device_unref(dev); 94 if (dev) eo_unref(dev);
78} 95}
79 96
80EAPI const Eina_List * 97EAPI const Eina_List *
81evas_device_list(Evas *eo_e, const Evas_Device *dev) 98evas_device_list(Evas *eo_e, const Evas_Device *dev)
82{ 99{
83 MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); 100 SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
84 return NULL; 101
85 MAGIC_CHECK_END();
86 if (dev) 102 if (dev)
87 { 103 {
88 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 104 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS, NULL);
89 return NULL; 105
90 MAGIC_CHECK_END(); 106 Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
107 return d->children;
91 } 108 }
92 if (dev) return dev->children; 109
93 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 110 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
94 return e->devices; 111 return e->devices;
95} 112}
@@ -97,141 +114,123 @@ evas_device_list(Evas *eo_e, const Evas_Device *dev)
97EAPI void 114EAPI void
98evas_device_name_set(Evas_Device *dev, const char *name) 115evas_device_name_set(Evas_Device *dev, const char *name)
99{ 116{
100 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 117 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
101 return; 118
102 MAGIC_CHECK_END(); 119 Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
103 eina_stringshare_replace(&(dev->name), name); 120
104 evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev); 121 efl_input_device_name_set(dev, name);
122 evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
105} 123}
106 124
107EAPI const char * 125EAPI const char *
108evas_device_name_get(const Evas_Device *dev) 126evas_device_name_get(const Evas_Device *dev)
109{ 127{
110 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 128 return efl_input_device_name_get(dev);
111 return NULL;
112 MAGIC_CHECK_END();
113 return dev->name;
114} 129}
115 130
116EAPI void 131EAPI void
117evas_device_description_set(Evas_Device *dev, const char *desc) 132evas_device_description_set(Evas_Device *dev, const char *desc)
118{ 133{
119 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 134 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
120 return; 135
121 MAGIC_CHECK_END(); 136 efl_input_device_description_set(dev, desc);
122 eina_stringshare_replace(&(dev->desc), desc); 137
123 evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev); 138 Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
139 evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
124} 140}
125 141
126EAPI const char * 142EAPI const char *
127evas_device_description_get(const Evas_Device *dev) 143evas_device_description_get(const Evas_Device *dev)
128{ 144{
129 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 145 return efl_input_device_description_get(dev);
130 return NULL;
131 MAGIC_CHECK_END();
132 return dev->desc;
133} 146}
134 147
135EAPI void 148EAPI void
136evas_device_parent_set(Evas_Device *dev, Evas_Device *parent) 149evas_device_parent_set(Evas_Device *dev, Evas_Device *parent)
137{ 150{
138 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 151 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
139 return; 152
140 MAGIC_CHECK_END(); 153 Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
141 Evas_Public_Data *e = eo_data_scope_get(dev->evas, EVAS_CANVAS_CLASS); 154 Evas_Public_Data *e = eo_data_scope_get(d->evas, EVAS_CANVAS_CLASS);
142 if (parent) 155 if (parent)
143 { 156 {
144 MAGIC_CHECK(parent, Evas_Device, MAGIC_DEV); 157 SAFETY_CHECK(parent, EFL_INPUT_DEVICE_CLASS);
145 return; 158 }
146 MAGIC_CHECK_END(); 159
160 /* FIXME: move this to Efl.Input.Device */
161 if (d->parent == parent) return;
162 if (d->parent)
163 {
164 Efl_Input_Device_Data *p = eo_data_scope_get(d->parent, EFL_INPUT_DEVICE_CLASS);
165 p->children = eina_list_remove(p->children, dev);
147 } 166 }
148 if (dev->parent == parent) return;
149 if (dev->parent)
150 dev->parent->children = eina_list_remove(dev->parent->children, dev);
151 else if (parent) 167 else if (parent)
152 e->devices = eina_list_remove(e->devices, dev); 168 e->devices = eina_list_remove(e->devices, dev);
153 dev->parent = parent; 169 d->parent = parent;
154 if (parent) 170 if (parent)
155 parent->children = eina_list_append(parent->children, dev); 171 {
172 Efl_Input_Device_Data *p = eo_data_scope_get(parent, EFL_INPUT_DEVICE_CLASS);
173 p->children = eina_list_append(p->children, dev);
174 }
156 else 175 else
157 e->devices = eina_list_append(e->devices, dev); 176 e->devices = eina_list_append(e->devices, dev);
158 177
159 evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev); 178 evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
160} 179}
161 180
162EAPI const Evas_Device * 181EAPI const Evas_Device *
163evas_device_parent_get(const Evas_Device *dev) 182evas_device_parent_get(const Evas_Device *dev)
164{ 183{
165 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 184 return efl_input_device_parent_get(dev);
166 return NULL;
167 MAGIC_CHECK_END();
168 return dev->parent;
169} 185}
170 186
171EAPI void 187EAPI void
172evas_device_class_set(Evas_Device *dev, Evas_Device_Class clas) 188evas_device_class_set(Evas_Device *dev, Evas_Device_Class clas)
173{ 189{
174 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 190 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
175 return; 191
176 MAGIC_CHECK_END(); 192 Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
177 dev->clas = clas; 193
178 evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev); 194 efl_input_device_type_set(dev, clas);
195 evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
179} 196}
180 197
181EAPI Evas_Device_Class 198EAPI Evas_Device_Class
182evas_device_class_get(const Evas_Device *dev) 199evas_device_class_get(const Evas_Device *dev)
183{ 200{
184 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 201 return efl_input_device_type_get(dev);
185 return EVAS_DEVICE_CLASS_NONE;
186 MAGIC_CHECK_END();
187 return dev->clas;
188} 202}
189 203
190EAPI void 204EAPI void
191evas_device_subclass_set(Evas_Device *dev, Evas_Device_Subclass clas) 205evas_device_subclass_set(Evas_Device *dev, Evas_Device_Subclass clas)
192{ 206{
193 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 207 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
194 return; 208 Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
195 MAGIC_CHECK_END(); 209
196 dev->subclas = clas; 210 efl_input_device_subtype_set(dev, clas);
197 evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev); 211 evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
198} 212}
199 213
200EAPI Evas_Device_Subclass 214EAPI Evas_Device_Subclass
201evas_device_subclass_get(const Evas_Device *dev) 215evas_device_subclass_get(const Evas_Device *dev)
202{ 216{
203 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 217 return efl_input_device_subtype_get(dev);
204 return EVAS_DEVICE_SUBCLASS_NONE;
205 MAGIC_CHECK_END();
206 return dev->subclas;
207} 218}
208 219
209EAPI void 220EAPI void
210evas_device_emulation_source_set(Evas_Device *dev, Evas_Device *src) 221evas_device_emulation_source_set(Evas_Device *dev, Evas_Device *src)
211{ 222{
212 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 223 SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
213 return; 224 Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
214 MAGIC_CHECK_END(); 225
215 if (src) 226 efl_input_device_source_set(dev, src);
216 { 227 evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
217 MAGIC_CHECK(src, Evas_Device, MAGIC_DEV);
218 return;
219 MAGIC_CHECK_END();
220 }
221 if (dev->src == src) return;
222 if (dev->src) _evas_device_unref(dev->src);
223 dev->src = src;
224 if (dev->src) dev->src->ref++;
225 evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
226} 228}
227 229
228EAPI const Evas_Device * 230EAPI const Evas_Device *
229evas_device_emulation_source_get(const Evas_Device *dev) 231evas_device_emulation_source_get(const Evas_Device *dev)
230{ 232{
231 MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV); 233 return efl_input_device_source_get(dev);
232 return NULL;
233 MAGIC_CHECK_END();
234 return dev->src;
235} 234}
236 235
237void 236void
@@ -243,7 +242,7 @@ _evas_device_cleanup(Evas *eo_e)
243 if (e->cur_device) 242 if (e->cur_device)
244 { 243 {
245 while ((dev = eina_array_pop(e->cur_device))) 244 while ((dev = eina_array_pop(e->cur_device)))
246 _evas_device_unref(dev); 245 eo_unref(dev);
247 eina_array_free(e->cur_device); 246 eina_array_free(e->cur_device);
248 e->cur_device = NULL; 247 e->cur_device = NULL;
249 } 248 }
@@ -264,21 +263,3 @@ _evas_device_top_get(const Evas *eo_e)
264 if (num < 1) return NULL; 263 if (num < 1) return NULL;
265 return eina_array_data_get(e->cur_device, num - 1); 264 return eina_array_data_get(e->cur_device, num - 1);
266} 265}
267
268void
269_evas_device_ref(Evas_Device *dev)
270{
271 dev->ref++;
272}
273
274void
275_evas_device_unref(Evas_Device *dev)
276{
277 dev->ref--;
278 if (dev->ref > 0) return;
279 if (dev->name) eina_stringshare_del(dev->name);
280 if (dev->desc) eina_stringshare_del(dev->desc);
281 dev->magic = 0;
282 free(dev);
283}
284
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index 08bc9bb951..516bce664c 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -1,6 +1,9 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_private.h" 2#include "evas_private.h"
3 3
4#define EFL_INTERNAL_UNSTABLE
5#include "interfaces/efl_common_internal.h"
6
4static Eina_List * 7static Eina_List *
5_evas_event_object_list_in_get(Evas *eo_e, Eina_List *in, 8_evas_event_object_list_in_get(Evas *eo_e, Eina_List *in,
6 const Eina_Inlist *list, Evas_Object *stop, 9 const Eina_Inlist *list, Evas_Object *stop,
@@ -9,6 +12,17 @@ _evas_event_object_list_in_get(Evas *eo_e, Eina_List *in,
9static Eina_List * 12static Eina_List *
10evas_event_list_copy(Eina_List *list); 13evas_event_list_copy(Eina_List *list);
11 14
15static void
16_canvas_event_feed_mouse_move_internal(Eo *eo_e, Evas_Public_Data *e, int x, int y,
17 unsigned int timestamp, const void *data,
18 Efl_Event_Pointer_Data *parent_pe);
19
20static void
21_canvas_event_feed_multi_up_internal(Evas *eo_e, void *_pd, int d, int x, int y,
22 double rad, double radx, double rady, double pres, double ang,
23 double fx, double fy, Evas_Button_Flags flags,
24 unsigned int timestamp, const void *data,
25 Efl_Event_Pointer_Data *parent_pe);
12 26
13static void 27static void
14_evas_event_havemap_adjust(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord *x, Evas_Coord *y, Eina_Bool mouse_grabbed) 28_evas_event_havemap_adjust(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord *x, Evas_Coord *y, Eina_Bool mouse_grabbed)
@@ -32,6 +46,89 @@ _evas_event_havemap_adjust(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protecte
32 } 46 }
33} 47}
34 48
49static inline Efl_Event_Pointer *
50_pointer_event_create(Evas_Callback_Type type, void *ev,
51 Efl_Event_Pointer_Data *parentev,
52 Efl_Event_Pointer_Data **evdata)
53{
54 Efl_Event_Pointer *evt = NULL;
55
56 if (!ev) return NULL;
57
58 /* This function converts an existing evas info struct to the efl pointer
59 * event. All pointers must be valid.
60 *
61 * See also evas_callbacks.c: _pointer_event_get()
62 *
63 * FIXME: evas event logic should not use legacy structs anymore... this
64 * should be temporary code. Should be.
65 */
66
67#define EV_CASE(TYPE, Type) \
68 case EVAS_CALLBACK_ ## TYPE: \
69 evt = efl_event_pointer_instance_get(EFL_EVENT_POINTER_CLASS, \
70 parentev ? parentev->eo : NULL, (void **) evdata); \
71 efl_event_pointer_legacy_info_set(evt, ev, type); \
72 ((Evas_Event_ ## Type *) ev)->reserved = evt; \
73 break;
74
75 switch (type)
76 {
77 EV_CASE(MOUSE_MOVE, Mouse_Move);
78 EV_CASE(MOUSE_OUT, Mouse_Out);
79 EV_CASE(MOUSE_IN, Mouse_In);
80 EV_CASE(MOUSE_DOWN, Mouse_Down);
81 EV_CASE(MOUSE_UP, Mouse_Up);
82 EV_CASE(MULTI_MOVE, Multi_Move);
83 EV_CASE(MULTI_DOWN, Multi_Down);
84 EV_CASE(MULTI_UP, Multi_Up);
85 EV_CASE(MOUSE_WHEEL, Mouse_Wheel);
86 default:
87 DBG("Support for event type %d not implemented yet.", type);
88 break;
89 }
90
91#undef EV_CASE
92
93 if (!evt && evdata) *evdata = NULL;
94 return evt;
95}
96
97static inline void
98_pointer_event_flags_adjust(Efl_Event_Pointer_Data *pedata,
99 Evas_Callback_Type type, const void *ev)
100{
101#define EV_CASE(TYPE, Type) \
102 case EVAS_CALLBACK_ ## TYPE: \
103 pedata->event_flags = ((Evas_Event_ ## Type *) ev)->event_flags; \
104 break;
105
106 switch (type)
107 {
108 EV_CASE(MOUSE_MOVE, Mouse_Move);
109 EV_CASE(MOUSE_OUT, Mouse_Out);
110 EV_CASE(MOUSE_IN, Mouse_In);
111 EV_CASE(MOUSE_DOWN, Mouse_Down);
112 EV_CASE(MOUSE_UP, Mouse_Up);
113 EV_CASE(MULTI_MOVE, Multi_Move);
114 EV_CASE(MULTI_DOWN, Multi_Down);
115 EV_CASE(MULTI_UP, Multi_Up);
116 EV_CASE(MOUSE_WHEEL, Mouse_Wheel);
117 default: break;
118 }
119
120#undef EV_CASE
121}
122
123#define EV_CALL(_eo_obj, _obj, _typ, _ev, _id, _pe) do { \
124 if (!_pe) _pe = _pointer_event_create(_typ, _ev, parent_pe, & _pe ## data); \
125 else efl_event_pointer_legacy_info_set(_pe, _ev, _typ); \
126 evas_object_event_callback_call(_eo_obj, _obj, _typ, _ev, _id); \
127 _pointer_event_flags_adjust(_pe ## data, _typ, _ev); \
128 } while (0)
129#define EV_RESET(a) do { if (a) efl_event_reset(a); } while (0)
130#define EV_DEL(a) do { if (a) { eo_unref(a); } a = NULL; } while (0)
131
35static Eina_List * 132static Eina_List *
36_evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in, 133_evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
37 const Eina_Inlist *list, Evas_Object *stop, 134 const Eina_Inlist *list, Evas_Object *stop,
@@ -187,7 +284,9 @@ _transform_to_src_space(Evas_Object_Protected_Data *obj, Evas_Object_Protected_D
187} 284}
188 285
189static void 286static void
190_evas_event_source_mouse_down_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_Mouse_Down *ev, int event_id) 287_evas_event_source_mouse_down_events(Evas_Object *eo_obj, Evas *eo_e,
288 Evas_Event_Mouse_Down *ev, int event_id,
289 Efl_Event_Pointer_Data *parent_pe)
191{ 290{
192 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); 291 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
193 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj); 292 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
@@ -195,6 +294,8 @@ _evas_event_source_mouse_down_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
195 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 294 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
196 Evas_Coord_Point canvas = ev->canvas; 295 Evas_Coord_Point canvas = ev->canvas;
197 Evas_Object_Protected_Data *child; 296 Evas_Object_Protected_Data *child;
297 Efl_Event_Pointer_Data *pedata = NULL;
298 Efl_Event_Pointer *pe = NULL;
198 Evas_Object *eo_child; 299 Evas_Object *eo_child;
199 Eina_List *l; 300 Eina_List *l;
200 int no_rep = 0; 301 int no_rep = 0;
@@ -253,24 +354,28 @@ _evas_event_source_mouse_down_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
253 _evas_event_havemap_adjust(eo_child, child, &ev->canvas.x, 354 _evas_event_havemap_adjust(eo_child, child, &ev->canvas.x,
254 &ev->canvas.y, 355 &ev->canvas.y,
255 child->mouse_grabbed); 356 child->mouse_grabbed);
256 evas_object_event_callback_call(eo_child, child, 357 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_DOWN, ev, event_id, pe);
257 EVAS_CALLBACK_MOUSE_DOWN, ev, event_id);
258 if (e->delete_me) break; 358 if (e->delete_me) break;
259 if (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN) 359 if (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)
260 break; 360 break;
261 } 361 }
262 eina_list_free(copy); 362 eina_list_free(copy);
263 ev->canvas = canvas; 363 ev->canvas = canvas;
364 EV_DEL(pe);
264} 365}
265 366
266static void 367static void
267_evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_Mouse_Move *ev, int event_id) 368_evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
369 Evas_Event_Mouse_Move *ev, int event_id,
370 Efl_Event_Pointer_Data *parent_pe)
268{ 371{
269 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); 372 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
270 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj); 373 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
271 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS); 374 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS);
272 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 375 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
273 Evas_Coord_Point canvas = ev->cur.canvas; 376 Evas_Coord_Point canvas = ev->cur.canvas;
377 Efl_Event_Pointer_Data *pedata = NULL;
378 Efl_Event_Pointer *pe = NULL;
274 379
275 if (obj->delete_me || src->delete_me || e->is_frozen) return; 380 if (obj->delete_me || src->delete_me || e->is_frozen) return;
276 381
@@ -302,9 +407,7 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
302 _evas_event_havemap_adjust(eo_child, child, &ev->cur.canvas.x, 407 _evas_event_havemap_adjust(eo_child, child, &ev->cur.canvas.x,
303 &ev->cur.canvas.y, 408 &ev->cur.canvas.y,
304 child->mouse_grabbed); 409 child->mouse_grabbed);
305 evas_object_event_callback_call(eo_child, child, 410 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, ev, event_id, pe);
306 EVAS_CALLBACK_MOUSE_MOVE,
307 ev, event_id);
308 } 411 }
309 else 412 else
310 outs = eina_list_append(outs, eo_child); 413 outs = eina_list_append(outs, eo_child);
@@ -312,6 +415,7 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
312 //FIXME: take care nograb object 415 //FIXME: take care nograb object
313 } 416 }
314 eina_list_free(copy); 417 eina_list_free(copy);
418 EV_RESET(pe);
315 419
316 while (outs) 420 while (outs)
317 { 421 {
@@ -332,9 +436,7 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
332 proxy_write->src_event_in = eina_list_remove(proxy_write->src_event_in, eo_child); 436 proxy_write->src_event_in = eina_list_remove(proxy_write->src_event_in, eo_child);
333 EINA_COW_WRITE_END(evas_object_proxy_cow, src->proxy, proxy_write); 437 EINA_COW_WRITE_END(evas_object_proxy_cow, src->proxy, proxy_write);
334 438
335 evas_object_event_callback_call(eo_child, child, 439 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_OUT, ev, event_id, pe);
336 EVAS_CALLBACK_MOUSE_OUT,
337 ev, event_id);
338 } 440 }
339 } 441 }
340 } 442 }
@@ -342,6 +444,7 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
342 { 444 {
343 Eina_List *ins = NULL; 445 Eina_List *ins = NULL;
344 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in); 446 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in);
447
345 if (src->is_smart) 448 if (src->is_smart)
346 { 449 {
347 int no_rep = 0; 450 int no_rep = 0;
@@ -372,9 +475,8 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
372 _evas_event_havemap_adjust(eo_child, child, &ev->cur.canvas.x, 475 _evas_event_havemap_adjust(eo_child, child, &ev->cur.canvas.x,
373 &ev->cur.canvas.y, 476 &ev->cur.canvas.y,
374 child->mouse_grabbed); 477 child->mouse_grabbed);
375 evas_object_event_callback_call(eo_child, child, 478 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, ev, event_id, pe);
376 EVAS_CALLBACK_MOUSE_MOVE, 479 EV_RESET(pe);
377 ev, event_id);
378 } 480 }
379 else if (child->mouse_in) 481 else if (child->mouse_in)
380 { 482 {
@@ -385,15 +487,16 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
385 &ev->cur.canvas.x, 487 &ev->cur.canvas.x,
386 &ev->cur.canvas.y, 488 &ev->cur.canvas.y,
387 child->mouse_grabbed); 489 child->mouse_grabbed);
388 evas_object_event_callback_call(eo_child, child, 490 // note: Mouse_Move and Mouse_Out are compatible (bad!)
389 EVAS_CALLBACK_MOUSE_OUT, 491 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_OUT, ev, event_id, pe);
390 ev, event_id); 492 EV_RESET(pe);
391 if (e->delete_me) break; 493 if (e->delete_me) break;
392 494
393 } 495 }
394 if (e->delete_me || e->is_frozen) break; 496 if (e->delete_me || e->is_frozen) break;
395 } 497 }
396 eina_list_free(copy); 498 eina_list_free(copy);
499
397 _evas_object_event_new(); 500 _evas_object_event_new();
398 int event_id2 = _evas_event_counter; 501 int event_id2 = _evas_event_counter;
399 EINA_LIST_FOREACH(ins, l, eo_child) 502 EINA_LIST_FOREACH(ins, l, eo_child)
@@ -410,13 +513,13 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
410 &ev->cur.canvas.x, 513 &ev->cur.canvas.x,
411 &ev->cur.canvas.y, 514 &ev->cur.canvas.y,
412 child->mouse_grabbed); 515 child->mouse_grabbed);
413 evas_object_event_callback_call(eo_child, child, 516 // note: Mouse_Move and Mouse_In are compatible (bad!)
414 EVAS_CALLBACK_MOUSE_IN, 517 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_IN, ev, event_id2, pe);
415 ev, event_id2);
416 if (e->delete_me) break; 518 if (e->delete_me) break;
417 } 519 }
418 } 520 }
419 } 521 }
522
420 if (e->pointer.mouse_grabbed == 0) 523 if (e->pointer.mouse_grabbed == 0)
421 { 524 {
422 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_write) 525 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_write)
@@ -432,22 +535,27 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event
432 } 535 }
433 } 536 }
434 ev->cur.canvas = canvas; 537 ev->cur.canvas = canvas;
538 EV_DEL(pe);
435} 539}
436 540
437static void 541static void
438_evas_event_source_mouse_up_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_Mouse_Up *ev, int event_id) 542_evas_event_source_mouse_up_events(Evas_Object *eo_obj, Evas *eo_e,
543 Evas_Event_Mouse_Up *ev, int event_id,
544 Efl_Event_Pointer_Data *parent_pe)
439{ 545{
440 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); 546 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
441 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj); 547 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
442 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS); 548 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS);
443 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 549 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
444 Evas_Coord_Point canvas = ev->canvas; 550 Evas_Coord_Point canvas = ev->canvas;
551 Efl_Event_Pointer_Data *pedata = NULL;
552 Efl_Event_Pointer *pe = NULL;
445 553
446 if (obj->delete_me || src->delete_me || e->is_frozen) return; 554 if (obj->delete_me || src->delete_me || e->is_frozen) return;
447 555
448 _transform_to_src_space(obj, src, &ev->canvas.x, &ev->canvas.y); 556 _transform_to_src_space(obj, src, &ev->canvas.x, &ev->canvas.y);
449 557
450 ev->event_src = eo_obj; 558 ev->event_src = eo_obj;
451 559
452 Eina_List *l; 560 Eina_List *l;
453 Evas_Object *eo_child; 561 Evas_Object *eo_child;
@@ -457,7 +565,7 @@ _evas_event_source_mouse_up_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_M
457 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in); 565 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in);
458 EINA_LIST_FOREACH(copy, l, eo_child) 566 EINA_LIST_FOREACH(copy, l, eo_child)
459 { 567 {
460 if (src->delete_me) return; 568 if (src->delete_me) break;
461 child = eo_data_scope_get(eo_child, EVAS_OBJECT_CLASS); 569 child = eo_data_scope_get(eo_child, EVAS_OBJECT_CLASS);
462 if (((child->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) || 570 if (((child->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) ||
463 (child->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)) || 571 (child->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)) ||
@@ -472,8 +580,7 @@ _evas_event_source_mouse_up_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_M
472 &ev->canvas.x, 580 &ev->canvas.x,
473 &ev->canvas.y, 581 &ev->canvas.y,
474 child->mouse_grabbed); 582 child->mouse_grabbed);
475 evas_object_event_callback_call(eo_child, child, 583 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_UP, ev, event_id, pe);
476 EVAS_CALLBACK_MOUSE_UP, ev, event_id);
477 if (e->delete_me) break; 584 if (e->delete_me) break;
478 if (obj->pointer_mode == 585 if (obj->pointer_mode ==
479 EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN) 586 EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)
@@ -485,6 +592,7 @@ _evas_event_source_mouse_up_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_M
485 eina_list_free(copy); 592 eina_list_free(copy);
486 593
487 ev->canvas = canvas; 594 ev->canvas = canvas;
595 EV_DEL(pe);
488} 596}
489 597
490static void 598static void
@@ -510,13 +618,17 @@ _evas_event_source_hold_events(Evas_Object *eo_obj, Evas *eo_e EINA_UNUSED, void
510} 618}
511 619
512static void 620static void
513_evas_event_source_wheel_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_Mouse_Wheel *ev, int event_id) 621_evas_event_source_wheel_events(Evas_Object *eo_obj, Evas *eo_e,
622 Evas_Event_Mouse_Wheel *ev, int event_id,
623 Efl_Event_Pointer_Data *parent_pe)
514{ 624{
515 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); 625 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
516 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj); 626 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
517 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS); 627 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EVAS_OBJECT_CLASS);
518 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 628 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
519 Evas_Coord_Point canvas = ev->canvas; 629 Evas_Coord_Point canvas = ev->canvas;
630 Efl_Event_Pointer_Data *pedata = NULL;
631 Efl_Event_Pointer *pe = NULL;
520 632
521 if (obj->delete_me || src->delete_me || obj->layer->evas->is_frozen) return; 633 if (obj->delete_me || src->delete_me || obj->layer->evas->is_frozen) return;
522 634
@@ -537,22 +649,26 @@ _evas_event_source_wheel_events(Evas_Object *eo_obj, Evas *eo_e, Evas_Event_Mous
537 &ev->canvas.x, 649 &ev->canvas.x,
538 &ev->canvas.y, 650 &ev->canvas.y,
539 child->mouse_grabbed); 651 child->mouse_grabbed);
540 evas_object_event_callback_call(eo_child, child, 652 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_WHEEL, ev, event_id, pe);
541 EVAS_CALLBACK_MOUSE_WHEEL, ev, event_id);
542 if (e->delete_me) break; 653 if (e->delete_me) break;
543 } 654 }