mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-27 10:14:16 +00:00
remove old en-keycodes patch
This commit is contained in:
parent
4cf16ae5c5
commit
f8a98de76a
@ -1,63 +0,0 @@
|
|||||||
From eceb8adcd3321e6bc71b45f54b1a78b6183e92f2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
|
||||||
Date: Sun, 12 Nov 2023 23:34:25 +0100
|
|
||||||
Subject: [PATCH] Always use the English keymap to get keycodes
|
|
||||||
|
|
||||||
---
|
|
||||||
dwl.c | 21 ++++++++++++++++++++-
|
|
||||||
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index a7d41b085..4978cfac5 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -367,6 +367,12 @@ static struct wlr_box sgeom;
|
|
||||||
static struct wl_list mons;
|
|
||||||
static Monitor *selmon;
|
|
||||||
|
|
||||||
+static const struct xkb_rule_names en_rules = {.layout = "us"};
|
|
||||||
+static struct xkb_context *en_context;
|
|
||||||
+static struct xkb_keymap *en_keymap;
|
|
||||||
+static struct xkb_state *en_state, *en_state_shift;
|
|
||||||
+static xkb_mod_index_t en_shift;
|
|
||||||
+
|
|
||||||
/* global event handlers */
|
|
||||||
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
|
||||||
static struct wl_listener cursor_button = {.notify = buttonpress};
|
|
||||||
@@ -669,6 +675,10 @@ cleanup(void)
|
|
||||||
wlr_output_layout_destroy(output_layout);
|
|
||||||
wlr_seat_destroy(seat);
|
|
||||||
wl_display_destroy(dpy);
|
|
||||||
+ xkb_state_unref(en_state);
|
|
||||||
+ xkb_state_unref(en_state_shift);
|
|
||||||
+ xkb_keymap_unref(en_keymap);
|
|
||||||
+ xkb_context_unref(en_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
@@ -1419,8 +1429,10 @@ keypress(struct wl_listener *listener, void *data)
|
|
||||||
uint32_t keycode = event->keycode + 8;
|
|
||||||
/* Get a list of keysyms based on the keymap for this keyboard */
|
|
||||||
const xkb_keysym_t *syms;
|
|
||||||
+ int shift = xkb_state_mod_index_is_active(
|
|
||||||
+ kb->wlr_keyboard->xkb_state, en_shift, XKB_STATE_MODS_EFFECTIVE);
|
|
||||||
int nsyms = xkb_state_key_get_syms(
|
|
||||||
- kb->wlr_keyboard->xkb_state, keycode, &syms);
|
|
||||||
+ shift ? en_state_shift : en_state, keycode, &syms);
|
|
||||||
|
|
||||||
int handled = 0;
|
|
||||||
uint32_t mods = wlr_keyboard_get_modifiers(kb->wlr_keyboard);
|
|
||||||
@@ -2279,6 +2291,13 @@ setup(void)
|
|
||||||
* let us know when new input devices are available on the backend.
|
|
||||||
*/
|
|
||||||
wl_list_init(&keyboards);
|
|
||||||
+ en_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
|
||||||
+ en_keymap = xkb_keymap_new_from_names(en_context, &en_rules,
|
|
||||||
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
|
|
||||||
+ 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);
|
|
||||||
wl_signal_add(&backend->events.new_input, &new_input);
|
|
||||||
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
|
|
||||||
wl_signal_add(&virtual_keyboard_mgr->events.new_virtual_keyboard,
|
|
||||||
Loading…
x
Reference in New Issue
Block a user