efl: add getter for input device's seat

Since this code will be required in many use cases
of the multiseat feature, including examples.

Reviewers: iscaro, barbieri, cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4385
This commit is contained in:
Bruno Dilly 2016-11-08 19:12:28 -02:00
parent 0e0cac8577
commit 3a095c830a
2 changed files with 8 additions and 35 deletions

View File

@ -58,20 +58,6 @@ _disc_cb(void *data EINA_UNUSED, Ecore_Evas *ee EINA_UNUSED, const char *client_
printf("Client %s disconnected\n", client_host);
}
static Efl_Input_Device *
_get_seat(Efl_Input_Device *dev)
{
if (!dev)
return NULL;
while ((dev = efl_input_device_parent_get(dev)))
{
if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_CLASS_SEAT)
return dev;
}
return NULL;
}
static Eina_Bool
_keyboard_event(void *data EINA_UNUSED, int type, void *event)
{
@ -79,7 +65,7 @@ _keyboard_event(void *data EINA_UNUSED, int type, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The keyboard on seat '%s' %s the key '%s'\n", seat ?
efl_input_device_name_get(seat) : "default",
@ -96,7 +82,7 @@ _mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The mouse on seat '%s' is at X: %d Y:%d\n",
seat ? efl_input_device_name_get(seat) : "default", e->x, e->y);
@ -110,7 +96,7 @@ _mouse_button(void *data EINA_UNUSED, int type, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The mouse on seat '%s' %s the following button '%d'\n",
seat ? efl_input_device_name_get(seat) : "default",
@ -126,7 +112,7 @@ _mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The mouse on seat '%s' moved the wheel '%s'\n",
seat ? efl_input_device_name_get(seat) : "default",

View File

@ -9,19 +9,6 @@
#include <Ecore_Evas.h>
#include <Ecore_Input.h>
static Efl_Input_Device *
_get_seat(Efl_Input_Device *dev)
{
if (!dev) return NULL;
while ((dev = efl_input_device_parent_get(dev)))
{
if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_CLASS_SEAT)
return dev;
}
return NULL;
}
static Eina_Bool
_keyboard_event(void *data EINA_UNUSED, int type, void *event)
{
@ -29,7 +16,7 @@ _keyboard_event(void *data EINA_UNUSED, int type, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The keyboard on seat '%s' %s the key '%s'\n", seat ?
efl_input_device_name_get(seat) : "unknown",
@ -46,7 +33,7 @@ _mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The mouse on seat '%s' is at X: %d Y:%d\n",
seat ? efl_input_device_name_get(seat) : "unknown", e->x, e->y);
@ -60,7 +47,7 @@ _mouse_button(void *data EINA_UNUSED, int type, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The mouse on seat '%s' %s the following button '%d'\n",
seat ? efl_input_device_name_get(seat) : "unknown",
@ -76,7 +63,7 @@ _mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
Efl_Input_Device *seat = NULL;
if (e->dev)
seat = _get_seat(e->dev);
seat = efl_input_device_seat_get(e->dev);
printf("The mouse on seat '%s' moved the wheel '%s'\n",
seat ? efl_input_device_name_get(seat) : "unknown",