commit 77ec52d
Michael Forney
·
2014-02-16 23:36:45 +0000 UTC
parent 9e121d6
pointer: Pass handler rather than pointer to handler callbacks
4 files changed,
+12,
-11
+3,
-3
1@@ -88,11 +88,11 @@ 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_handler * handler, 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+static struct swc_pointer_handler pointer_handler = {
12 .motion = &handle_motion
13 };
14
15@@ -756,7 +756,7 @@ static void perform_update(void * data)
16 compositor.updating = false;
17 }
18
19-bool handle_motion(struct swc_pointer * pointer, uint32_t time,
20+bool handle_motion(struct swc_pointer_handler * handler, uint32_t time,
21 wl_fixed_t fx, wl_fixed_t fy)
22 {
23 struct view * view;
+1,
-1
1@@ -30,7 +30,7 @@ struct swc_surface;
2
3 struct swc_compositor
4 {
5- const struct swc_pointer_handler * pointer_handler;
6+ struct swc_pointer_handler * pointer_handler;
7 };
8
9 bool swc_compositor_initialize();
+4,
-3
1@@ -325,7 +325,7 @@ void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
2 uint32_t button, uint32_t state)
3 {
4 if ((!pointer->handler || !pointer->handler->button
5- || !pointer->handler->button(pointer, time, button, state))
6+ || !pointer->handler->button(pointer->handler, time, button, state))
7 && pointer->focus.resource)
8 {
9 struct wl_client * client
10@@ -342,7 +342,7 @@ void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
11 uint32_t axis, wl_fixed_t amount)
12 {
13 if ((!pointer->handler || !pointer->handler->axis
14- || !pointer->handler->axis(pointer, time, axis, amount))
15+ || !pointer->handler->axis(pointer->handler, time, axis, amount))
16 && pointer->focus.resource)
17 {
18 wl_pointer_send_axis(pointer->focus.resource, time, axis, amount);
19@@ -355,7 +355,8 @@ void swc_pointer_handle_relative_motion
20 clip_position(pointer, pointer->x + dx, pointer->y + dy);
21
22 if ((!pointer->handler || !pointer->handler->motion
23- || !pointer->handler->motion(pointer, time, pointer->x, pointer->y))
24+ || !pointer->handler->motion(pointer->handler, time,
25+ pointer->x, pointer->y))
26 && pointer->focus.resource)
27 {
28 wl_fixed_t surface_x, surface_y;
+4,
-4
1@@ -35,11 +35,11 @@ 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_handler * handler, uint32_t time,
7 wl_fixed_t x, wl_fixed_t y);
8- bool (* button)(struct swc_pointer * pointer, uint32_t time,
9+ bool (* button)(struct swc_pointer_handler * handler, uint32_t time,
10 uint32_t button, uint32_t state);
11- bool (* axis)(struct swc_pointer * pointer, uint32_t time,
12+ bool (* axis)(struct swc_pointer_handler * handler, uint32_t time,
13 enum wl_pointer_axis axis, wl_fixed_t amount);
14 };
15
16@@ -65,7 +65,7 @@ struct swc_pointer
17 } hotspot;
18 } cursor;
19
20- const struct swc_pointer_handler * handler;
21+ struct swc_pointer_handler * handler;
22
23 wl_fixed_t x, y;
24 pixman_region32_t region;