diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-10-01 12:56:27 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-10-01 21:19:06 -0400 |
commit | bb25194844599bb653a78633c9c09c0c0ff225ee (patch) | |
tree | a19bcbc62ff5d4ddcb822914a4f3516c7766406a /sway/commands/hide_edge_borders.c | |
parent | Merge pull request #2739 from RedSoxFan/fix-2653 (diff) | |
download | sway-bb25194844599bb653a78633c9c09c0c0ff225ee.tar.gz sway-bb25194844599bb653a78633c9c09c0c0ff225ee.tar.zst sway-bb25194844599bb653a78633c9c09c0c0ff225ee.zip |
Handle border options for gaps
Fixes `hide_edge_borders smart` when gaps are in use.
Implements `hide_edge_borders smart_no_gaps` and `smart_borders
on|no_gaps|off`.
Since `smart_borders on` is equivalent to `hide_edge_borders smart`
and `smart_borders no_gaps` is equivalent to `hide_edge_borders
smart_no_gaps`, I opted to just save the last value set for
`hide_edge_borders` and restore that on `smart_borders off`. This
simplifies the conditions for setting the border.
Diffstat (limited to 'sway/commands/hide_edge_borders.c')
-rw-r--r-- | sway/commands/hide_edge_borders.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sway/commands/hide_edge_borders.c b/sway/commands/hide_edge_borders.c index 0a5c7f28..ea261fb1 100644 --- a/sway/commands/hide_edge_borders.c +++ b/sway/commands/hide_edge_borders.c | |||
@@ -1,15 +1,8 @@ | |||
1 | #include "sway/commands.h" | 1 | #include "sway/commands.h" |
2 | #include "sway/config.h" | 2 | #include "sway/config.h" |
3 | #include "sway/tree/container.h" | 3 | #include "sway/tree/arrange.h" |
4 | #include "sway/tree/root.h" | ||
5 | #include "sway/tree/view.h" | 4 | #include "sway/tree/view.h" |
6 | 5 | ||
7 | static void _configure_view(struct sway_container *con, void *data) { | ||
8 | if (con->view) { | ||
9 | view_autoconfigure(con->view); | ||
10 | } | ||
11 | } | ||
12 | |||
13 | struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { | 6 | struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { |
14 | struct cmd_results *error = NULL; | 7 | struct cmd_results *error = NULL; |
15 | if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_EQUAL_TO, 1))) { | 8 | if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_EQUAL_TO, 1))) { |
@@ -26,13 +19,16 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { | |||
26 | config->hide_edge_borders = E_BOTH; | 19 | config->hide_edge_borders = E_BOTH; |
27 | } else if (strcmp(argv[0], "smart") == 0) { | 20 | } else if (strcmp(argv[0], "smart") == 0) { |
28 | config->hide_edge_borders = E_SMART; | 21 | config->hide_edge_borders = E_SMART; |
22 | } else if (strcmp(argv[0], "smart_no_gaps") == 0) { | ||
23 | config->hide_edge_borders = E_SMART_NO_GAPS; | ||
29 | } else { | 24 | } else { |
30 | return cmd_results_new(CMD_INVALID, "hide_edge_borders", | 25 | return cmd_results_new(CMD_INVALID, "hide_edge_borders", |
31 | "Expected 'hide_edge_borders " | 26 | "Expected 'hide_edge_borders " |
32 | "<none|vertical|horizontal|both|smart>'"); | 27 | "<none|vertical|horizontal|both|smart|smart_no_gaps>'"); |
33 | } | 28 | } |
29 | config->saved_edge_borders = config->hide_edge_borders; | ||
34 | 30 | ||
35 | root_for_each_container(_configure_view, NULL); | 31 | arrange_root(); |
36 | 32 | ||
37 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 33 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
38 | } | 34 | } |