aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index eb6d2dac..6d9e85dc 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -942,14 +942,14 @@ void seat_begin_move(struct sway_seat *seat, struct sway_container *con,
942 cursor_set_image(seat->cursor, "grab", NULL); 942 cursor_set_image(seat->cursor, "grab", NULL);
943} 943}
944 944
945void seat_begin_resize(struct sway_seat *seat, struct sway_container *con, 945void seat_begin_resize_floating(struct sway_seat *seat,
946 uint32_t button, enum wlr_edges edge) { 946 struct sway_container *con, uint32_t button, enum wlr_edges edge) {
947 if (!seat->cursor) { 947 if (!seat->cursor) {
948 wlr_log(WLR_DEBUG, "Ignoring resize request due to no cursor device"); 948 wlr_log(WLR_DEBUG, "Ignoring resize request due to no cursor device");
949 return; 949 return;
950 } 950 }
951 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); 951 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
952 seat->operation = OP_RESIZE; 952 seat->operation = OP_RESIZE_FLOATING;
953 seat->op_container = con; 953 seat->op_container = con;
954 seat->op_resize_preserve_ratio = keyboard && 954 seat->op_resize_preserve_ratio = keyboard &&
955 (wlr_keyboard_get_modifiers(keyboard) & WLR_MODIFIER_SHIFT); 955 (wlr_keyboard_get_modifiers(keyboard) & WLR_MODIFIER_SHIFT);
@@ -968,20 +968,29 @@ void seat_begin_resize(struct sway_seat *seat, struct sway_container *con,
968 cursor_set_image(seat->cursor, image, NULL); 968 cursor_set_image(seat->cursor, image, NULL);
969} 969}
970 970
971void seat_begin_resize_tiling(struct sway_seat *seat,
972 struct sway_container *con, uint32_t button, enum wlr_edges edge) {
973 seat->operation = OP_RESIZE_TILING;
974 seat->op_container = con;
975 seat->op_resize_edge = edge;
976 seat->op_button = button;
977 seat->op_ref_lx = seat->cursor->cursor->x;
978 seat->op_ref_ly = seat->cursor->cursor->y;
979 seat->op_ref_con_lx = con->x;
980 seat->op_ref_con_ly = con->y;
981 seat->op_ref_width = con->width;
982 seat->op_ref_height = con->height;
983
984 const char *image = wlr_xcursor_get_resize_name(edge);
985 cursor_set_image(seat->cursor, image, NULL);
986}
987
971void seat_end_mouse_operation(struct sway_seat *seat) { 988void seat_end_mouse_operation(struct sway_seat *seat) {
972 switch (seat->operation) { 989 if (seat->operation == OP_MOVE) {
973 case OP_MOVE: 990 // We "move" the container to its own location so it discovers its
974 { 991 // output again.
975 // We "move" the container to its own location so it discovers its 992 struct sway_container *con = seat->op_container;
976 // output again. 993 container_floating_move_to(con, con->x, con->y);
977 struct sway_container *con = seat->op_container;
978 container_floating_move_to(con, con->x, con->y);
979 }
980 case OP_RESIZE:
981 // Don't need to do anything here.
982 break;
983 case OP_NONE:
984 break;
985 } 994 }
986 seat->operation = OP_NONE; 995 seat->operation = OP_NONE;
987 seat->op_container = NULL; 996 seat->op_container = NULL;