From a03b6fa08f22084decff5716fd5d7c18e1ebd554 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Wed, 8 Mar 2023 19:31:03 -0800 Subject: [PATCH] Forward keymap and modifier change to input method keyboard grab when changed. --- src/xkb.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/xkb.cpp b/src/xkb.cpp index 229909363d..f2dc60c822 100644 --- a/src/xkb.cpp +++ b/src/xkb.cpp @@ -8,8 +8,10 @@ */ #include "xkb.h" #include "dbusproperties_interface.h" +#include "inputmethod.h" #include "utils/c_ptr.h" #include "utils/common.h" +#include "wayland/inputmethod_v1_interface.h" #include "wayland/keyboard_interface.h" #include "wayland/seat_interface.h" // frameworks @@ -328,6 +330,9 @@ void Xkb::updateKeymap(xkb_keymap *keymap) createKeymapFile(); forwardModifiers(); + if (auto *inputmethod = kwinApp()->inputMethod()) { + inputmethod->forwardModifiers(InputMethod::Force); + } updateModifiers(); } @@ -338,6 +343,13 @@ void Xkb::createKeymapFile() return; } m_seat->keyboard()->setKeymap(currentKeymap); + auto *inputmethod = kwinApp()->inputMethod(); + if (!inputmethod) { + return; + } + if (auto *keyboardGrab = inputmethod->keyboardGrab()) { + keyboardGrab->sendKeymap(currentKeymap); + } } QByteArray Xkb::keymapContents() const