summaryrefslogtreecommitdiff
path: root/src/lib/elput
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-04 10:43:36 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-04 10:43:36 -0400
commit54cce990d3fbf607d166294f202b86778709bc7e (patch)
treea5899a497b86a7363a3c16dd50d5c77966d88452 /src/lib/elput
parent28f725a6875951c0500d22c5bca9a393d77507d7 (diff)
elput: Add API function to set pointer position on a given seat
Small patch to add an API function that can be used to set the current pointer position on a given seat name. This function (typically) will be used inside an Ecore_Evas to "pointer warp". @feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/elput')
-rw-r--r--src/lib/elput/Elput.h13
-rw-r--r--src/lib/elput/elput_evdev.c6
-rw-r--r--src/lib/elput/elput_input.c34
-rw-r--r--src/lib/elput/elput_private.h1
4 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index beee6775ed..f3fe16b127 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -240,6 +240,19 @@ EAPI void elput_input_shutdown(Elput_Manager *manager);
240EAPI void elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, int *y); 240EAPI void elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, int *y);
241 241
242/** 242/**
243 * Set the pointer position on a given seat
244 *
245 * @param manager
246 * @param seat
247 * @param x
248 * @param y
249 *
250 * @ingroup Elput_Input_Group
251 * @since 1.18
252 */
253EAPI void elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int y);
254
255/**
243 * @defgroup Elput_Device_Group 256 * @defgroup Elput_Device_Group
244 * 257 *
245 * Functions that deal with input devices. 258 * Functions that deal with input devices.
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 043e7b6064..392a25fc48 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -1325,6 +1325,12 @@ _evdev_touch_destroy(Elput_Touch *touch)
1325 free(touch); 1325 free(touch);
1326} 1326}
1327 1327
1328void
1329_evdev_pointer_motion_send(Elput_Device *edev)
1330{
1331 _pointer_motion_send(edev);
1332}
1333
1328Elput_Pointer * 1334Elput_Pointer *
1329_evdev_pointer_get(Elput_Seat *seat) 1335_evdev_pointer_get(Elput_Seat *seat)
1330{ 1336{
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index c6d22cbf14..d50b023b8a 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -300,3 +300,37 @@ elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, int
300 break; 300 break;
301 } 301 }
302} 302}
303
304EAPI void
305elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int y)
306{
307 Elput_Seat *eseat;
308 Elput_Device *edev;
309 Eina_List *l, *ll;
310
311 EINA_SAFETY_ON_NULL_RETURN(manager);
312
313 /* if no seat name is passed in, just use default seat name */
314 if (!seat) seat = "seat0";
315
316 EINA_LIST_FOREACH(manager->input.seats, l, eseat)
317 {
318 if (!eseat->ptr) continue;
319 if ((eseat->name) && (strcmp(eseat->name, seat)))
320 continue;
321
322 eseat->ptr->x = x;
323 eseat->ptr->y = y;
324 eseat->ptr->timestamp = ecore_loop_time_get();
325
326 EINA_LIST_FOREACH(eseat->devices, ll, edev)
327 {
328 if (!libinput_device_has_capability(edev->device,
329 LIBINPUT_DEVICE_CAP_POINTER))
330 continue;
331
332 _evdev_pointer_motion_send(edev);
333 break;
334 }
335 }
336}
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 3564161375..05ee0b1a37 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -240,6 +240,7 @@ void _evdev_device_destroy(Elput_Device *edev);
240void _evdev_keyboard_destroy(Elput_Keyboard *kbd); 240void _evdev_keyboard_destroy(Elput_Keyboard *kbd);
241void _evdev_pointer_destroy(Elput_Pointer *ptr); 241void _evdev_pointer_destroy(Elput_Pointer *ptr);
242void _evdev_touch_destroy(Elput_Touch *touch); 242void _evdev_touch_destroy(Elput_Touch *touch);
243void _evdev_pointer_motion_send(Elput_Device *edev);
243 244
244Elput_Pointer *_evdev_pointer_get(Elput_Seat *seat); 245Elput_Pointer *_evdev_pointer_get(Elput_Seat *seat);
245Elput_Keyboard *_evdev_keyboard_get(Elput_Seat *seat); 246Elput_Keyboard *_evdev_keyboard_get(Elput_Seat *seat);