summaryrefslogtreecommitdiffstats
path: root/sway/commands/new_float.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/new_float.c')
-rw-r--r--sway/commands/new_float.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/sway/commands/new_float.c b/sway/commands/new_float.c
index 432af436..d0f96093 100644
--- a/sway/commands/new_float.c
+++ b/sway/commands/new_float.c
@@ -1,44 +1,8 @@
1#include <errno.h> 1#include "log.h"
2#include <string.h>
3#include <strings.h>
4#include "sway/commands.h" 2#include "sway/commands.h"
5#include "sway/container.h"
6 3
7struct cmd_results *cmd_new_float(int argc, char **argv) { 4struct cmd_results *cmd_new_float(int argc, char **argv) {
8 struct cmd_results *error = NULL; 5 sway_log(L_INFO, "`new_float` is deprecated and will be removed in the future. "
9 if ((error = checkarg(argc, "new_float", EXPECTED_AT_LEAST, 1))) { 6 "Please use `default_floating_border` instead.");
10 return error; 7 return cmd_default_floating_border(argc, argv);
11 }
12
13 if (argc > 2) {
14 return cmd_results_new(CMD_INVALID, "new_float",
15 "Expected 'new_float <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, "new_float",
29 "Expected 'border <normal|none|pixel>");
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, "new_float", "Number is out out of range.");
37 }
38 }
39
40 config->floating_border = border;
41 config->floating_border_thickness = thickness;
42
43 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
44} 8}