summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-26 10:45:47 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-26 11:43:22 -0400
commit054a9c8182a7823b52a0a4381db155b8b4842cc6 (patch)
tree980d07309f1af9cc56f696cdfb4c97b0c4e51921
parentad58478b76d4e158e6f0c26b97577e8dc1dfbce5 (diff)
elput: Add API function to calibrate input devices
This adds an API function that can be called to calibrate input devices based on a given output size @feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
-rw-r--r--src/lib/elput/Elput.h12
-rw-r--r--src/lib/elput/elput_evdev.c2
-rw-r--r--src/lib/elput/elput_input.c35
-rw-r--r--src/lib/elput/elput_private.h4
4 files changed, 52 insertions, 1 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index ce3ad98217..8d3d6f6669 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -339,6 +339,18 @@ EAPI const Eina_List *elput_input_devices_get(Elput_Seat *seat);
339 */ 339 */
340EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh); 340EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh);
341 341
342/**
343 * Calibrate input devices for given screen size
344 *
345 * @param manager
346 * @param w
347 * @param h
348 *
349 * @ingroup Elput_Input_Group
350 * @since 1.18
351 */
352EAPI void elput_input_devices_calibrate(Elput_Manager *manager, int w, int h);
353
342# endif 354# endif
343 355
344# undef EAPI 356# undef EAPI
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 416c02f45d..82768d6b35 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -1120,7 +1120,7 @@ _touch_motion(struct libinput_device *idevice, struct libinput_event_touch *even
1120 _touch_motion_send(dev, event); 1120 _touch_motion_send(dev, event);
1121} 1121}
1122 1122
1123static void 1123void
1124_evdev_device_calibrate(Elput_Device *dev) 1124_evdev_device_calibrate(Elput_Device *dev)
1125{ 1125{
1126 float cal[6]; 1126 float cal[6];
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index 64431bb354..b427c38ed1 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -288,6 +288,14 @@ _elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED)
288 libinput_unref(manager->input.lib); 288 libinput_unref(manager->input.lib);
289 manager->input.lib = NULL; 289 manager->input.lib = NULL;
290 } 290 }
291
292 if ((manager->pending_ptr_x) || (manager->pending_ptr_y))
293 {
294 elput_input_pointer_xy_set(manager, NULL, manager->pending_ptr_x,
295 manager->pending_ptr_y);
296 manager->pending_ptr_x = 0;
297 manager->pending_ptr_y = 0;
298 }
291} 299}
292 300
293static void 301static void
@@ -398,6 +406,13 @@ elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int
398 /* if no seat name is passed in, just use default seat name */ 406 /* if no seat name is passed in, just use default seat name */
399 if (!seat) seat = "seat0"; 407 if (!seat) seat = "seat0";
400 408
409 if (eina_list_count(manager->input.seats) < 1)
410 {
411 manager->pending_ptr_x = x;
412 manager->pending_ptr_y = y;
413 return;
414 }
415
401 EINA_LIST_FOREACH(manager->input.seats, l, eseat) 416 EINA_LIST_FOREACH(manager->input.seats, l, eseat)
402 { 417 {
403 if (!eseat->ptr) continue; 418 if (!eseat->ptr) continue;
@@ -475,3 +490,23 @@ elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh)
475 manager->input.pointer_w = maxw; 490 manager->input.pointer_w = maxw;
476 manager->input.pointer_h = maxh; 491 manager->input.pointer_h = maxh;
477} 492}
493
494EAPI void
495elput_input_devices_calibrate(Elput_Manager *manager, int w, int h)
496{
497 Elput_Seat *eseat;
498 Elput_Device *edev;
499 Eina_List *l, *ll;
500
501 EINA_SAFETY_ON_NULL_RETURN(manager);
502
503 EINA_LIST_FOREACH(manager->input.seats, l, eseat)
504 {
505 EINA_LIST_FOREACH(eseat->devices, ll, edev)
506 {
507 edev->ow = w;
508 edev->oh = h;
509 _evdev_device_calibrate(edev);
510 }
511 }
512}
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 0e0edd1774..dc34f24099 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -232,6 +232,9 @@ struct _Elput_Manager
232 Ecore_Event_Handler *vt_hdlr; 232 Ecore_Event_Handler *vt_hdlr;
233 uint32_t window; 233 uint32_t window;
234 234
235 int pending_ptr_x;
236 int pending_ptr_y;
237
235 struct 238 struct
236 { 239 {
237 char *path; 240 char *path;
@@ -261,6 +264,7 @@ void _evdev_keyboard_destroy(Elput_Keyboard *kbd);
261void _evdev_pointer_destroy(Elput_Pointer *ptr); 264void _evdev_pointer_destroy(Elput_Pointer *ptr);
262void _evdev_touch_destroy(Elput_Touch *touch); 265void _evdev_touch_destroy(Elput_Touch *touch);
263void _evdev_pointer_motion_send(Elput_Device *edev); 266void _evdev_pointer_motion_send(Elput_Device *edev);
267void _evdev_device_calibrate(Elput_Device *dev);
264 268
265Elput_Pointer *_evdev_pointer_get(Elput_Seat *seat); 269Elput_Pointer *_evdev_pointer_get(Elput_Seat *seat);
266Elput_Keyboard *_evdev_keyboard_get(Elput_Seat *seat); 270Elput_Keyboard *_evdev_keyboard_get(Elput_Seat *seat);