commit 70922f9
Michael Forney
·
2023-07-01 20:51:45 +0000 UTC
parent d730855
pointer: Match handler struct function order
1 files changed,
+10,
-10
+10,
-10
1@@ -173,21 +173,24 @@ pointer_set_cursor(struct pointer *pointer, uint32_t id)
2 }
3
4 static bool
5-client_handle_button(struct pointer_handler *handler, uint32_t time, struct button *button, uint32_t state)
6+client_handle_motion(struct pointer_handler *handler, uint32_t time, wl_fixed_t x, wl_fixed_t y)
7 {
8 struct pointer *pointer = wl_container_of(handler, pointer, client_handler);
9 struct wl_resource *resource;
10+ wl_fixed_t sx, sy;
11
12 if (wl_list_empty(&pointer->focus.active))
13 return false;
14
15+ sx = x - wl_fixed_from_int(pointer->focus.view->base.geometry.x);
16+ sy = y - wl_fixed_from_int(pointer->focus.view->base.geometry.y);
17 wl_resource_for_each (resource, &pointer->focus.active)
18- wl_pointer_send_button(resource, button->press.serial, time, button->press.value, state);
19+ wl_pointer_send_motion(resource, time, sx, sy);
20 return true;
21 }
22
23 static bool
24-client_handle_axis(struct pointer_handler *handler, uint32_t time, uint32_t axis, wl_fixed_t amount)
25+client_handle_button(struct pointer_handler *handler, uint32_t time, struct button *button, uint32_t state)
26 {
27 struct pointer *pointer = wl_container_of(handler, pointer, client_handler);
28 struct wl_resource *resource;
29@@ -196,24 +199,21 @@ client_handle_axis(struct pointer_handler *handler, uint32_t time, uint32_t axis
30 return false;
31
32 wl_resource_for_each (resource, &pointer->focus.active)
33- wl_pointer_send_axis(resource, time, axis, amount);
34+ wl_pointer_send_button(resource, button->press.serial, time, button->press.value, state);
35 return true;
36 }
37
38 static bool
39-client_handle_motion(struct pointer_handler *handler, uint32_t time, wl_fixed_t x, wl_fixed_t y)
40+client_handle_axis(struct pointer_handler *handler, uint32_t time, uint32_t axis, wl_fixed_t amount)
41 {
42 struct pointer *pointer = wl_container_of(handler, pointer, client_handler);
43 struct wl_resource *resource;
44- wl_fixed_t sx, sy;
45
46 if (wl_list_empty(&pointer->focus.active))
47 return false;
48
49- sx = x - wl_fixed_from_int(pointer->focus.view->base.geometry.x);
50- sy = y - wl_fixed_from_int(pointer->focus.view->base.geometry.y);
51 wl_resource_for_each (resource, &pointer->focus.active)
52- wl_pointer_send_motion(resource, time, sx, sy);
53+ wl_pointer_send_axis(resource, time, axis, amount);
54 return true;
55 }
56
57@@ -229,9 +229,9 @@ pointer_initialize(struct pointer *pointer)
58 pointer->y = wl_fixed_from_int(geom->y + geom->height / 2);
59 pointer->focus_handler.enter = enter;
60 pointer->focus_handler.leave = leave;
61+ pointer->client_handler.motion = client_handle_motion;
62 pointer->client_handler.button = client_handle_button;
63 pointer->client_handler.axis = client_handle_axis;
64- pointer->client_handler.motion = client_handle_motion;
65 wl_list_init(&pointer->handlers);
66 wl_list_insert(&pointer->handlers, &pointer->client_handler.link);
67 wl_array_init(&pointer->buttons);