forked from enlightenment/efl
elput: Add API function to get pointer position on a given seat
Small patch to add an API function that can be used to retrieve current pointer position on a given seat name. @feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This commit is contained in:
parent
6a237f3cca
commit
28f725a687
|
@ -226,6 +226,19 @@ EAPI Eina_Bool elput_input_init(Elput_Manager *manager, const char *seat);
|
|||
*/
|
||||
EAPI void elput_input_shutdown(Elput_Manager *manager);
|
||||
|
||||
/**
|
||||
* Get 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_get(Elput_Manager *manager, const char *seat, int *x, int *y);
|
||||
|
||||
/**
|
||||
* @defgroup Elput_Device_Group
|
||||
*
|
||||
|
|
|
@ -275,3 +275,28 @@ elput_input_shutdown(Elput_Manager *manager)
|
|||
|
||||
libinput_unref(manager->input.lib);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, int *y)
|
||||
{
|
||||
Elput_Seat *eseat;
|
||||
Eina_List *l;
|
||||
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
|
||||
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;
|
||||
if (x) *x = eseat->ptr->x;
|
||||
if (y) *y = eseat->ptr->y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue