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:
Chris Michael 2016-05-04 10:20:04 -04:00
parent 6a237f3cca
commit 28f725a687
2 changed files with 38 additions and 0 deletions

View File

@ -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
*

View File

@ -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;
}
}