diff options
Diffstat (limited to 'sway/old/commands/default_floating_border.c')
-rw-r--r-- | sway/old/commands/default_floating_border.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/sway/old/commands/default_floating_border.c b/sway/old/commands/default_floating_border.c deleted file mode 100644 index fb48c1c0..00000000 --- a/sway/old/commands/default_floating_border.c +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #include <errno.h> | ||
2 | #include <string.h> | ||
3 | #include <strings.h> | ||
4 | #include "sway/commands.h" | ||
5 | #include "sway/container.h" | ||
6 | |||
7 | struct cmd_results *cmd_default_floating_border(int argc, char **argv) { | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "default_floating_border", EXPECTED_AT_LEAST, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | |||
13 | if (argc > 2) { | ||
14 | return cmd_results_new(CMD_INVALID, "default_floating_border", | ||
15 | "Expected 'default_floating_border <normal|none|pixel> [<n>]"); | ||
16 | } | ||
17 | |||
18 | enum swayc_border_types border = config->floating_border; | ||
19 | int thickness = config->floating_border_thickness; | ||
20 | |||
21 | if (strcasecmp(argv[0], "none") == 0) { | ||
22 | border = B_NONE; | ||
23 | } else if (strcasecmp(argv[0], "normal") == 0) { | ||
24 | border = B_NORMAL; | ||
25 | } else if (strcasecmp(argv[0], "pixel") == 0) { | ||
26 | border = B_PIXEL; | ||
27 | } else { | ||
28 | return cmd_results_new(CMD_INVALID, "default_floating_border", | ||
29 | "Expected 'default_floating_border <normal|none|pixel> [<n>]"); | ||
30 | } | ||
31 | |||
32 | if (argc == 2 && (border == B_NORMAL || border == B_PIXEL)) { | ||
33 | thickness = (int)strtol(argv[1], NULL, 10); | ||
34 | if (errno == ERANGE || thickness < 0) { | ||
35 | errno = 0; | ||
36 | return cmd_results_new(CMD_INVALID, "default_floating_border", | ||
37 | "Number is out out of range."); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | config->floating_border = border; | ||
42 | config->floating_border_thickness = thickness; | ||
43 | |||
44 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
45 | } | ||