riverctl patch: better handling of invalid keysyms

This commit is contained in:
Zuki Air 2025-08-01 20:10:18 +01:00
parent feac567278
commit c7b78634a0

View File

@ -1,4 +1,4 @@
From 5b6f945beea355708aa8d9f98feb089510d5f1ef Mon Sep 17 00:00:00 2001
From de574aa854d6da09a886f946b557d349c04e749d Mon Sep 17 00:00:00 2001
From: Zuki Air <zukirust@gmail.com>
Date: Sun, 27 Jul 2025 11:30:32 +0100
Subject: [PATCH] river-ctl patch
@ -15,8 +15,8 @@ fix bug
dwl.c | 20 +-
dwlctl.c | 132 +++++
protocols/river-control-unstable-v1.xml | 85 +++
river-control.h | 656 ++++++++++++++++++++++++
7 files changed, 936 insertions(+), 16 deletions(-)
river-control.h | 669 ++++++++++++++++++++++++
7 files changed, 949 insertions(+), 16 deletions(-)
create mode 100644 dwlctl.c
create mode 100644 protocols/river-control-unstable-v1.xml
create mode 100644 river-control.h
@ -450,10 +450,10 @@ index 0000000..aa5fc4d
+</protocol>
diff --git a/river-control.h b/river-control.h
new file mode 100644
index 0000000..42a5067
index 0000000..b8c7a8e
--- /dev/null
+++ b/river-control.h
@@ -0,0 +1,656 @@
@@ -0,0 +1,669 @@
+#include "river-control-unstable-v1-private-protocol.c"
+#include "river-control-unstable-v1-protocol.h"
+#ifdef KEYS_USED
@ -508,6 +508,10 @@ index 0000000..42a5067
+struct Func_str_type_pair Func_str_type_pair_list[] = {
+ { clear_binds, FUNC_STR_ARG_TYPE_NONE, "clear-binds" },
+ { clear_rules, FUNC_STR_ARG_TYPE_NONE, "clear-rules" },
+ STR(togglefakefullscreen,FUNC_STR_ARG_TYPE_NONE),
+ STR(togglegaps,FUNC_STR_ARG_TYPE_NONE),
+ STR(pushup,FUNC_STR_ARG_TYPE_NONE),
+ STR(pushdown,FUNC_STR_ARG_TYPE_NONE),
+ STR(setborderpx,FUNC_STR_ARG_TYPE_UINT),
+ STR(setlayout,FUNC_STR_ARG_TYPE_LAYOUT),
+ STR(spawn,FUNC_STR_ARG_TYPE_STRING_ARRAY),
@ -555,6 +559,7 @@ index 0000000..42a5067
+const char *zriver_error_double_appid = "set appid more then once!";
+const char *zriver_error_double_title = "set title more then once!";
+const char *zriver_error_under_zero = "argument can't be less then zero!";
+const char *zriver_error_invalid_keysym = "invalid keysym!";
+#define STR_LINK_ARRAY_SIZE 10
+struct Str_link {
+ struct wl_list link;
@ -903,7 +908,15 @@ index 0000000..42a5067
+ }
+ }
+ } else if (args->argc == 2) {
+ args->p.kl->key->keysym = xkb_keysym_from_name(argument,XKB_KEYSYM_NO_FLAGS);
+ if (strcmp(argument,"none") == 0 ) {
+ args->p.kl->key->keysym = XKB_KEY_NoSymbol;
+ } else {
+ args->p.kl->key->keysym = xkb_keysym_from_name(argument,XKB_KEYSYM_NO_FLAGS);
+ if (args->p.kl->key->keysym == XKB_KEY_NoSymbol) {
+ args->error = true;
+ args->error_msg = zriver_error_invalid_keysym;
+ }
+ }
+ } else if (args->argc == 3) {
+ for (fst = Func_str_type_pair_list; fst < END(Func_str_type_pair_list); fst++) {
+ if (strcmp(argument,fst->func_str) == 0) {