forked from enlightenment/efl
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>
This commit is contained in:
parent
ad58478b76
commit
054a9c8182
|
@ -339,6 +339,18 @@ EAPI const Eina_List *elput_input_devices_get(Elput_Seat *seat);
|
|||
*/
|
||||
EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh);
|
||||
|
||||
/**
|
||||
* Calibrate input devices for given screen size
|
||||
*
|
||||
* @param manager
|
||||
* @param w
|
||||
* @param h
|
||||
*
|
||||
* @ingroup Elput_Input_Group
|
||||
* @since 1.18
|
||||
*/
|
||||
EAPI void elput_input_devices_calibrate(Elput_Manager *manager, int w, int h);
|
||||
|
||||
# endif
|
||||
|
||||
# undef EAPI
|
||||
|
|
|
@ -1120,7 +1120,7 @@ _touch_motion(struct libinput_device *idevice, struct libinput_event_touch *even
|
|||
_touch_motion_send(dev, event);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
_evdev_device_calibrate(Elput_Device *dev)
|
||||
{
|
||||
float cal[6];
|
||||
|
|
|
@ -288,6 +288,14 @@ _elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED)
|
|||
libinput_unref(manager->input.lib);
|
||||
manager->input.lib = NULL;
|
||||
}
|
||||
|
||||
if ((manager->pending_ptr_x) || (manager->pending_ptr_y))
|
||||
{
|
||||
elput_input_pointer_xy_set(manager, NULL, manager->pending_ptr_x,
|
||||
manager->pending_ptr_y);
|
||||
manager->pending_ptr_x = 0;
|
||||
manager->pending_ptr_y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -398,6 +406,13 @@ elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int
|
|||
/* if no seat name is passed in, just use default seat name */
|
||||
if (!seat) seat = "seat0";
|
||||
|
||||
if (eina_list_count(manager->input.seats) < 1)
|
||||
{
|
||||
manager->pending_ptr_x = x;
|
||||
manager->pending_ptr_y = y;
|
||||
return;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(manager->input.seats, l, eseat)
|
||||
{
|
||||
if (!eseat->ptr) continue;
|
||||
|
@ -475,3 +490,23 @@ elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh)
|
|||
manager->input.pointer_w = maxw;
|
||||
manager->input.pointer_h = maxh;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elput_input_devices_calibrate(Elput_Manager *manager, int w, int h)
|
||||
{
|
||||
Elput_Seat *eseat;
|
||||
Elput_Device *edev;
|
||||
Eina_List *l, *ll;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(manager);
|
||||
|
||||
EINA_LIST_FOREACH(manager->input.seats, l, eseat)
|
||||
{
|
||||
EINA_LIST_FOREACH(eseat->devices, ll, edev)
|
||||
{
|
||||
edev->ow = w;
|
||||
edev->oh = h;
|
||||
_evdev_device_calibrate(edev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,6 +232,9 @@ struct _Elput_Manager
|
|||
Ecore_Event_Handler *vt_hdlr;
|
||||
uint32_t window;
|
||||
|
||||
int pending_ptr_x;
|
||||
int pending_ptr_y;
|
||||
|
||||
struct
|
||||
{
|
||||
char *path;
|
||||
|
@ -261,6 +264,7 @@ void _evdev_keyboard_destroy(Elput_Keyboard *kbd);
|
|||
void _evdev_pointer_destroy(Elput_Pointer *ptr);
|
||||
void _evdev_touch_destroy(Elput_Touch *touch);
|
||||
void _evdev_pointer_motion_send(Elput_Device *edev);
|
||||
void _evdev_device_calibrate(Elput_Device *dev);
|
||||
|
||||
Elput_Pointer *_evdev_pointer_get(Elput_Seat *seat);
|
||||
Elput_Keyboard *_evdev_keyboard_get(Elput_Seat *seat);
|
||||
|
|
Loading…
Reference in New Issue