forked from enlightenment/efl
elput: Change return of device_add/remove functions
Minor change on the return value of the device_add and device_remove functions so that we can avoid debug output for devices which we do not deal with. Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
7b83432539
commit
cee7ee3993
|
@ -163,7 +163,7 @@ _device_event_send(Elput_Device *edev, Elput_Device_Change_Type type)
|
||||||
ecore_event_add(ELPUT_EVENT_DEVICE_CHANGE, ev, _device_event_cb_free, NULL);
|
ecore_event_add(ELPUT_EVENT_DEVICE_CHANGE, ev, _device_event_cb_free, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_device_add(Elput_Manager *em, struct libinput_device *dev)
|
_device_add(Elput_Manager *em, struct libinput_device *dev)
|
||||||
{
|
{
|
||||||
Elput_Seat *eseat;
|
Elput_Seat *eseat;
|
||||||
|
@ -171,10 +171,10 @@ _device_add(Elput_Manager *em, struct libinput_device *dev)
|
||||||
const char *oname;
|
const char *oname;
|
||||||
|
|
||||||
eseat = _udev_seat_get(em, dev);
|
eseat = _udev_seat_get(em, dev);
|
||||||
if (!eseat) return;
|
if (!eseat) return EINA_FALSE;
|
||||||
|
|
||||||
edev = _evdev_device_create(eseat, dev);
|
edev = _evdev_device_create(eseat, dev);
|
||||||
if (!edev) return;
|
if (!edev) return EINA_FALSE;
|
||||||
|
|
||||||
if (edev->caps & EVDEV_SEAT_KEYBOARD)
|
if (edev->caps & EVDEV_SEAT_KEYBOARD)
|
||||||
DBG("\tDevice added as Keyboard device");
|
DBG("\tDevice added as Keyboard device");
|
||||||
|
@ -189,17 +189,21 @@ _device_add(Elput_Manager *em, struct libinput_device *dev)
|
||||||
eseat->devices = eina_list_append(eseat->devices, edev);
|
eseat->devices = eina_list_append(eseat->devices, edev);
|
||||||
|
|
||||||
_device_event_send(edev, ELPUT_DEVICE_ADDED);
|
_device_event_send(edev, ELPUT_DEVICE_ADDED);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_device_remove(Elput_Manager *em EINA_UNUSED, struct libinput_device *device)
|
_device_remove(Elput_Manager *em EINA_UNUSED, struct libinput_device *device)
|
||||||
{
|
{
|
||||||
Elput_Device *edev;
|
Elput_Device *edev;
|
||||||
|
|
||||||
edev = libinput_device_get_user_data(device);
|
edev = libinput_device_get_user_data(device);
|
||||||
if (!edev) return;
|
if (!edev) return EINA_FALSE;
|
||||||
|
|
||||||
_device_event_send(edev, ELPUT_DEVICE_REMOVED);
|
_device_event_send(edev, ELPUT_DEVICE_REMOVED);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -217,12 +221,12 @@ _udev_process_event(struct libinput_event *event)
|
||||||
switch (libinput_event_get_type(event))
|
switch (libinput_event_get_type(event))
|
||||||
{
|
{
|
||||||
case LIBINPUT_EVENT_DEVICE_ADDED:
|
case LIBINPUT_EVENT_DEVICE_ADDED:
|
||||||
DBG("Input Device Added: %s", libinput_device_get_name(dev));
|
if (_device_add(em, dev))
|
||||||
_device_add(em, dev);
|
DBG("Input Device Added: %s", libinput_device_get_name(dev));
|
||||||
break;
|
break;
|
||||||
case LIBINPUT_EVENT_DEVICE_REMOVED:
|
case LIBINPUT_EVENT_DEVICE_REMOVED:
|
||||||
DBG("Input Device Removed: %s", libinput_device_get_name(dev));
|
if (_device_remove(em, dev))
|
||||||
_device_remove(em, dev);
|
DBG("Input Device Removed: %s", libinput_device_get_name(dev));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
Loading…
Reference in New Issue