aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/input/seat.h19
-rw-r--r--sway/input/cursor.c8
-rw-r--r--sway/input/seat.c8
3 files changed, 18 insertions, 17 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index fb03b609..c07db61c 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -35,6 +35,14 @@ struct sway_drag_icon {
35 struct wl_listener destroy; 35 struct wl_listener destroy;
36}; 36};
37 37
38enum sway_seat_operation {
39 OP_NONE,
40 OP_DOWN,
41 OP_MOVE,
42 OP_RESIZE_FLOATING,
43 OP_RESIZE_TILING,
44};
45
38struct sway_seat { 46struct sway_seat {
39 struct wlr_seat *wlr_seat; 47 struct wlr_seat *wlr_seat;
40 struct sway_cursor *cursor; 48 struct sway_cursor *cursor;
@@ -54,14 +62,7 @@ struct sway_seat {
54 double touch_x, touch_y; 62 double touch_x, touch_y;
55 63
56 // Operations (drag and resize) 64 // Operations (drag and resize)
57 enum { 65 enum sway_seat_operation operation;
58 OP_NONE,
59 OP_MOUSEDOWN,
60 OP_MOVE,
61 OP_RESIZE_FLOATING,
62 OP_RESIZE_TILING,
63 } operation;
64
65 struct sway_container *op_container; 66 struct sway_container *op_container;
66 enum wlr_edges op_resize_edge; 67 enum wlr_edges op_resize_edge;
67 uint32_t op_button; 68 uint32_t op_button;
@@ -158,7 +159,7 @@ bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
158 159
159void drag_icon_update_position(struct sway_drag_icon *icon); 160void drag_icon_update_position(struct sway_drag_icon *icon);
160 161
161void seat_begin_mousedown(struct sway_seat *seat, struct sway_container *con, 162void seat_begin_down(struct sway_seat *seat, struct sway_container *con,
162 uint32_t button, double sx, double sy); 163 uint32_t button, double sx, double sy);
163 164
164void seat_begin_move(struct sway_seat *seat, struct sway_container *con, 165void seat_begin_move(struct sway_seat *seat, struct sway_container *con,
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index bd0030f0..5a2743e3 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -215,7 +215,7 @@ static enum wlr_edges find_resize_edge(struct sway_container *cont,
215 return edge; 215 return edge;
216} 216}
217 217
218static void handle_mousedown_motion(struct sway_seat *seat, 218static void handle_down_motion(struct sway_seat *seat,
219 struct sway_cursor *cursor, uint32_t time_msec) { 219 struct sway_cursor *cursor, uint32_t time_msec) {
220 struct sway_container *con = seat->op_container; 220 struct sway_container *con = seat->op_container;
221 if (seat_is_input_allowed(seat, con->sway_view->surface)) { 221 if (seat_is_input_allowed(seat, con->sway_view->surface)) {
@@ -409,8 +409,8 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
409 409
410 if (seat->operation != OP_NONE) { 410 if (seat->operation != OP_NONE) {
411 switch (seat->operation) { 411 switch (seat->operation) {
412 case OP_MOUSEDOWN: 412 case OP_DOWN:
413 handle_mousedown_motion(seat, cursor, time_msec); 413 handle_down_motion(seat, cursor, time_msec);
414 break; 414 break;
415 case OP_MOVE: 415 case OP_MOVE:
416 handle_move_motion(seat, cursor); 416 handle_move_motion(seat, cursor);
@@ -762,7 +762,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
762 if (surface && cont && state == WLR_BUTTON_PRESSED) { 762 if (surface && cont && state == WLR_BUTTON_PRESSED) {
763 seat_set_focus(seat, cont); 763 seat_set_focus(seat, cont);
764 seat_pointer_notify_button(seat, time_msec, button, state); 764 seat_pointer_notify_button(seat, time_msec, button, state);
765 seat_begin_mousedown(seat, cont, button, sx, sy); 765 seat_begin_down(seat, cont, button, sx, sy);
766 return; 766 return;
767 } 767 }
768 768
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 045bf91a..cc7c28d8 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -954,9 +954,9 @@ struct seat_config *seat_get_config(struct sway_seat *seat) {
954 return NULL; 954 return NULL;
955} 955}
956 956
957void seat_begin_mousedown(struct sway_seat *seat, struct sway_container *con, 957void seat_begin_down(struct sway_seat *seat, struct sway_container *con,
958 uint32_t button, double sx, double sy) { 958 uint32_t button, double sx, double sy) {
959 seat->operation = OP_MOUSEDOWN; 959 seat->operation = OP_DOWN;
960 seat->op_container = con; 960 seat->op_container = con;
961 seat->op_button = button; 961 seat->op_button = button;
962 seat->op_ref_lx = seat->cursor->cursor->x; 962 seat->op_ref_lx = seat->cursor->cursor->x;
@@ -1018,7 +1018,7 @@ void seat_begin_resize_tiling(struct sway_seat *seat,
1018} 1018}
1019 1019
1020void seat_end_mouse_operation(struct sway_seat *seat) { 1020void seat_end_mouse_operation(struct sway_seat *seat) {
1021 int operation = seat->operation; 1021 enum sway_seat_operation operation = seat->operation;
1022 if (seat->operation == OP_MOVE) { 1022 if (seat->operation == OP_MOVE) {
1023 // We "move" the container to its own location so it discovers its 1023 // We "move" the container to its own location so it discovers its
1024 // output again. 1024 // output again.
@@ -1027,7 +1027,7 @@ void seat_end_mouse_operation(struct sway_seat *seat) {
1027 } 1027 }
1028 seat->operation = OP_NONE; 1028 seat->operation = OP_NONE;
1029 seat->op_container = NULL; 1029 seat->op_container = NULL;
1030 if (operation == OP_MOUSEDOWN) { 1030 if (operation == OP_DOWN) {
1031 // Set the cursor's previous coords to the x/y at the start of the 1031 // Set the cursor's previous coords to the x/y at the start of the
1032 // operation, so the container change will be detected if using 1032 // operation, so the container change will be detected if using
1033 // focus_follows_mouse and the cursor moved off the original container 1033 // focus_follows_mouse and the cursor moved off the original container