Merge pull request #113256 from deralmas/wl-keyboard-stuff

Wayland: Misc keyboard touchups
This commit is contained in:
Rémi Verschelde 2025-12-16 11:26:31 +01:00
commit 61b5f80a50
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 16 additions and 3 deletions

View File

@ -1680,6 +1680,16 @@ void WaylandThread::_wl_seat_on_capabilities(void *data, struct wl_seat *wl_seat
ss->xkb_compose_state = nullptr;
}
if (ss->xkb_keymap) {
xkb_keymap_unref(ss->xkb_keymap);
ss->xkb_keymap = nullptr;
}
if (ss->xkb_state) {
xkb_state_unref(ss->xkb_state);
ss->xkb_state = nullptr;
}
if (ss->wl_keyboard) {
wl_keyboard_destroy(ss->wl_keyboard);
ss->wl_keyboard = nullptr;
@ -2309,7 +2319,7 @@ void WaylandThread::_wl_keyboard_on_repeat_info(void *data, struct wl_keyboard *
SeatState *ss = (SeatState *)data;
ERR_FAIL_NULL(ss);
ss->repeat_key_delay_msec = 1000 / rate;
ss->repeat_key_delay_msec = rate ? 1000 / rate : 0;
ss->repeat_start_delay_msec = delay;
}

View File

@ -480,8 +480,11 @@ public:
xkb_layout_index_t current_layout_index = 0;
int32_t repeat_key_delay_msec = 0;
int32_t repeat_start_delay_msec = 0;
// Clients with `wl_seat`s older than version 4 do not support
// `wl_keyboard::repeat_info`, so we'll provide a reasonable default of 25
// keys per second, with a start delay of 600 milliseconds.
int32_t repeat_key_delay_msec = 1000 / 25;
int32_t repeat_start_delay_msec = 600;
xkb_keycode_t repeating_keycode = XKB_KEYCODE_INVALID;
uint64_t last_repeat_start_msec = 0;