aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_resize_tiling.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seatop_resize_tiling.c')
-rw-r--r--sway/input/seatop_resize_tiling.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c
index 2cca805d..15fd333b 100644
--- a/sway/input/seatop_resize_tiling.c
+++ b/sway/input/seatop_resize_tiling.c
@@ -1,7 +1,7 @@
1#define _POSIX_C_SOURCE 200809L
2#include <wlr/types/wlr_cursor.h> 1#include <wlr/types/wlr_cursor.h>
3#include <wlr/util/edges.h> 2#include <wlr/util/edges.h>
4#include "sway/commands.h" 3#include "sway/commands.h"
4#include "sway/desktop/transaction.h"
5#include "sway/input/cursor.h" 5#include "sway/input/cursor.h"
6#include "sway/input/seat.h" 6#include "sway/input/seat.h"
7#include "sway/tree/arrange.h" 7#include "sway/tree/arrange.h"
@@ -45,28 +45,29 @@ static struct sway_container *container_get_resize_sibling(
45 45
46static void handle_button(struct sway_seat *seat, uint32_t time_msec, 46static void handle_button(struct sway_seat *seat, uint32_t time_msec,
47 struct wlr_input_device *device, uint32_t button, 47 struct wlr_input_device *device, uint32_t button,
48 enum wlr_button_state state) { 48 enum wl_pointer_button_state state) {
49 struct seatop_resize_tiling_event *e = seat->seatop_data; 49 struct seatop_resize_tiling_event *e = seat->seatop_data;
50 50
51 if (seat->cursor->pressed_button_count == 0) { 51 if (seat->cursor->pressed_button_count == 0) {
52 if (e->h_con) { 52 if (e->h_con) {
53 container_set_resizing(e->h_con, false); 53 container_set_resizing(e->h_con, false);
54 container_set_resizing(e->h_sib, false); 54 container_set_resizing(e->h_sib, false);
55 if (e->h_con->parent) { 55 if (e->h_con->pending.parent) {
56 arrange_container(e->h_con->parent); 56 arrange_container(e->h_con->pending.parent);
57 } else { 57 } else {
58 arrange_workspace(e->h_con->workspace); 58 arrange_workspace(e->h_con->pending.workspace);
59 } 59 }
60 } 60 }
61 if (e->v_con) { 61 if (e->v_con) {
62 container_set_resizing(e->v_con, false); 62 container_set_resizing(e->v_con, false);
63 container_set_resizing(e->v_sib, false); 63 container_set_resizing(e->v_sib, false);
64 if (e->v_con->parent) { 64 if (e->v_con->pending.parent) {
65 arrange_container(e->v_con->parent); 65 arrange_container(e->v_con->pending.parent);
66 } else { 66 } else {
67 arrange_workspace(e->v_con->workspace); 67 arrange_workspace(e->v_con->pending.workspace);
68 } 68 }
69 } 69 }
70 transaction_commit_dirty();
70 seatop_begin_default(seat); 71 seatop_begin_default(seat);
71 } 72 }
72} 73}
@@ -80,16 +81,16 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) {
80 81
81 if (e->h_con) { 82 if (e->h_con) {
82 if (e->edge & WLR_EDGE_LEFT) { 83 if (e->edge & WLR_EDGE_LEFT) {
83 amount_x = (e->h_con_orig_width - moved_x) - e->h_con->width; 84 amount_x = (e->h_con_orig_width - moved_x) - e->h_con->pending.width;
84 } else if (e->edge & WLR_EDGE_RIGHT) { 85 } else if (e->edge & WLR_EDGE_RIGHT) {
85 amount_x = (e->h_con_orig_width + moved_x) - e->h_con->width; 86 amount_x = (e->h_con_orig_width + moved_x) - e->h_con->pending.width;
86 } 87 }
87 } 88 }
88 if (e->v_con) { 89 if (e->v_con) {
89 if (e->edge & WLR_EDGE_TOP) { 90 if (e->edge & WLR_EDGE_TOP) {
90 amount_y = (e->v_con_orig_height - moved_y) - e->v_con->height; 91 amount_y = (e->v_con_orig_height - moved_y) - e->v_con->pending.height;
91 } else if (e->edge & WLR_EDGE_BOTTOM) { 92 } else if (e->edge & WLR_EDGE_BOTTOM) {
92 amount_y = (e->v_con_orig_height + moved_y) - e->v_con->height; 93 amount_y = (e->v_con_orig_height + moved_y) - e->v_con->pending.height;
93 } 94 }
94 } 95 }
95 96
@@ -99,6 +100,7 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) {
99 if (amount_y != 0) { 100 if (amount_y != 0) {
100 container_resize_tiled(e->v_con, e->edge_y, amount_y); 101 container_resize_tiled(e->v_con, e->edge_y, amount_y);
101 } 102 }
103 transaction_commit_dirty();
102} 104}
103 105
104static void handle_unref(struct sway_seat *seat, struct sway_container *con) { 106static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
@@ -140,7 +142,7 @@ void seatop_begin_resize_tiling(struct sway_seat *seat,
140 if (e->h_con) { 142 if (e->h_con) {
141 container_set_resizing(e->h_con, true); 143 container_set_resizing(e->h_con, true);
142 container_set_resizing(e->h_sib, true); 144 container_set_resizing(e->h_sib, true);
143 e->h_con_orig_width = e->h_con->width; 145 e->h_con_orig_width = e->h_con->pending.width;
144 } 146 }
145 } 147 }
146 if (edge & (WLR_EDGE_TOP | WLR_EDGE_BOTTOM)) { 148 if (edge & (WLR_EDGE_TOP | WLR_EDGE_BOTTOM)) {
@@ -151,12 +153,13 @@ void seatop_begin_resize_tiling(struct sway_seat *seat,
151 if (e->v_con) { 153 if (e->v_con) {
152 container_set_resizing(e->v_con, true); 154 container_set_resizing(e->v_con, true);
153 container_set_resizing(e->v_sib, true); 155 container_set_resizing(e->v_sib, true);
154 e->v_con_orig_height = e->v_con->height; 156 e->v_con_orig_height = e->v_con->pending.height;
155 } 157 }
156 } 158 }
157 159
158 seat->seatop_impl = &seatop_impl; 160 seat->seatop_impl = &seatop_impl;
159 seat->seatop_data = e; 161 seat->seatop_data = e;
160 162
163 transaction_commit_dirty();
161 wlr_seat_pointer_notify_clear_focus(seat->wlr_seat); 164 wlr_seat_pointer_notify_clear_focus(seat->wlr_seat);
162} 165}