[PATCH weston 2/4] input: make a function for device removal

Derek Foreman derekf at osg.samsung.com
Tue May 5 13:01:52 PDT 2015


Break device_removed() out into its own function like device_added().

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 src/libinput-seat.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/libinput-seat.c b/src/libinput-seat.c
index 19116ec..410df0e 100644
--- a/src/libinput-seat.c
+++ b/src/libinput-seat.c
@@ -105,6 +105,14 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device)
 }
 
 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
 udev_seat_remove_devices(struct udev_seat *seat)
 {
 	struct evdev_device *device, *next;
@@ -132,7 +140,6 @@ udev_input_process_event(struct libinput_event *event)
 	struct libinput_device *libinput_device =
 		libinput_event_get_device(event);
 	struct udev_input *input = libinput_get_user_data(libinput);
-	struct evdev_device *device;
 	int handled = 1;
 
 	switch (libinput_event_get_type(event)) {
@@ -140,8 +147,7 @@ udev_input_process_event(struct libinput_event *event)
 		device_added(input, libinput_device);
 		break;
 	case LIBINPUT_EVENT_DEVICE_REMOVED:
-		device = libinput_device_get_user_data(libinput_device);
-		evdev_device_destroy(device);
+		device_removed(input, libinput_device);
 		break;
 	default:
 		handled = 0;
-- 
2.1.4



More information about the wayland-devel mailing list