mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-08 12:14:50 +00:00
en-keycodes: fix Terminate_Server being ignored
This commit is contained in:
parent
f24e98a304
commit
919741ee19
@ -3,7 +3,7 @@ Always use the English keymap to get keycodes, so key bindings work even when us
|
|||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/ForzCross/dwl/src/branch/en-keycodes.patch)
|
- [git branch](https://codeberg.org/ForzCross/dwl/src/branch/en-keycodes.patch)
|
||||||
- [2024-01-11](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/en-keycodes/en-keycodes.patch)
|
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/en-keycodes/en-keycodes.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [ForzCross](https://codeberg.org/ForzCross)
|
- [ForzCross](https://codeberg.org/ForzCross)
|
||||||
|
@ -1,53 +1,63 @@
|
|||||||
From 19d52ef3f9814dd205e71c3ef31e41fd52cef515 Mon Sep 17 00:00:00 2001
|
From cd61fac9cb6e9d0172e2f7a01e6a514d676ba5f0 Mon Sep 17 00:00:00 2001
|
||||||
From: ForzCross <forzcross@gmail.com>
|
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||||
Date: Wed, 10 Jan 2024 00:42:39 +0300
|
Date: Tue, 4 Feb 2025 23:53:11 +0100
|
||||||
Subject: [PATCH] Always use the English keymap to get keycodes
|
Subject: [PATCH] Always use the English keymap to get keycodes
|
||||||
|
|
||||||
---
|
---
|
||||||
dwl.c | 21 ++++++++++++++++++++-
|
dwl.c | 23 +++++++++++++++++++----
|
||||||
1 file changed, 20 insertions(+), 1 deletion(-)
|
1 file changed, 19 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 632dabf..858318a 100644
|
index def2562..c299365 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -384,6 +384,12 @@ static struct wlr_box sgeom;
|
@@ -413,6 +413,11 @@ static struct wlr_box sgeom;
|
||||||
static struct wl_list mons;
|
static struct wl_list mons;
|
||||||
static Monitor *selmon;
|
static Monitor *selmon;
|
||||||
|
|
||||||
+static const struct xkb_rule_names en_rules = {.layout = "us"};
|
+static const struct xkb_rule_names en_rules = {.layout = "us"};
|
||||||
+static struct xkb_context *en_context;
|
+static struct xkb_context *en_context;
|
||||||
+static struct xkb_keymap *en_keymap;
|
+static struct xkb_keymap *en_keymap;
|
||||||
+static struct xkb_state *en_state, *en_state_shift;
|
+static struct xkb_state *en_state;
|
||||||
+static xkb_mod_index_t en_shift;
|
|
||||||
+
|
+
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
static void activatex11(struct wl_listener *listener, void *data);
|
static void activatex11(struct wl_listener *listener, void *data);
|
||||||
static void associatex11(struct wl_listener *listener, void *data);
|
static void associatex11(struct wl_listener *listener, void *data);
|
||||||
@@ -647,6 +653,10 @@ cleanup(void)
|
@@ -694,6 +699,9 @@ cleanup(void)
|
||||||
wl_event_source_remove(vkb_group.key_repeat_source);
|
wlr_backend_destroy(backend);
|
||||||
|
|
||||||
wl_display_destroy(dpy);
|
wl_display_destroy(dpy);
|
||||||
+ xkb_state_unref(en_state);
|
+ xkb_state_unref(en_state);
|
||||||
+ xkb_state_unref(en_state_shift);
|
|
||||||
+ xkb_keymap_unref(en_keymap);
|
+ xkb_keymap_unref(en_keymap);
|
||||||
+ xkb_context_unref(en_context);
|
+ xkb_context_unref(en_context);
|
||||||
/* Destroy after the wayland display (when the monitors are already destroyed)
|
/* Destroy after the wayland display (when the monitors are already destroyed)
|
||||||
to avoid destroying them with an invalid scene output. */
|
to avoid destroying them with an invalid scene output. */
|
||||||
wlr_scene_node_destroy(&scene->tree.node);
|
wlr_scene_node_destroy(&scene->tree.node);
|
||||||
@@ -1381,8 +1391,10 @@ keypress(struct wl_listener *listener, void *data)
|
@@ -1582,16 +1590,19 @@ keypress(struct wl_listener *listener, void *data)
|
||||||
|
/* This event is raised when a key is pressed or released. */
|
||||||
|
KeyboardGroup *group = wl_container_of(listener, group, key);
|
||||||
|
struct wlr_keyboard_key_event *event = data;
|
||||||
|
+ int nsyms, handled;
|
||||||
|
|
||||||
|
/* Translate libinput keycode -> xkbcommon */
|
||||||
uint32_t keycode = event->keycode + 8;
|
uint32_t keycode = event->keycode + 8;
|
||||||
/* Get a list of keysyms based on the keymap for this keyboard */
|
/* Get a list of keysyms based on the keymap for this keyboard */
|
||||||
const xkb_keysym_t *syms;
|
const xkb_keysym_t *syms;
|
||||||
+ int shift = xkb_state_mod_index_is_active(
|
- int nsyms = xkb_state_key_get_syms(
|
||||||
+ group->wlr_group->keyboard.xkb_state, en_shift, XKB_STATE_MODS_EFFECTIVE);
|
|
||||||
int nsyms = xkb_state_key_get_syms(
|
|
||||||
- group->wlr_group->keyboard.xkb_state, keycode, &syms);
|
- group->wlr_group->keyboard.xkb_state, keycode, &syms);
|
||||||
+ shift ? en_state_shift : en_state, keycode, &syms);
|
-
|
||||||
|
- int handled = 0;
|
||||||
int handled = 0;
|
|
||||||
uint32_t mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard);
|
uint32_t mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard);
|
||||||
@@ -2323,6 +2335,13 @@ setup(void)
|
+ xkb_state_update_key(en_state, keycode,
|
||||||
|
+ (event->state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||||
|
+ ? XKB_KEY_DOWN : XKB_KEY_UP);
|
||||||
|
+ nsyms = xkb_state_key_get_syms(en_state, keycode, &syms);
|
||||||
|
+
|
||||||
|
+ handled = 0;
|
||||||
|
|
||||||
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
|
||||||
|
@@ -2607,6 +2618,10 @@ setup(void)
|
||||||
* pointer, touch, and drawing tablet device. We also rig up a listener to
|
* pointer, touch, and drawing tablet device. We also rig up a listener to
|
||||||
* let us know when new input devices are available on the backend.
|
* let us know when new input devices are available on the backend.
|
||||||
*/
|
*/
|
||||||
@ -55,12 +65,9 @@ index 632dabf..858318a 100644
|
|||||||
+ en_keymap = xkb_keymap_new_from_names(en_context, &en_rules,
|
+ en_keymap = xkb_keymap_new_from_names(en_context, &en_rules,
|
||||||
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
|
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
+ en_state = xkb_state_new(en_keymap);
|
+ en_state = xkb_state_new(en_keymap);
|
||||||
+ en_state_shift = xkb_state_new(en_keymap);
|
|
||||||
+ en_shift = xkb_keymap_mod_get_index(en_keymap, XKB_MOD_NAME_SHIFT);
|
|
||||||
+ xkb_state_update_mask(en_state_shift, 1 << en_shift, 0, 0, 0, 0, 0);
|
|
||||||
LISTEN_STATIC(&backend->events.new_input, inputdevice);
|
LISTEN_STATIC(&backend->events.new_input, inputdevice);
|
||||||
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
|
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
|
||||||
LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard);
|
LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard);
|
||||||
--
|
--
|
||||||
2.43.0
|
2.48.1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user