commit ca7a99c

Michael Forney  ·  2016-12-30 04:23:18 +0000 UTC
parent ee0825d
evdev_device: Remove one unnecessary struct level
2 files changed,  +20, -23
+11, -12
 1@@ -72,12 +72,12 @@ handle_rel_event(struct evdev_device *device, struct input_event *ev)
 2 
 3 	switch (ev->code) {
 4 	case REL_X:
 5-		device->motion.rel.dx += ev->value;
 6-		device->motion.rel.pending = true;
 7+		device->rel.dx += ev->value;
 8+		device->rel.pending = true;
 9 		return;
10 	case REL_Y:
11-		device->motion.rel.dy += ev->value;
12-		device->motion.rel.pending = true;
13+		device->rel.dy += ev->value;
14+		device->rel.pending = true;
15 		return;
16 	case REL_WHEEL:
17 		axis = WL_POINTER_AXIS_VERTICAL_SCROLL;
18@@ -115,15 +115,14 @@ is_motion_event(struct input_event *ev)
19 static void
20 handle_motion_events(struct evdev_device *device, uint32_t time)
21 {
22-	if (device->motion.rel.pending) {
23-		wl_fixed_t dx = wl_fixed_from_int(device->motion.rel.dx);
24-		wl_fixed_t dy = wl_fixed_from_int(device->motion.rel.dy);
25+	if (device->rel.pending) {
26+		wl_fixed_t dx = wl_fixed_from_int(device->rel.dx);
27+		wl_fixed_t dy = wl_fixed_from_int(device->rel.dy);
28 
29 		device->handler->relative_motion(time, dx, dy);
30-
31-		device->motion.rel.pending = false;
32-		device->motion.rel.dx = 0;
33-		device->motion.rel.dy = 0;
34+		device->rel.pending = false;
35+		device->rel.dx = 0;
36+		device->rel.dy = 0;
37 	}
38 }
39 
40@@ -222,7 +221,7 @@ evdev_device_new(const char *path, const struct evdev_device_handler *handler)
41 	device->needs_sync = false;
42 	device->handler = handler;
43 	device->capabilities = 0;
44-	memset(&device->motion, 0, sizeof device->motion);
45+	memset(&device->rel, 0, sizeof(device->rel));
46 
47 	if (libevdev_has_event_code(device->dev, EV_KEY, KEY_ENTER)) {
48 		device->capabilities |= WL_SEAT_CAPABILITY_KEYBOARD;
+9, -11
 1@@ -52,19 +52,17 @@ struct evdev_device {
 2 
 3 	struct {
 4 		struct {
 5-			struct {
 6-				struct input_absinfo x, y;
 7-			} info;
 8+			struct input_absinfo x, y;
 9+		} info;
10 
11-			int32_t x, y;
12-			bool pending;
13-		} abs;
14+		int32_t x, y;
15+		bool pending;
16+	} abs;
17 
18-		struct {
19-			int32_t dx, dy;
20-			bool pending;
21-		} rel;
22-	} motion;
23+	struct {
24+		int32_t dx, dy;
25+		bool pending;
26+	} rel;
27 
28 	uint32_t capabilities;
29