From a45af4ad783f5be2c1aecbf3ab6fab735994d22b Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Tue, 22 Mar 2016 12:56:59 +0900 Subject: [PATCH] ecore_evas_drm: enable pointer warping origin: upstream https://git.enlightenment.org/core/efl.git/commit/?id=d53e1d6748f07f46e9c6abc791651cdc78c0bc86 https://git.enlightenment.org/core/efl.git/commit/?id=ddc6962d775345ccb0eb4590486693efb3564075 Signed-off-by: Duna Oh Change-Id: Ib387b2b0fe00221cbfc2ddfc40b2824e8504b837 --- src/lib/ecore_drm/Ecore_Drm.h | 14 +++++++++++++ src/lib/ecore_drm/ecore_drm_device.c | 24 ++++++++++++++++++++++ src/lib/ecore_drm/ecore_drm_evdev.c | 8 +++++++- src/lib/ecore_drm/ecore_drm_private.h | 1 + .../ecore_evas/engines/drm/ecore_evas_drm.c | 10 ++++++++- 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h index e04f9b2..a8dc02c 100755 --- a/src/lib/ecore_drm/Ecore_Drm.h +++ b/src/lib/ecore_drm/Ecore_Drm.h @@ -844,6 +844,20 @@ EAPI void ecore_drm_output_gamma_set(Ecore_Drm_Output *output, uint16_t size, ui EAPI void ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y); /** + * Warp the pointer position of Ecore_Drm_Device + * + * This function will set the pointer position of Ecore_Drm_Device + * + * @param dev The Ecore_Drm_Device to set pointer position for + * @param x The new x co-ordinate + * @param y The new y co-ordinate + * + * @ingroup Ecore_Drm_Device_Group + * @since 1.18 + */ +EAPI void ecore_drm_device_pointer_warp(Ecore_Drm_Device *dev, int x, int y); + +/** * Get the list of drm devices which are allocated. * * @return Eina_List of drm devices, NULL otherwise diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c index d0be573..48f8a68 100644 --- a/src/lib/ecore_drm/ecore_drm_device.c +++ b/src/lib/ecore_drm/ecore_drm_device.c @@ -623,6 +623,30 @@ ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y) } } +EAPI void +ecore_drm_device_pointer_warp(Ecore_Drm_Device *dev, int x, int y) +{ + Ecore_Drm_Seat *seat; + Ecore_Drm_Evdev *edev; + Eina_List *l, *ll; + + /* check for valid device */ + EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0)); + EINA_LIST_FOREACH(dev->seats, l, seat) + { + EINA_LIST_FOREACH(seat->devices, ll, edev) + { + if (!libinput_device_has_capability(edev->device, + LIBINPUT_DEVICE_CAP_POINTER)) + continue; + + seat->ptr.dx = seat->ptr.ix = x; + seat->ptr.dy = seat->ptr.iy = y; + _ecore_drm_pointer_motion_post(edev); + } + } +} + #ifdef HAVE_TDM EAPI Eina_Bool ecore_drm_device_software_setup(Ecore_Drm_Device *dev EINA_UNUSED) diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c index 3b1299c..aed7c5e 100644 --- a/src/lib/ecore_drm/ecore_drm_evdev.c +++ b/src/lib/ecore_drm/ecore_drm_evdev.c @@ -414,7 +414,7 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve ev->window = (Ecore_Window)input->dev->window; ev->event_window = (Ecore_Window)input->dev->window; ev->root_window = (Ecore_Window)input->dev->window; - ev->timestamp = libinput_event_pointer_get_time(event); + if (event) ev->timestamp = libinput_event_pointer_get_time(event); ev->same_screen = 1; _device_modifiers_update(edev); @@ -440,6 +440,12 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); } +void +_ecore_drm_pointer_motion_post(Ecore_Drm_Evdev *edev) +{ + _device_pointer_motion(edev, NULL); +} + static void _device_handle_pointer_motion(struct libinput_device *device, struct libinput_event_pointer *event) { diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h index adb0635..6b8eaba 100755 --- a/src/lib/ecore_drm/ecore_drm_private.h +++ b/src/lib/ecore_drm/ecore_drm_private.h @@ -325,6 +325,7 @@ void* _ecore_drm_display_output_hal_private_get(Ecore_Drm_Output *output); Ecore_Drm_Evdev *_ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, struct libinput_device *device); void _ecore_drm_evdev_device_destroy(Ecore_Drm_Evdev *evdev); Eina_Bool _ecore_drm_evdev_event_process(struct libinput_event *event); +void _ecore_drm_pointer_motion_post(Ecore_Drm_Evdev *evdev); Ecore_Drm_Fb *_ecore_drm_fb_create(Ecore_Drm_Device *dev, int width, int height); void _ecore_drm_fb_destroy(Ecore_Drm_Fb *fb); diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c index af86c44..508ddf3 100644 --- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c +++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c @@ -93,6 +93,7 @@ static int _ecore_evas_drm_render_updates_process(Ecore_Evas *ee, Eina_List *upd static void _ecore_evas_drm_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y, int *w, int *h); static void _ecore_evas_drm_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y); +Eina_Bool _ecore_evas_drm_pointer_warp(const Ecore_Evas *ee EINA_UNUSED, Evas_Coord x, Evas_Coord y); /* local variables */ static int _ecore_evas_init_count = 0; @@ -165,7 +166,7 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func = NULL, //void (*fn_msg_send) (Ecore_Evas *ee, int maj, int min, void *data, int size); _ecore_evas_drm_pointer_xy_get, - NULL, // pointer_warp + _ecore_evas_drm_pointer_warp, NULL, // wm_rot_preferred_rotation_set NULL, // wm_rot_available_rotations_set @@ -1149,6 +1150,13 @@ _ecore_evas_drm_pointer_xy_get(const Ecore_Evas *ee EINA_UNUSED, Evas_Coord *x, ecore_drm_device_pointer_xy_get(dev, x, y); } +Eina_Bool +_ecore_evas_drm_pointer_warp(const Ecore_Evas *ee EINA_UNUSED, Evas_Coord x, Evas_Coord y) +{ + ecore_drm_device_pointer_warp(dev, x, y); + return EINA_TRUE; +} + static Eina_Bool _ecore_evas_drm_module_init(void) { -- 2.7.4