[PATCH 2/3] evdev: use last output from compositor to get the screen geometries

Tiago Vignatti tiago.vignatti at intel.com
Thu Sep 1 09:00:04 PDT 2011


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

diff --git a/compositor/evdev.c b/compositor/evdev.c
index edb6575..662a61c 100644
--- a/compositor/evdev.c
+++ b/compositor/evdev.c
@@ -87,11 +87,12 @@ evdev_process_key(struct evdev_input_device *device,
 static inline void
 evdev_process_absolute_motion(struct evdev_input_device *device,
 			struct input_event *e, int value, int *x, int *y,
-			int *absolute_event)
+			int *absolute_event, struct wlsc_compositor *ec)
 {
-	/* FIXME: Obviously we need to not hardcode these here, but
-	 * instead get the values from the output it's associated with. */
-	const int screen_width = 1024, screen_height = 600;
+	const int screen_width = container_of(ec->output_list.prev,
+			struct wlsc_output, link)->current->width;
+	const int screen_height = container_of(ec->output_list.prev,
+			struct wlsc_output, link)->current->height;
 
 	switch (e->code) {
 	case ABS_X:
@@ -197,7 +198,7 @@ evdev_input_device_data(int fd, uint32_t mask, void *data)
 					e, value, &dx, &dy);
 			else
 				evdev_process_absolute_motion(device, e, value,
-					&x, &y, &absolute_event);
+					&x, &y, &absolute_event, ec);
 			break;
 		case EV_KEY:
 			if (value == 2)
-- 
1.7.2.2



More information about the wayland-devel mailing list