aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/resize.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-28 19:06:42 +1000
committerLibravatar emersion <contact@emersion.fr>2019-01-28 10:35:40 +0100
commit6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a (patch)
tree61a9e61c64fd1b88a79b06a6f9dafeb84e4f8c35 /sway/commands/resize.c
parentAdd note about required scdoc version to README. (diff)
downloadsway-6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a.tar.gz
sway-6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a.tar.zst
sway-6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a.zip
Introduce container_is_scratchpad_hidden
Just a convenience function that improves readability of the code. Other things worth noting: * container_get_siblings and container_sibling_index no longer use the const keyword * container_handle_fullscreen_reparent is only ever called after attaching the container to a workspace, so its con->workspace check has been changed to an assertion
Diffstat (limited to 'sway/commands/resize.c')
-rw-r--r--sway/commands/resize.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index 204de539..c9261535 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -86,7 +86,8 @@ static void calculate_constraints(int *min_width, int *max_width,
86 *min_height = config->floating_minimum_height; 86 *min_height = config->floating_minimum_height;
87 } 87 }
88 88
89 if (config->floating_maximum_width == -1 || !con->workspace) { // no max 89 if (config->floating_maximum_width == -1 ||
90 container_is_scratchpad_hidden(con)) { // no max
90 *max_width = INT_MAX; 91 *max_width = INT_MAX;
91 } else if (config->floating_maximum_width == 0) { // automatic 92 } else if (config->floating_maximum_width == 0) { // automatic
92 *max_width = con->workspace->width; 93 *max_width = con->workspace->width;
@@ -94,7 +95,8 @@ static void calculate_constraints(int *min_width, int *max_width,
94 *max_width = config->floating_maximum_width; 95 *max_width = config->floating_maximum_width;
95 } 96 }
96 97
97 if (config->floating_maximum_height == -1 || !con->workspace) { // no max 98 if (config->floating_maximum_height == -1 ||
99 container_is_scratchpad_hidden(con)) { // no max
98 *max_height = INT_MAX; 100 *max_height = INT_MAX;
99 } else if (config->floating_maximum_height == 0) { // automatic 101 } else if (config->floating_maximum_height == 0) { // automatic
100 *max_height = con->workspace->height; 102 *max_height = con->workspace->height;
@@ -386,7 +388,7 @@ static struct cmd_results *resize_set_floating(struct sway_container *con,
386 if (width->amount) { 388 if (width->amount) {
387 switch (width->unit) { 389 switch (width->unit) {
388 case RESIZE_UNIT_PPT: 390 case RESIZE_UNIT_PPT:
389 if (con->scratchpad && !con->workspace) { 391 if (container_is_scratchpad_hidden(con)) {
390 return cmd_results_new(CMD_FAILURE, 392 return cmd_results_new(CMD_FAILURE,
391 "Cannot resize a hidden scratchpad container by ppt"); 393 "Cannot resize a hidden scratchpad container by ppt");
392 } 394 }
@@ -410,7 +412,7 @@ static struct cmd_results *resize_set_floating(struct sway_container *con,
410 if (height->amount) { 412 if (height->amount) {
411 switch (height->unit) { 413 switch (height->unit) {
412 case RESIZE_UNIT_PPT: 414 case RESIZE_UNIT_PPT:
413 if (con->scratchpad && !con->workspace) { 415 if (container_is_scratchpad_hidden(con)) {
414 return cmd_results_new(CMD_FAILURE, 416 return cmd_results_new(CMD_FAILURE,
415 "Cannot resize a hidden scratchpad container by ppt"); 417 "Cannot resize a hidden scratchpad container by ppt");
416 } 418 }