summaryrefslogtreecommitdiff
path: root/sway/commands/corner_radius.c
diff options
context:
space:
mode:
authorErik Reider <[email protected]>2023-05-19 21:14:06 +0200
committerGitHub <[email protected]>2023-05-19 21:14:06 +0200
commit415e072a3af292937f0b4c41acadafaee6958437 (patch)
tree354de329d9cbf66054260d50aebefd86a26d5055 /sway/commands/corner_radius.c
parent67078429428f0a97333c107da8a3ad8fb678a602 (diff)
Add blur, shadow, and corner radius to layer-shell surfaces (#144)
Co-authored-by: Will McKinnon <[email protected]>
Diffstat (limited to 'sway/commands/corner_radius.c')
-rw-r--r--sway/commands/corner_radius.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sway/commands/corner_radius.c b/sway/commands/corner_radius.c
index ab216f6e..fe8b458f 100644
--- a/sway/commands/corner_radius.c
+++ b/sway/commands/corner_radius.c
@@ -4,15 +4,24 @@
#include "sway/tree/container.h"
#include "log.h"
+bool cmd_corner_radius_parse_value(char *arg, int* result) {
+ char *inv;
+ int value = strtol(arg, &inv, 10);
+ if (*inv != '\0' || value < 0 || value > 99) {
+ return false;
+ }
+ *result = value;
+ return true;
+}
+
struct cmd_results *cmd_corner_radius(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "corner_radius", EXPECTED_EQUAL_TO, 1))) {
return error;
}
- char *inv;
- int value = strtol(argv[0], &inv, 10);
- if (*inv != '\0' || value < 0 || value > 99) {
+ int value = 0;
+ if (!cmd_corner_radius_parse_value(argv[0], &value)) {
return cmd_results_new(CMD_FAILURE, "Invalid size specified");
}