update riverctl patch to make clear-binds and clear-rules functions part of func list rather then special cases

This commit is contained in:
Zuki Air 2025-07-29 09:15:01 +01:00
parent a23d17409d
commit efde7ce68e

View File

@ -1,4 +1,4 @@
From b00dde5efc0c13a9cc0637bcb8ccca91a78c747a Mon Sep 17 00:00:00 2001
From ba4bc854ec0e39030cde295e5019e56f598472b2 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
@ -11,8 +11,8 @@ remove func argument and use the root argument instead
dwl.c | 20 +-
dwlctl.c | 132 +++++
protocols/river-control-unstable-v1.xml | 85 +++
river-control.h | 717 ++++++++++++++++++++++++
7 files changed, 996 insertions(+), 15 deletions(-)
river-control.h | 715 ++++++++++++++++++++++++
7 files changed, 994 insertions(+), 15 deletions(-)
create mode 100644 dwlctl.c
create mode 100644 protocols/river-control-unstable-v1.xml
create mode 100644 river-control.h
@ -437,15 +437,17 @@ index 0000000..aa5fc4d
+</protocol>
diff --git a/river-control.h b/river-control.h
new file mode 100644
index 0000000..a2ec549
index 0000000..297a47e
--- /dev/null
+++ b/river-control.h
@@ -0,0 +1,717 @@
@@ -0,0 +1,715 @@
+#include "river-control-unstable-v1-private-protocol.c"
+#include "river-control-unstable-v1-protocol.h"
+#ifdef KEYS_USED
+void default_binds(void);
+#endif
+void clear_rules(const Arg*);
+void clear_binds(const Arg*);
+// TODO add dynamic rules then its fully complete!
+struct wl_list arg_str_store;
+struct wl_list rule_str_store;
@ -490,6 +492,8 @@ index 0000000..a2ec549
+#define STR(a,b) \
+ { a, b, #a }
+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(setlayout,FUNC_STR_ARG_TYPE_LAYOUT),
+ STR(spawn,FUNC_STR_ARG_TYPE_STRING_ARRAY),
+ STR(focusstack,FUNC_STR_ARG_TYPE_INT),
@ -744,7 +748,7 @@ index 0000000..a2ec549
+ wl_list_init(&rule_str_store);
+ }
+}
+void clear_rules(void) {
+void clear_rules(const Arg* arg) {
+ Rule_linked *rl,*tmp_rl;
+
+ wl_list_for_each_safe(rl,tmp_rl,&rules_list,link) {
@ -756,7 +760,6 @@ index 0000000..a2ec549
+ free(rl);
+ }
+ }
+ clear_str_store(&rule_str_store);
+}
+void setup_binds(void) {
+ Key *k;
@ -794,7 +797,7 @@ index 0000000..a2ec549
+ }
+}
+#endif
+void clear_binds(void) {
+void clear_binds(const Arg* arg) {
+ Key_linked *kl,*tmp_kl;
+
+ wl_list_for_each_safe(kl,tmp_kl,&keys_list,link) {
@ -806,7 +809,6 @@ index 0000000..a2ec549
+ free(kl);
+ }
+ }
+ clear_str_store(&arg_str_store);
+}
+
+void zriver_control_add_argument(struct wl_client *client,
@ -855,10 +857,6 @@ index 0000000..a2ec549
+ args->error = true;
+ args->error_msg = zriver_error_alloc;
+ }
+ } else if (strcmp("clear-binds",argument) == 0 ) {
+ clear_binds();
+ } else if (strcmp("clear-rules",argument) == 0 ) {
+ clear_rules();
+ } else {
+ for (fst = Func_str_type_pair_list; fst < END(Func_str_type_pair_list); fst++) {
+ if (strcmp(argument,fst->func_str) == 0) {