input: make a function for device removal
Break device_removed() out into its own function like device_added(). Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
committed by
Bryce Harrington
parent
118a429504
commit
6b557a7047
+9
-3
@@ -99,6 +99,14 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device)
|
|||||||
weston_seat_repick(seat);
|
weston_seat_repick(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
device_removed(struct udev_input *input, struct libinput_device *libinput_device)
|
||||||
|
{
|
||||||
|
struct evdev_device *device;
|
||||||
|
device = libinput_device_get_user_data(libinput_device);
|
||||||
|
evdev_device_destroy(device);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
udev_seat_remove_devices(struct udev_seat *seat)
|
udev_seat_remove_devices(struct udev_seat *seat)
|
||||||
{
|
{
|
||||||
@@ -127,7 +135,6 @@ udev_input_process_event(struct libinput_event *event)
|
|||||||
struct libinput_device *libinput_device =
|
struct libinput_device *libinput_device =
|
||||||
libinput_event_get_device(event);
|
libinput_event_get_device(event);
|
||||||
struct udev_input *input = libinput_get_user_data(libinput);
|
struct udev_input *input = libinput_get_user_data(libinput);
|
||||||
struct evdev_device *device;
|
|
||||||
int handled = 1;
|
int handled = 1;
|
||||||
|
|
||||||
switch (libinput_event_get_type(event)) {
|
switch (libinput_event_get_type(event)) {
|
||||||
@@ -135,8 +142,7 @@ udev_input_process_event(struct libinput_event *event)
|
|||||||
device_added(input, libinput_device);
|
device_added(input, libinput_device);
|
||||||
break;
|
break;
|
||||||
case LIBINPUT_EVENT_DEVICE_REMOVED:
|
case LIBINPUT_EVENT_DEVICE_REMOVED:
|
||||||
device = libinput_device_get_user_data(libinput_device);
|
device_removed(input, libinput_device);
|
||||||
evdev_device_destroy(device);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
handled = 0;
|
handled = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user