aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2020-05-02 12:15:39 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2020-05-02 18:28:06 +0200
commite262f93d0a93c52b72fa1e64c29021ef2784d5fb (patch)
treec7e091dae7181c289520b44f3984d9cd7854a8ca /sway/input
parentinput: refactor tablet motion into seatop handler (diff)
downloadsway-e262f93d0a93c52b72fa1e64c29021ef2784d5fb.tar.gz
sway-e262f93d0a93c52b72fa1e64c29021ef2784d5fb.tar.zst
sway-e262f93d0a93c52b72fa1e64c29021ef2784d5fb.zip
input: rename pointer handlers to be unambiguous
This commit renames `motion` and `axis` handlers to `pointer_motion` and `pointer_axis`, respectively, to disambiguate them from their tablet (and future touch) handlers. `button` is left as-is, as it is generic across input devices.
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c4
-rw-r--r--sway/input/seat.c15
-rw-r--r--sway/input/seatop_default.c20
-rw-r--r--sway/input/seatop_down.c8
-rw-r--r--sway/input/seatop_move_floating.c4
-rw-r--r--sway/input/seatop_move_tiling.c5
-rw-r--r--sway/input/seatop_resize_floating.c4
-rw-r--r--sway/input/seatop_resize_tiling.c4
8 files changed, 32 insertions, 32 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index b38b62c8..90ed3b5c 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -321,7 +321,7 @@ static void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
321 321
322 wlr_cursor_move(cursor->cursor, device, dx, dy); 322 wlr_cursor_move(cursor->cursor, device, dx, dy);
323 323
324 seatop_motion(cursor->seat, time_msec, dx, dy); 324 seatop_pointer_motion(cursor->seat, time_msec, dx, dy);
325} 325}
326 326
327static void handle_pointer_motion_relative( 327static void handle_pointer_motion_relative(
@@ -383,7 +383,7 @@ static void handle_pointer_button(struct wl_listener *listener, void *data) {
383 383
384void dispatch_cursor_axis(struct sway_cursor *cursor, 384void dispatch_cursor_axis(struct sway_cursor *cursor,
385 struct wlr_event_pointer_axis *event) { 385 struct wlr_event_pointer_axis *event) {
386 seatop_axis(cursor->seat, event); 386 seatop_pointer_axis(cursor->seat, event);
387} 387}
388 388
389static void handle_pointer_axis(struct wl_listener *listener, void *data) { 389static void handle_pointer_axis(struct wl_listener *listener, void *data) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 27751c27..4abffb25 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -1449,16 +1449,17 @@ void seatop_button(struct sway_seat *seat, uint32_t time_msec,
1449 } 1449 }
1450} 1450}
1451 1451
1452void seatop_motion(struct sway_seat *seat, uint32_t time_msec, 1452void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
1453 double dx, double dy) { 1453 double dx, double dy) {
1454 if (seat->seatop_impl->motion) { 1454 if (seat->seatop_impl->pointer_motion) {
1455 seat->seatop_impl->motion(seat, time_msec, dx, dy); 1455 seat->seatop_impl->pointer_motion(seat, time_msec, dx, dy);
1456 } 1456 }
1457} 1457}
1458 1458
1459void seatop_axis(struct sway_seat *seat, struct wlr_event_pointer_axis *event) { 1459void seatop_pointer_axis(struct sway_seat *seat,
1460 if (seat->seatop_impl->axis) { 1460 struct wlr_event_pointer_axis *event) {
1461 seat->seatop_impl->axis(seat, event); 1461 if (seat->seatop_impl->pointer_axis) {
1462 seat->seatop_impl->pointer_axis(seat, event);
1462 } 1463 }
1463} 1464}
1464 1465
@@ -1468,7 +1469,7 @@ void seatop_tablet_tool_motion(struct sway_seat *seat,
1468 if (seat->seatop_impl->tablet_tool_motion) { 1469 if (seat->seatop_impl->tablet_tool_motion) {
1469 seat->seatop_impl->tablet_tool_motion(seat, tablet, tool, time_msec, dx, dy); 1470 seat->seatop_impl->tablet_tool_motion(seat, tablet, tool, time_msec, dx, dy);
1470 } else { 1471 } else {
1471 seatop_motion(seat, time_msec, dx, dy); 1472 seatop_pointer_motion(seat, time_msec, dx, dy);
1472 } 1473 }
1473} 1474}
1474 1475
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index b7e3ff3f..e0838c04 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -405,9 +405,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
405 seat_pointer_notify_button(seat, time_msec, button, state); 405 seat_pointer_notify_button(seat, time_msec, button, state);
406} 406}
407 407
408/*----------------------------------\ 408/*------------------------------------------\
409 * Functions used by handle_motion / 409 * Functions used by handle_pointer_motion /
410 *--------------------------------*/ 410 *----------------------------------------*/
411 411
412static void check_focus_follows_mouse(struct sway_seat *seat, 412static void check_focus_follows_mouse(struct sway_seat *seat,
413 struct seatop_default_event *e, struct sway_node *hovered_node) { 413 struct seatop_default_event *e, struct sway_node *hovered_node) {
@@ -439,7 +439,7 @@ static void check_focus_follows_mouse(struct sway_seat *seat,
439 } 439 }
440} 440}
441 441
442static void handle_motion(struct sway_seat *seat, uint32_t time_msec, 442static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
443 double dx, double dy) { 443 double dx, double dy) {
444 struct seatop_default_event *e = seat->seatop_data; 444 struct seatop_default_event *e = seat->seatop_data;
445 struct sway_cursor *cursor = seat->cursor; 445 struct sway_cursor *cursor = seat->cursor;
@@ -510,9 +510,9 @@ static void handle_tablet_tool_motion(struct sway_seat *seat,
510 e->previous_node = node; 510 e->previous_node = node;
511} 511}
512 512
513/*--------------------------------\ 513/*----------------------------------------\
514 * Functions used by handle_axis / 514 * Functions used by handle_pointer_axis /
515 *------------------------------*/ 515 *--------------------------------------*/
516 516
517static uint32_t wl_axis_to_button(struct wlr_event_pointer_axis *event) { 517static uint32_t wl_axis_to_button(struct wlr_event_pointer_axis *event) {
518 switch (event->orientation) { 518 switch (event->orientation) {
@@ -526,7 +526,7 @@ static uint32_t wl_axis_to_button(struct wlr_event_pointer_axis *event) {
526 } 526 }
527} 527}
528 528
529static void handle_axis(struct sway_seat *seat, 529static void handle_pointer_axis(struct sway_seat *seat,
530 struct wlr_event_pointer_axis *event) { 530 struct wlr_event_pointer_axis *event) {
531 struct sway_input_device *input_device = 531 struct sway_input_device *input_device =
532 event->device ? event->device->data : NULL; 532 event->device ? event->device->data : NULL;
@@ -648,8 +648,8 @@ static void handle_rebase(struct sway_seat *seat, uint32_t time_msec) {
648 648
649static const struct sway_seatop_impl seatop_impl = { 649static const struct sway_seatop_impl seatop_impl = {
650 .button = handle_button, 650 .button = handle_button,
651 .motion = handle_motion, 651 .pointer_motion = handle_pointer_motion,
652 .axis = handle_axis, 652 .pointer_axis = handle_pointer_axis,
653 .tablet_tool_motion = handle_tablet_tool_motion, 653 .tablet_tool_motion = handle_tablet_tool_motion,
654 .rebase = handle_rebase, 654 .rebase = handle_rebase,
655 .allow_set_cursor = true, 655 .allow_set_cursor = true,
diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c
index 04de894d..358d5c59 100644
--- a/sway/input/seatop_down.c
+++ b/sway/input/seatop_down.c
@@ -12,7 +12,7 @@ struct seatop_down_event {
12 double ref_con_lx, ref_con_ly; // container's x/y at start of op 12 double ref_con_lx, ref_con_ly; // container's x/y at start of op
13}; 13};
14 14
15static void handle_axis(struct sway_seat *seat, 15static void handle_pointer_axis(struct sway_seat *seat,
16 struct wlr_event_pointer_axis *event) { 16 struct wlr_event_pointer_axis *event) {
17 struct sway_input_device *input_device = 17 struct sway_input_device *input_device =
18 event->device ? event->device->data : NULL; 18 event->device ? event->device->data : NULL;
@@ -36,7 +36,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
36 } 36 }
37} 37}
38 38
39static void handle_motion(struct sway_seat *seat, uint32_t time_msec, 39static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
40 double dx, double dy) { 40 double dx, double dy) {
41 struct seatop_down_event *e = seat->seatop_data; 41 struct seatop_down_event *e = seat->seatop_data;
42 struct sway_container *con = e->con; 42 struct sway_container *con = e->con;
@@ -57,9 +57,9 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
57} 57}
58 58
59static const struct sway_seatop_impl seatop_impl = { 59static const struct sway_seatop_impl seatop_impl = {
60 .axis = handle_axis,
61 .button = handle_button, 60 .button = handle_button,
62 .motion = handle_motion, 61 .pointer_motion = handle_pointer_motion,
62 .pointer_axis = handle_pointer_axis,
63 .unref = handle_unref, 63 .unref = handle_unref,
64 .allow_set_cursor = true, 64 .allow_set_cursor = true,
65}; 65};
diff --git a/sway/input/seatop_move_floating.c b/sway/input/seatop_move_floating.c
index 672e2d69..a04fd457 100644
--- a/sway/input/seatop_move_floating.c
+++ b/sway/input/seatop_move_floating.c
@@ -23,7 +23,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
23 } 23 }
24} 24}
25 25
26static void handle_motion(struct sway_seat *seat, uint32_t time_msec, 26static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
27 double dx, double dy) { 27 double dx, double dy) {
28 struct seatop_move_floating_event *e = seat->seatop_data; 28 struct seatop_move_floating_event *e = seat->seatop_data;
29 struct wlr_cursor *cursor = seat->cursor->cursor; 29 struct wlr_cursor *cursor = seat->cursor->cursor;
@@ -41,7 +41,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
41 41
42static const struct sway_seatop_impl seatop_impl = { 42static const struct sway_seatop_impl seatop_impl = {
43 .button = handle_button, 43 .button = handle_button,
44 .motion = handle_motion, 44 .pointer_motion = handle_pointer_motion,
45 .unref = handle_unref, 45 .unref = handle_unref,
46}; 46};
47 47
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c
index 4201ae37..3f31e4b1 100644
--- a/sway/input/seatop_move_tiling.c
+++ b/sway/input/seatop_move_tiling.c
@@ -206,7 +206,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
206 desktop_damage_box(&e->drop_box); 206 desktop_damage_box(&e->drop_box);
207} 207}
208 208
209static void handle_motion(struct sway_seat *seat, uint32_t time_msec, 209static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
210 double dx, double dy) { 210 double dx, double dy) {
211 struct seatop_move_tiling_event *e = seat->seatop_data; 211 struct seatop_move_tiling_event *e = seat->seatop_data;
212 if (e->threshold_reached) { 212 if (e->threshold_reached) {
@@ -251,7 +251,6 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
251 container_detach(con); 251 container_detach(con);
252 } 252 }
253 253
254
255 // Moving container into empty workspace 254 // Moving container into empty workspace
256 if (target_node->type == N_WORKSPACE && edge == WLR_EDGE_NONE) { 255 if (target_node->type == N_WORKSPACE && edge == WLR_EDGE_NONE) {
257 workspace_add_tiling(new_ws, con); 256 workspace_add_tiling(new_ws, con);
@@ -315,7 +314,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
315 314
316static const struct sway_seatop_impl seatop_impl = { 315static const struct sway_seatop_impl seatop_impl = {
317 .button = handle_button, 316 .button = handle_button,
318 .motion = handle_motion, 317 .pointer_motion = handle_pointer_motion,
319 .unref = handle_unref, 318 .unref = handle_unref,
320 .render = handle_render, 319 .render = handle_render,
321}; 320};
diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c
index 4e5db112..c9fa1e9b 100644
--- a/sway/input/seatop_resize_floating.c
+++ b/sway/input/seatop_resize_floating.c
@@ -25,7 +25,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
25 } 25 }
26} 26}
27 27
28static void handle_motion(struct sway_seat *seat, uint32_t time_msec, 28static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
29 double dx, double dy) { 29 double dx, double dy) {
30 struct seatop_resize_floating_event *e = seat->seatop_data; 30 struct seatop_resize_floating_event *e = seat->seatop_data;
31 struct sway_container *con = e->con; 31 struct sway_container *con = e->con;
@@ -131,7 +131,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
131 131
132static const struct sway_seatop_impl seatop_impl = { 132static const struct sway_seatop_impl seatop_impl = {
133 .button = handle_button, 133 .button = handle_button,
134 .motion = handle_motion, 134 .pointer_motion = handle_pointer_motion,
135 .unref = handle_unref, 135 .unref = handle_unref,
136}; 136};
137 137
diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c
index 020bba1b..825f5044 100644
--- a/sway/input/seatop_resize_tiling.c
+++ b/sway/input/seatop_resize_tiling.c
@@ -27,7 +27,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
27 } 27 }
28} 28}
29 29
30static void handle_motion(struct sway_seat *seat, uint32_t time_msec, 30static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
31 double dx, double dy) { 31 double dx, double dy) {
32 struct seatop_resize_tiling_event *e = seat->seatop_data; 32 struct seatop_resize_tiling_event *e = seat->seatop_data;
33 int amount_x = 0; 33 int amount_x = 0;
@@ -67,7 +67,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
67 67
68static const struct sway_seatop_impl seatop_impl = { 68static const struct sway_seatop_impl seatop_impl = {
69 .button = handle_button, 69 .button = handle_button,
70 .motion = handle_motion, 70 .pointer_motion = handle_pointer_motion,
71 .unref = handle_unref, 71 .unref = handle_unref,
72}; 72};
73 73