[PATCH weston 2/5] shell: simplify hit test in do_zoom()

Pekka Paalanen ppaalanen at gmail.com
Mon Jun 4 07:49:12 PDT 2012


pixman_region32_contains_point() takes ints, so do not convert to
double.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/shell.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 1ba0cfc..bfa1b29 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1660,11 +1660,13 @@ do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
 	struct weston_compositor *compositor = ws->compositor;
 	struct weston_output *output;
 	float maximum_level, increment;
+	int x, y;
+
+	x = wl_fixed_to_int(seat->pointer->x);
+	y = wl_fixed_to_int(seat->pointer->y);
 
 	wl_list_for_each(output, &compositor->output_list, link) {
-		if (pixman_region32_contains_point(&output->region,
-						   wl_fixed_to_double(seat->pointer->x),
-						   wl_fixed_to_double(seat->pointer->y),
+		if (pixman_region32_contains_point(&output->region, x, y,
 						   NULL)) {
 			if (key == KEY_PAGEUP)
 				increment = output->zoom.increment;
-- 
1.7.3.4



More information about the wayland-devel mailing list