[PATCH 5/9] evdev: record time inside evdev_input_device

Tiago Vignatti tiago.vignatti at intel.com
Mon Oct 24 07:42:18 PDT 2011


No functional changes.

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 compositor/evdev.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/compositor/evdev.c b/compositor/evdev.c
index 49897bf..3661236 100644
--- a/compositor/evdev.c
+++ b/compositor/evdev.c
@@ -47,13 +47,14 @@ struct evdev_input_device {
 	} calibration;
 
 	int is_touchpad, old_x_value, old_y_value, reset_x_value, reset_y_value;
+	uint32_t time;
 
 	uint32_t abs_queued;
 };
 
 static inline void
 evdev_process_key(struct evdev_input_device *device,
-                        struct input_event *e, int value, int time)
+                        struct input_event *e, int value)
 {
 	switch (e->code) {
 	case BTN_TOOL_PEN:
@@ -85,12 +86,12 @@ evdev_process_key(struct evdev_input_device *device,
 	case BTN_BACK:
 	case BTN_TASK:
 		notify_button(&device->master->base.input_device,
-			      time, e->code, value);
+			      device->time, e->code, value);
 		break;
 
 	default:
 		notify_key(&device->master->base.input_device,
-			   time, e->code, value);
+			   device->time, e->code, value);
 		break;
 	}
 }
@@ -169,7 +170,6 @@ evdev_input_device_data(int fd, uint32_t mask, void *data)
 	struct evdev_input_device *device = data;
 	struct input_event ev[8], *e, *end;
 	int len, value;
-	uint32_t time;
 
 	ec = (struct wlsc_compositor *)
 		device->master->base.input_device.compositor;
@@ -192,7 +192,7 @@ evdev_input_device_data(int fd, uint32_t mask, void *data)
 	for (e = ev; e < end; e++) {
 		/* Get the signed value, earlier kernels had this as unsigned */
 		value = e->value;
-		time = e->time.tv_sec * 1000 + e->time.tv_usec / 1000;
+		device->time = e->time.tv_sec * 1000 + e->time.tv_usec / 1000;
 
 		switch (e->type) {
 		case EV_REL:
@@ -208,15 +208,15 @@ evdev_input_device_data(int fd, uint32_t mask, void *data)
 		case EV_KEY:
 			if (value == 2)
 				break;
-			evdev_process_key(device, e, value, time);
+			evdev_process_key(device, e, value);
 		}
 	}
 
 	if (device->dx != 0 || device->dy != 0)
 		notify_motion(&device->master->base.input_device,
-			      time, device->x + device->dx, device->y + device->dy);
+			      device->time, device->x + device->dx, device->y + device->dy);
 	if (device->abs_queued)
-		notify_motion(&device->master->base.input_device, time,
+		notify_motion(&device->master->base.input_device, device->time,
 		              device->x, device->y);
 
 	device->abs_queued = 0;
-- 
1.7.5.4



More information about the wayland-devel mailing list