forked from enlightenment/efl
evas: add evas_device_get_by_seat_id()
sometimes it may be more useful to find a device by its hw id @feature
This commit is contained in:
parent
771d8803dd
commit
d47197e65b
|
@ -1021,6 +1021,20 @@ EAPI const Eina_List *evas_device_list(Evas *e, const Evas_Device *dev);
|
|||
*/
|
||||
EAPI Evas_Device *evas_device_get(Evas *e, const char *name);
|
||||
|
||||
/**
|
||||
* Get a device by its seat id
|
||||
*
|
||||
* @param e The canvas to find the device on
|
||||
* @param id The seat id of the device.
|
||||
*
|
||||
* Gets the device with id @p id on Evas @p e list of devices.
|
||||
*
|
||||
* @return the device or NULL if no device with a matching id was found.
|
||||
*
|
||||
* @since 1.20
|
||||
*/
|
||||
EAPI Evas_Device *evas_device_get_by_seat_id(Evas *eo_e, unsigned int id);
|
||||
|
||||
/**
|
||||
* Set the name of a device as a string
|
||||
*
|
||||
|
|
|
@ -121,6 +121,29 @@ evas_device_get(Evas *eo_e, const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
EAPI Evas_Device *
|
||||
evas_device_get_by_seat_id(Evas *eo_e, unsigned int id)
|
||||
{
|
||||
unsigned int seat_id;
|
||||
Evas_Public_Data *e;
|
||||
Evas_Device *dev;
|
||||
Eina_List *l;
|
||||
|
||||
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
|
||||
|
||||
e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
|
||||
EINA_LIST_FOREACH(e->devices, l, dev)
|
||||
{
|
||||
seat_id = efl_input_device_seat_id_get(dev);
|
||||
|
||||
if (seat_id == id)
|
||||
return dev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI Evas_Device *
|
||||
evas_device_add(Evas *eo_e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue