diff options
author | Zandr Martin <zandrmartin@gmail.com> | 2017-03-09 14:56:15 -0500 |
---|---|---|
committer | Zandr Martin <zandrmartin@gmail.com> | 2017-03-09 14:56:15 -0500 |
commit | 18450dd16a3909d0ea581f5f9cad4128751870cc (patch) | |
tree | 6d4a99dcb568e73f514e0fde42fe3ae7d64a30ca /sway/commands/new_float.c | |
parent | Merge pull request #1105 from zandrmartin/fix-workspace-output-assignment (diff) | |
download | sway-18450dd16a3909d0ea581f5f9cad4128751870cc.tar.gz sway-18450dd16a3909d0ea581f5f9cad4128751870cc.tar.zst sway-18450dd16a3909d0ea581f5f9cad4128751870cc.zip |
deprecate new_window and new_float commands
Diffstat (limited to 'sway/commands/new_float.c')
-rw-r--r-- | sway/commands/new_float.c | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/sway/commands/new_float.c b/sway/commands/new_float.c index 8e4e354f..d0f96093 100644 --- a/sway/commands/new_float.c +++ b/sway/commands/new_float.c | |||
@@ -1,43 +1,8 @@ | |||
1 | #include <errno.h> | 1 | #include "log.h" |
2 | #include <string.h> | ||
3 | #include "sway/commands.h" | 2 | #include "sway/commands.h" |
4 | #include "sway/container.h" | ||
5 | 3 | ||
6 | struct cmd_results *cmd_new_float(int argc, char **argv) { | 4 | struct cmd_results *cmd_new_float(int argc, char **argv) { |
7 | struct cmd_results *error = NULL; | 5 | sway_log(L_INFO, "`new_float` is deprecated and will be removed in the future. " |
8 | if ((error = checkarg(argc, "new_float", EXPECTED_AT_LEAST, 1))) { | 6 | "Please use `default_floating_border` instead."); |
9 | return error; | 7 | return cmd_default_floating_border(argc, argv); |
10 | } | ||
11 | |||
12 | if (argc > 2) { | ||
13 | return cmd_results_new(CMD_INVALID, "new_float", | ||
14 | "Expected 'new_float <normal|none|pixel> [<n>]"); | ||
15 | } | ||
16 | |||
17 | enum swayc_border_types border = config->floating_border; | ||
18 | int thickness = config->floating_border_thickness; | ||
19 | |||
20 | if (strcasecmp(argv[0], "none") == 0) { | ||
21 | border = B_NONE; | ||
22 | } else if (strcasecmp(argv[0], "normal") == 0) { | ||
23 | border = B_NORMAL; | ||
24 | } else if (strcasecmp(argv[0], "pixel") == 0) { | ||
25 | border = B_PIXEL; | ||
26 | } else { | ||
27 | return cmd_results_new(CMD_INVALID, "new_float", | ||
28 | "Expected 'border <normal|none|pixel>"); | ||
29 | } | ||
30 | |||
31 | if (argc == 2 && (border == B_NORMAL || border == B_PIXEL)) { | ||
32 | thickness = (int)strtol(argv[1], NULL, 10); | ||
33 | if (errno == ERANGE || thickness < 0) { | ||
34 | errno = 0; | ||
35 | return cmd_results_new(CMD_INVALID, "new_float", "Number is out out of range."); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | config->floating_border = border; | ||
40 | config->floating_border_thickness = thickness; | ||
41 | |||
42 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
43 | } | 8 | } |