forked from enlightenment/efl
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>
This commit is contained in:
parent
28f725a687
commit
54cce990d3
|
@ -239,6 +239,19 @@ EAPI void elput_input_shutdown(Elput_Manager *manager);
|
|||
*/
|
||||
EAPI void elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, int *y);
|
||||
|
||||
/**
|
||||
* Set the pointer position on a given seat
|
||||
*
|
||||
* @param manager
|
||||
* @param seat
|
||||
* @param x
|
||||
* @param y
|
||||
*
|
||||
* @ingroup Elput_Input_Group
|
||||
* @since 1.18
|
||||
*/
|
||||
EAPI void elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int y);
|
||||
|
||||
/**
|
||||
* @defgroup Elput_Device_Group
|
||||
*
|
||||
|
|
|
@ -1325,6 +1325,12 @@ _evdev_touch_destroy(Elput_Touch *touch)
|
|||
free(touch);
|
||||
}
|
||||
|
||||
void
|
||||
_evdev_pointer_motion_send(Elput_Device *edev)
|
||||
{
|
||||
_pointer_motion_send(edev);
|
||||
}
|
||||
|
||||
Elput_Pointer *
|
||||
_evdev_pointer_get(Elput_Seat *seat)
|
||||
{
|
||||
|
|
|
@ -300,3 +300,37 @@ elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, int
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int y)
|
||||
{
|
||||
Elput_Seat *eseat;
|
||||
Elput_Device *edev;
|
||||
Eina_List *l, *ll;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(manager);
|
||||
|
||||
/* if no seat name is passed in, just use default seat name */
|
||||
if (!seat) seat = "seat0";
|
||||
|
||||
EINA_LIST_FOREACH(manager->input.seats, l, eseat)
|
||||
{
|
||||
if (!eseat->ptr) continue;
|
||||
if ((eseat->name) && (strcmp(eseat->name, seat)))
|
||||
continue;
|
||||
|
||||
eseat->ptr->x = x;
|
||||
eseat->ptr->y = y;
|
||||
eseat->ptr->timestamp = ecore_loop_time_get();
|
||||
|
||||
EINA_LIST_FOREACH(eseat->devices, ll, edev)
|
||||
{
|
||||
if (!libinput_device_has_capability(edev->device,
|
||||
LIBINPUT_DEVICE_CAP_POINTER))
|
||||
continue;
|
||||
|
||||
_evdev_pointer_motion_send(edev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,6 +240,7 @@ void _evdev_device_destroy(Elput_Device *edev);
|
|||
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);
|
||||
|
||||
Elput_Pointer *_evdev_pointer_get(Elput_Seat *seat);
|
||||
Elput_Keyboard *_evdev_keyboard_get(Elput_Seat *seat);
|
||||
|
|
Loading…
Reference in New Issue