summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-01-25 16:20:18 -0600
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-02-18 15:50:16 -0500
commitddc6962d775345ccb0eb4590486693efb3564075 (patch)
treef5679ecbde74256667077b0c607dea9ebe036144 /src/lib/ecore_drm
parent4e953ecc4d83dae0f4360e1cb413a2a878617603 (diff)
ecore_drm: Add pointer warping API
Adds a new API: ecore_drm_device_pointer_warp() which warps the pointer to the specified location. All libinput seats with pointers are warped.
Diffstat (limited to 'src/lib/ecore_drm')
-rw-r--r--src/lib/ecore_drm/Ecore_Drm.h14
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c24
-rw-r--r--src/lib/ecore_drm/ecore_drm_evdev.c8
-rw-r--r--src/lib/ecore_drm/ecore_drm_private.h1
4 files changed, 46 insertions, 1 deletions
diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h
index 8d2787b187..ca11e96855 100644
--- a/src/lib/ecore_drm/Ecore_Drm.h
+++ b/src/lib/ecore_drm/Ecore_Drm.h
@@ -836,6 +836,20 @@ EAPI void ecore_drm_output_gamma_set(Ecore_Drm_Output *output, uint16_t size, ui
836EAPI void ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y); 836EAPI void ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y);
837 837
838/** 838/**
839 * Warp the pointer position of Ecore_Drm_Device
840 *
841 * This function will set the pointer position of Ecore_Drm_Device
842 *
843 * @param dev The Ecore_Drm_Device to set pointer position for
844 * @param x The new x co-ordinate
845 * @param y The new y co-ordinate
846 *
847 * @ingroup Ecore_Drm_Device_Group
848 * @since 1.18
849 */
850EAPI void ecore_drm_device_pointer_warp(Ecore_Drm_Device *dev, int x, int y);
851
852/**
839 * Get the list of drm devices which are allocated. 853 * Get the list of drm devices which are allocated.
840 * 854 *
841 * @return Eina_List of drm devices, NULL otherwise 855 * @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 16a7843cd6..95117d2b9d 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -509,6 +509,30 @@ ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
509 } 509 }
510} 510}
511 511
512EAPI void
513ecore_drm_device_pointer_warp(Ecore_Drm_Device *dev, int x, int y)
514{
515 Ecore_Drm_Seat *seat;
516 Ecore_Drm_Evdev *edev;
517 Eina_List *l, *ll;
518
519 /* check for valid device */
520 EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
521 EINA_LIST_FOREACH(dev->seats, l, seat)
522 {
523 EINA_LIST_FOREACH(seat->devices, ll, edev)
524 {
525 if (!libinput_device_has_capability(edev->device,
526 LIBINPUT_DEVICE_CAP_POINTER))
527 continue;
528
529 seat->ptr.dx = seat->ptr.ix = x;
530 seat->ptr.dy = seat->ptr.iy = y;
531 _ecore_drm_pointer_motion_post(edev);
532 }
533 }
534}
535
512EAPI Eina_Bool 536EAPI Eina_Bool
513ecore_drm_device_software_setup(Ecore_Drm_Device *dev) 537ecore_drm_device_software_setup(Ecore_Drm_Device *dev)
514{ 538{
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c
index 35534f51ff..cf418f3442 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -399,7 +399,7 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve
399 ev->window = (Ecore_Window)input->dev->window; 399 ev->window = (Ecore_Window)input->dev->window;
400 ev->event_window = (Ecore_Window)input->dev->window; 400 ev->event_window = (Ecore_Window)input->dev->window;
401 ev->root_window = (Ecore_Window)input->dev->window; 401 ev->root_window = (Ecore_Window)input->dev->window;
402 ev->timestamp = libinput_event_pointer_get_time(event); 402 if (event) ev->timestamp = libinput_event_pointer_get_time(event);
403 ev->same_screen = 1; 403 ev->same_screen = 1;
404 404
405 _device_modifiers_update(edev); 405 _device_modifiers_update(edev);
@@ -424,6 +424,12 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve
424 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); 424 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
425} 425}
426 426
427void
428_ecore_drm_pointer_motion_post(Ecore_Drm_Evdev *edev)
429{
430 _device_pointer_motion(edev, NULL);
431}
432
427static void 433static void
428_device_handle_pointer_motion(struct libinput_device *device, struct libinput_event_pointer *event) 434_device_handle_pointer_motion(struct libinput_device *device, struct libinput_event_pointer *event)
429{ 435{
diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h
index b4b0fb244c..21ec098aa5 100644
--- a/src/lib/ecore_drm/ecore_drm_private.h
+++ b/src/lib/ecore_drm/ecore_drm_private.h
@@ -283,6 +283,7 @@ void _ecore_drm_tty_restore(Ecore_Drm_Device *dev);
283Ecore_Drm_Evdev *_ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, struct libinput_device *device); 283Ecore_Drm_Evdev *_ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, struct libinput_device *device);
284void _ecore_drm_evdev_device_destroy(Ecore_Drm_Evdev *evdev); 284void _ecore_drm_evdev_device_destroy(Ecore_Drm_Evdev *evdev);
285Eina_Bool _ecore_drm_evdev_event_process(struct libinput_event *event); 285Eina_Bool _ecore_drm_evdev_event_process(struct libinput_event *event);
286void _ecore_drm_pointer_motion_post(Ecore_Drm_Evdev *evdev);
286 287
287Ecore_Drm_Fb *_ecore_drm_fb_create(Ecore_Drm_Device *dev, int width, int height); 288Ecore_Drm_Fb *_ecore_drm_fb_create(Ecore_Drm_Device *dev, int width, int height);
288void _ecore_drm_fb_destroy(Ecore_Drm_Fb *fb); 289void _ecore_drm_fb_destroy(Ecore_Drm_Fb *fb);