summaryrefslogtreecommitdiffstats
path: root/sway/input_state.c
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-22 22:32:41 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-22 22:32:41 -0700
commit299406a048e8db3342987a9cfb2ce8b61df6bd82 (patch)
tree126bb076bd540d10737777c6430a87181f0ad675 /sway/input_state.c
parentfixed container resize oddity (diff)
downloadsway-299406a048e8db3342987a9cfb2ce8b61df6bd82.tar.gz
sway-299406a048e8db3342987a9cfb2ce8b61df6bd82.tar.zst
sway-299406a048e8db3342987a9cfb2ce8b61df6bd82.zip
slight fix
Diffstat (limited to 'sway/input_state.c')
-rw-r--r--sway/input_state.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/sway/input_state.c b/sway/input_state.c
index ece75bf4..8450fe7a 100644
--- a/sway/input_state.c
+++ b/sway/input_state.c
@@ -60,12 +60,18 @@ static struct mode_state {
60 struct { 60 struct {
61 double x, w; 61 double x, w;
62 swayc_t *ptr; 62 swayc_t *ptr;
63 swayc_t *sib; 63 struct {
64 double x, w;
65 swayc_t *ptr;
66 } sib;
64 } lr; 67 } lr;
65 struct { 68 struct {
66 double y, h; 69 double y, h;
67 swayc_t *ptr; 70 swayc_t *ptr;
68 swayc_t *sib; 71 struct {
72 double y, h;
73 swayc_t *ptr;
74 } sib;
69 } tb; 75 } tb;
70} initial; 76} initial;
71 77
@@ -87,15 +93,19 @@ static void set_initial_view(swayc_t *view) {
87static void set_initial_sibling(void) { 93static void set_initial_sibling(void) {
88 bool reset = true; 94 bool reset = true;
89 if ((initial.lr.ptr = get_swayc_in_direction(initial.ptr, lock.left ? MOVE_RIGHT: MOVE_LEFT))) { 95 if ((initial.lr.ptr = get_swayc_in_direction(initial.ptr, lock.left ? MOVE_RIGHT: MOVE_LEFT))) {
90 initial.lr.sib = get_swayc_in_direction(initial.lr.ptr, lock.left ? MOVE_LEFT : MOVE_RIGHT);
91 initial.lr.x = initial.lr.ptr->x; 96 initial.lr.x = initial.lr.ptr->x;
92 initial.lr.w = initial.lr.ptr->width; 97 initial.lr.w = initial.lr.ptr->width;
98 initial.lr.sib.ptr = get_swayc_in_direction(initial.lr.ptr, lock.left ? MOVE_LEFT : MOVE_RIGHT);
99 initial.lr.sib.x = initial.lr.sib.ptr->x;
100 initial.lr.sib.w = initial.lr.sib.ptr->width;
93 reset = false; 101 reset = false;
94 } 102 }
95 if ((initial.tb.ptr = get_swayc_in_direction(initial.ptr, lock.top ? MOVE_DOWN: MOVE_UP))) { 103 if ((initial.tb.ptr = get_swayc_in_direction(initial.ptr, lock.top ? MOVE_DOWN: MOVE_UP))) {
96 initial.tb.sib = get_swayc_in_direction(initial.tb.ptr, lock.top ? MOVE_UP : MOVE_DOWN);
97 initial.tb.y = initial.tb.ptr->y; 104 initial.tb.y = initial.tb.ptr->y;
98 initial.tb.h = initial.tb.ptr->height; 105 initial.tb.h = initial.tb.ptr->height;
106 initial.tb.sib.ptr = get_swayc_in_direction(initial.tb.ptr, lock.top ? MOVE_UP : MOVE_DOWN);
107 initial.tb.sib.y = initial.tb.sib.ptr->y;
108 initial.tb.sib.h = initial.tb.sib.ptr->height;
99 reset = false; 109 reset = false;
100 } 110 }
101 // If nothing changes just undo the mode 111 // If nothing changes just undo the mode
@@ -258,13 +268,13 @@ void pointer_mode_update(void) {
258 if (lock.left) { 268 if (lock.left) {
259 // Check whether its fine to resize 269 // Check whether its fine to resize
260 if (initial.w + dx > min_sane_w && initial.lr.w - dx > min_sane_w) { 270 if (initial.w + dx > min_sane_w && initial.lr.w - dx > min_sane_w) {
261 initial.lr.sib->width = initial.w + dx;
262 initial.lr.ptr->width = initial.lr.w - dx; 271 initial.lr.ptr->width = initial.lr.w - dx;
272 initial.lr.sib.ptr->width = initial.lr.sib.w + dx;
263 } 273 }
264 } else { //lock.right 274 } else { //lock.right
265 if (initial.w - dx > min_sane_w && initial.lr.w + dx > min_sane_w) { 275 if (initial.w - dx > min_sane_w && initial.lr.w + dx > min_sane_w) {
266 initial.lr.sib->width = initial.w - dx;
267 initial.lr.ptr->width = initial.lr.w + dx; 276 initial.lr.ptr->width = initial.lr.w + dx;
277 initial.lr.sib.ptr->width = initial.lr.sib.w - dx;
268 } 278 }
269 } 279 }
270 arrange_windows(initial.lr.ptr->parent, -1, -1); 280 arrange_windows(initial.lr.ptr->parent, -1, -1);
@@ -272,13 +282,13 @@ void pointer_mode_update(void) {
272 if (initial.tb.ptr) { 282 if (initial.tb.ptr) {
273 if (lock.top) { 283 if (lock.top) {
274 if (initial.h + dy > min_sane_h && initial.tb.h - dy > min_sane_h) { 284 if (initial.h + dy > min_sane_h && initial.tb.h - dy > min_sane_h) {
275 initial.tb.sib->height = initial.h + dy;
276 initial.tb.ptr->height = initial.tb.h - dy; 285 initial.tb.ptr->height = initial.tb.h - dy;
286 initial.tb.sib.ptr->height = initial.tb.sib.h + dy;
277 } 287 }
278 } else { //lock.bottom 288 } else { //lock.bottom
279 if (initial.h - dy > min_sane_h && initial.tb.h + dy > min_sane_h) { 289 if (initial.h - dy > min_sane_h && initial.tb.h + dy > min_sane_h) {
280 initial.tb.sib->height = initial.h - dy;
281 initial.tb.ptr->height = initial.tb.h + dy; 290 initial.tb.ptr->height = initial.tb.h + dy;
291 initial.tb.sib.ptr->height = initial.tb.sib.h - dy;
282 } 292 }
283 } 293 }
284 arrange_windows(initial.tb.ptr->parent, -1, -1); 294 arrange_windows(initial.tb.ptr->parent, -1, -1);