[PATCH libinput 05/14] evdev: move the lid switch process functions together

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 25 23:44:15 UTC 2017


Don't sprinkle them across the file

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c | 96 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 245d878..216dcc2 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1030,24 +1030,6 @@ fallback_process_absolute(struct fallback_dispatch *dispatch,
 	}
 }
 
-static void
-lid_switch_process_switch(struct lid_switch_dispatch *dispatch,
-			  struct evdev_device *device,
-			  struct input_event *e,
-			  uint64_t time)
-{
-	switch (e->code) {
-	case SW_LID:
-		dispatch->lid_is_closed = !!e->value;
-
-		switch_notify_toggle(&device->base,
-				     time,
-				     LIBINPUT_SWITCH_LID,
-				     dispatch->lid_is_closed);
-		break;
-	}
-}
-
 static inline bool
 fallback_any_button_down(struct fallback_dispatch *dispatch,
 		      struct evdev_device *device)
@@ -1151,27 +1133,6 @@ fallback_process(struct evdev_dispatch *evdev_dispatch,
 }
 
 static void
-lid_switch_process(struct evdev_dispatch *evdev_dispatch,
-		   struct evdev_device *device,
-		   struct input_event *event,
-		   uint64_t time)
-{
-	struct lid_switch_dispatch *dispatch =
-		(struct lid_switch_dispatch*)evdev_dispatch;
-
-	switch (event->type) {
-	case EV_SW:
-		lid_switch_process_switch(dispatch, device, event, time);
-		break;
-	case EV_SYN:
-		break;
-	default:
-		assert(0 && "Unknown event type");
-		break;
-	}
-}
-
-static void
 release_touches(struct fallback_dispatch *dispatch,
 		struct evdev_device *device,
 		uint64_t time)
@@ -1296,15 +1257,6 @@ fallback_destroy(struct evdev_dispatch *evdev_dispatch)
 	free(dispatch);
 }
 
-static void
-lid_switch_destroy(struct evdev_dispatch *evdev_dispatch)
-{
-	struct lid_switch_dispatch *dispatch =
-		(struct lid_switch_dispatch*)evdev_dispatch;
-
-	free(dispatch);
-}
-
 static int
 evdev_calibration_has_matrix(struct libinput_device *libinput_device)
 {
@@ -1359,6 +1311,54 @@ struct evdev_dispatch_interface fallback_interface = {
 	fallback_toggle_touch, /* toggle_touch */
 };
 
+static void
+lid_switch_process_switch(struct lid_switch_dispatch *dispatch,
+			  struct evdev_device *device,
+			  struct input_event *e,
+			  uint64_t time)
+{
+	switch (e->code) {
+	case SW_LID:
+		dispatch->lid_is_closed = !!e->value;
+
+		switch_notify_toggle(&device->base,
+				     time,
+				     LIBINPUT_SWITCH_LID,
+				     dispatch->lid_is_closed);
+		break;
+	}
+}
+
+static void
+lid_switch_process(struct evdev_dispatch *evdev_dispatch,
+		   struct evdev_device *device,
+		   struct input_event *event,
+		   uint64_t time)
+{
+	struct lid_switch_dispatch *dispatch =
+		(struct lid_switch_dispatch*)evdev_dispatch;
+
+	switch (event->type) {
+	case EV_SW:
+		lid_switch_process_switch(dispatch, device, event, time);
+		break;
+	case EV_SYN:
+		break;
+	default:
+		assert(0 && "Unknown event type");
+		break;
+	}
+}
+
+static void
+lid_switch_destroy(struct evdev_dispatch *evdev_dispatch)
+{
+	struct lid_switch_dispatch *dispatch =
+		(struct lid_switch_dispatch*)evdev_dispatch;
+
+	free(dispatch);
+}
+
 struct evdev_dispatch_interface lid_switch_interface = {
 	lid_switch_process,
 	NULL, /* suspend */
-- 
2.9.3



More information about the wayland-devel mailing list