diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-16 01:05:10 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-01-16 09:30:43 +0100 |
commit | 81e595e6e8b2776aa4b4fc44c72baaab69cc0a9b (patch) | |
tree | 6c12f7edcef4d4002b5711dc414a4956a73deb1d | |
parent | seatop_begin_down: raise floating (diff) | |
download | sway-81e595e6e8b2776aa4b4fc44c72baaab69cc0a9b.tar.gz sway-81e595e6e8b2776aa4b4fc44c72baaab69cc0a9b.tar.zst sway-81e595e6e8b2776aa4b4fc44c72baaab69cc0a9b.zip |
cmd_resize: allow resizing hidden scratchpad by px
Allow resizing a hidden scratchpad container by px. Resizing a hidden
scratchpad container by ppt is still not allowed since there is no
workspace
-rw-r--r-- | sway/commands/resize.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index d840f26c..c88d2734 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c | |||
@@ -387,6 +387,10 @@ static struct cmd_results *resize_set_floating(struct sway_container *con, | |||
387 | if (width->amount) { | 387 | if (width->amount) { |
388 | switch (width->unit) { | 388 | switch (width->unit) { |
389 | case RESIZE_UNIT_PPT: | 389 | case RESIZE_UNIT_PPT: |
390 | if (con->scratchpad && !con->workspace) { | ||
391 | return cmd_results_new(CMD_FAILURE, | ||
392 | "Cannot resize a hidden scratchpad container by ppt"); | ||
393 | } | ||
390 | // Convert to px | 394 | // Convert to px |
391 | width->amount = con->workspace->width * width->amount / 100; | 395 | width->amount = con->workspace->width * width->amount / 100; |
392 | width->unit = RESIZE_UNIT_PX; | 396 | width->unit = RESIZE_UNIT_PX; |
@@ -407,6 +411,10 @@ static struct cmd_results *resize_set_floating(struct sway_container *con, | |||
407 | if (height->amount) { | 411 | if (height->amount) { |
408 | switch (height->unit) { | 412 | switch (height->unit) { |
409 | case RESIZE_UNIT_PPT: | 413 | case RESIZE_UNIT_PPT: |
414 | if (con->scratchpad && !con->workspace) { | ||
415 | return cmd_results_new(CMD_FAILURE, | ||
416 | "Cannot resize a hidden scratchpad container by ppt"); | ||
417 | } | ||
410 | // Convert to px | 418 | // Convert to px |
411 | height->amount = con->workspace->height * height->amount / 100; | 419 | height->amount = con->workspace->height * height->amount / 100; |
412 | height->unit = RESIZE_UNIT_PX; | 420 | height->unit = RESIZE_UNIT_PX; |
@@ -589,11 +597,6 @@ struct cmd_results *cmd_resize(int argc, char **argv) { | |||
589 | if (!current) { | 597 | if (!current) { |
590 | return cmd_results_new(CMD_INVALID, "Cannot resize nothing"); | 598 | return cmd_results_new(CMD_INVALID, "Cannot resize nothing"); |
591 | } | 599 | } |
592 | if (current->scratchpad && !current->workspace) { | ||
593 | return cmd_results_new(CMD_FAILURE, | ||
594 | "Cannot resize a hidden scratchpad container"); | ||
595 | } | ||
596 | |||
597 | 600 | ||
598 | struct cmd_results *error; | 601 | struct cmd_results *error; |
599 | if ((error = checkarg(argc, "resize", EXPECTED_AT_LEAST, 2))) { | 602 | if ((error = checkarg(argc, "resize", EXPECTED_AT_LEAST, 2))) { |