commit 9e121d6
Michael Forney
·
2014-02-16 23:31:59 +0000 UTC
parent 45e4f3a
pointer: Add x and y to motion handler callback
3 files changed,
+10,
-7
+7,
-5
1@@ -88,7 +88,8 @@ struct view
2 struct wl_list link;
3 };
4
5-static bool handle_motion(struct swc_pointer * pointer, uint32_t time);
6+static bool handle_motion(struct swc_pointer * pointer, uint32_t time,
7+ wl_fixed_t x, wl_fixed_t y);
8 static void perform_update(void * data);
9
10 static const struct swc_pointer_handler pointer_handler = {
11@@ -755,7 +756,8 @@ static void perform_update(void * data)
12 compositor.updating = false;
13 }
14
15-bool handle_motion(struct swc_pointer * pointer, uint32_t time)
16+bool handle_motion(struct swc_pointer * pointer, uint32_t time,
17+ wl_fixed_t fx, wl_fixed_t fy)
18 {
19 struct view * view;
20 struct swc_surface * surface = NULL;
21@@ -763,8 +765,8 @@ bool handle_motion(struct swc_pointer * pointer, uint32_t time)
22
23 wl_list_for_each(view, &compositor.views, link)
24 {
25- x = wl_fixed_to_int(pointer->x);
26- y = wl_fixed_to_int(pointer->y);
27+ x = wl_fixed_to_int(fx);
28+ y = wl_fixed_to_int(fy);
29
30 if (swc_rectangle_contains_point(&view->base.geometry, x, y)
31 && pixman_region32_contains_point(&view->surface->state.input,
32@@ -776,7 +778,7 @@ bool handle_motion(struct swc_pointer * pointer, uint32_t time)
33 }
34 }
35
36- swc_pointer_set_focus(pointer, surface);
37+ swc_pointer_set_focus(swc.seat->pointer, surface);
38
39 return false;
40 }
+1,
-1
1@@ -355,7 +355,7 @@ void swc_pointer_handle_relative_motion
2 clip_position(pointer, pointer->x + dx, pointer->y + dy);
3
4 if ((!pointer->handler || !pointer->handler->motion
5- || !pointer->handler->motion(pointer, time))
6+ || !pointer->handler->motion(pointer, time, pointer->x, pointer->y))
7 && pointer->focus.resource)
8 {
9 wl_fixed_t surface_x, surface_y;
+2,
-1
1@@ -35,7 +35,8 @@ struct swc_pointer;
2
3 struct swc_pointer_handler
4 {
5- bool (* motion)(struct swc_pointer * pointer, uint32_t time);
6+ bool (* motion)(struct swc_pointer * pointer, uint32_t time,
7+ wl_fixed_t x, wl_fixed_t y);
8 bool (* button)(struct swc_pointer * pointer, uint32_t time,
9 uint32_t button, uint32_t state);
10 bool (* axis)(struct swc_pointer * pointer, uint32_t time,