opt: Optimize the mod key state of the virtual keyboard

This commit is contained in:
DreamMaoMao 2025-08-16 10:41:58 +08:00
parent 6927d1f6c2
commit 045e1607cb
2 changed files with 31 additions and 16 deletions

View file

@ -111,8 +111,7 @@ get_keyboard_grab(KeyboardGroup *keyboard) {
return NULL;
}
// 如果键盘不是物理键盘组的键盘则返回NULL
// kb_group是一个物理键盘组它的键盘是物理键盘
// kb_group是一个物理键盘组它不应该被过滤掉
if (keyboard != kb_group)
return NULL;
@ -349,9 +348,7 @@ static void handle_input_method_grab_keyboard(struct wl_listener *listener,
wl_container_of(listener, relay, input_method_grab_keyboard);
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data;
// 活动键盘应该是从物理键盘组中获取的,
// wlr_seat_get_keyboard可能获取到的是虚拟键盘所以会造成设置错误
struct wlr_keyboard *active_keyboard = &kb_group->wlr_group->keyboard;
struct wlr_keyboard *active_keyboard = wlr_seat_get_keyboard(seat);
if (!is_keyboard_emulated_by_input_method(active_keyboard,
relay->input_method)) {