aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/border.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-24 20:54:57 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-27 22:51:37 +1000
commit7b138e5ef0f679c9bb0078019d7c9c63fef36273 (patch)
tree2cdbeb394889065e0606a1fcbe38c1e99e25d260 /sway/commands/border.c
parentMerge pull request #2717 from ianyfan/tablet-config (diff)
downloadsway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.gz
sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.zst
sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.zip
Add CSD to border modes
This replaces view.using_csd with a new border mode: B_CSD. This also removes sway_xdg_shell{_v6}_view.deco_mode and view->has_client_side_decorations as we can now get these from the border. You can use `border toggle` to cycle through the modes including CSD, or use `border csd` to set it directly. The client must support the xdg-decoration protocol, and the only client I know of that does is the example in wlroots. If the client switches from SSD to CSD without us expecting it (via the server-decoration protocol), we stash the previous border type into view.saved_border so we can restore it if the client returns to SSD. I haven't found a way to test this though.
Diffstat (limited to 'sway/commands/border.c')
-rw-r--r--sway/commands/border.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sway/commands/border.c b/sway/commands/border.c
index 95498b2f..673fea08 100644
--- a/sway/commands/border.c
+++ b/sway/commands/border.c
@@ -7,6 +7,17 @@
7#include "sway/tree/container.h" 7#include "sway/tree/container.h"
8#include "sway/tree/view.h" 8#include "sway/tree/view.h"
9 9
10static void set_border(struct sway_view *view,
11 enum sway_container_border new_border) {
12 if (view->border == B_CSD && new_border != B_CSD) {
13 view_set_csd_from_server(view, false);
14 } else if (view->border != B_CSD && new_border == B_CSD) {
15 view_set_csd_from_server(view, true);
16 }
17 view->saved_border = view->border;
18 view->border = new_border;
19}
20
10struct cmd_results *cmd_border(int argc, char **argv) { 21struct cmd_results *cmd_border(int argc, char **argv) {
11 struct cmd_results *error = NULL; 22 struct cmd_results *error = NULL;
12 if ((error = checkarg(argc, "border", EXPECTED_AT_LEAST, 1))) { 23 if ((error = checkarg(argc, "border", EXPECTED_AT_LEAST, 1))) {
@@ -21,13 +32,15 @@ struct cmd_results *cmd_border(int argc, char **argv) {
21 struct sway_view *view = container->view; 32 struct sway_view *view = container->view;
22 33
23 if (strcmp(argv[0], "none") == 0) { 34 if (strcmp(argv[0], "none") == 0) {
24 view->border = B_NONE; 35 set_border(view, B_NONE);
25 } else if (strcmp(argv[0], "normal") == 0) { 36 } else if (strcmp(argv[0], "normal") == 0) {
26 view->border = B_NORMAL; 37 set_border(view, B_NORMAL);
27 } else if (strcmp(argv[0], "pixel") == 0) { 38 } else if (strcmp(argv[0], "pixel") == 0) {
28 view->border = B_PIXEL; 39 set_border(view, B_PIXEL);
40 } else if (strcmp(argv[0], "csd") == 0) {
41 set_border(view, B_CSD);
29 } else if (strcmp(argv[0], "toggle") == 0) { 42 } else if (strcmp(argv[0], "toggle") == 0) {
30 view->border = (view->border + 1) % 3; 43 set_border(view, (view->border + 1) % 4);
31 } else { 44 } else {
32 return cmd_results_new(CMD_INVALID, "border", 45 return cmd_results_new(CMD_INVALID, "border",
33 "Expected 'border <none|normal|pixel|toggle>' " 46 "Expected 'border <none|normal|pixel|toggle>' "