riverctl patch: fix bugs with keybind mode oneshot option

This commit is contained in:
Zuki Air 2025-08-01 23:09:05 +01:00
parent 0caf84ae8e
commit b608e58da3

View File

@ -1,4 +1,4 @@
From da6c19ca2bf476426ee598072a12b6d6e1679c54 Mon Sep 17 00:00:00 2001
From 692cf030859e2ab663a2883e005835f8424dfdec 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
@ -12,11 +12,11 @@ fix bug
.gitignore | 1 +
Makefile | 22 +-
config.def.h | 36 +-
dwl.c | 47 +-
dwl.c | 48 +-
dwlctl.c | 132 +++++
protocols/river-control-unstable-v1.xml | 85 +++
river-control.h | 753 ++++++++++++++++++++++++
7 files changed, 1054 insertions(+), 22 deletions(-)
7 files changed, 1055 insertions(+), 22 deletions(-)
create mode 100644 dwlctl.c
create mode 100644 protocols/river-control-unstable-v1.xml
create mode 100644 river-control.h
@ -148,7 +148,7 @@ index 95c2afa..72afbd6 100644
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
diff --git a/dwl.c b/dwl.c
index 12f441e..2cbb1b0 100644
index 12f441e..366b8bf 100644
--- a/dwl.c
+++ b/dwl.c
@@ -145,7 +145,7 @@ typedef struct {
@ -204,7 +204,7 @@ index 12f441e..2cbb1b0 100644
int
keybinding(uint32_t mods, xkb_keysym_t sym)
{
@@ -1613,14 +1628,21 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
@@ -1613,14 +1628,22 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
* processing keys, rather than passing them on to the client for its own
* processing.
*/
@ -218,12 +218,13 @@ index 12f441e..2cbb1b0 100644
- }
+ const Key_linked *kl;
+ const Key *k;
+ Mode *new_mode_if_oneshot = active_mode->oneshot_mode;
+
+ wl_list_for_each(kl,&active_mode->linked_keys,link) {
+ k = kl->key;
+ if (keybinding_key(mods,sym,k) == true) {
+ if (active_mode->oneshot_mode != NULL) {
+ active_mode = active_mode->oneshot_mode;
+ if (new_mode_if_oneshot != NULL) {
+ active_mode = new_mode_if_oneshot;
+ }
+ return 1;
+ }
@ -234,7 +235,7 @@ index 12f441e..2cbb1b0 100644
return 0;
}
@@ -2645,6 +2667,9 @@ setup(void)
@@ -2645,6 +2668,9 @@ setup(void)
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
@ -244,7 +245,7 @@ index 12f441e..2cbb1b0 100644
/* Make sure XWayland clients don't connect to the parent X server,
* e.g when running in the x11 backend or the wayland backend and the
* compositor has Xwayland support */
@@ -3187,6 +3212,8 @@ main(int argc, char *argv[])
@@ -3187,6 +3213,8 @@ main(int argc, char *argv[])
{
char *startup_cmd = NULL;
int c;
@ -484,7 +485,7 @@ index 0000000..aa5fc4d
+</protocol>
diff --git a/river-control.h b/river-control.h
new file mode 100644
index 0000000..ad76520
index 0000000..59561b6
--- /dev/null
+++ b/river-control.h
@@ -0,0 +1,753 @@
@ -786,7 +787,7 @@ index 0000000..ad76520
+ char * return_mode_name = *((char **)arg->v+1);
+ if (oneshot_mode_name != NULL && return_mode_name != NULL) {
+ Mode *oneshot_mode = get_mode(oneshot_mode_name);
+ if (oneshot_mode_name != NULL) {
+ if (oneshot_mode != NULL) {
+ oneshot_mode->oneshot_mode = get_mode(return_mode_name);
+ }
+ }