From dff485f13b9c00606957a729315e7bd4a0294745 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 30 Sep 2021 17:23:07 -0400 Subject: [PATCH] TextInputV2: Add API to set modifiers map on clients --- src/wayland/textinput_v2_interface.cpp | 21 +++++++++++++++++++++ src/wayland/textinput_v2_interface.h | 5 +++++ src/wayland/textinput_v2_interface_p.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/src/wayland/textinput_v2_interface.cpp b/src/wayland/textinput_v2_interface.cpp index 5ed9bb9068..004567ee7b 100644 --- a/src/wayland/textinput_v2_interface.cpp +++ b/src/wayland/textinput_v2_interface.cpp @@ -301,6 +301,17 @@ void TextInputV2InterfacePrivate::sendLanguage() } } +void TextInputV2InterfacePrivate::sendModifiersMap() +{ + if (!surface) { + return; + } + const QList textInputs = textInputsForClient(surface->client()); + for (auto resource : textInputs) { + send_modifiers_map(resource->handle, modifiersMap); + } +} + TextInputV2InterfacePrivate::TextInputV2InterfacePrivate(SeatInterface *seat, TextInputV2Interface *_q) : seat(seat) , q(_q) @@ -489,6 +500,16 @@ void TextInputV2Interface::setLanguage(const QString &languageTag) d->sendLanguage(); } +void TextInputV2Interface::setModifiersMap(const QByteArray &modifiersMap) +{ + if (d->modifiersMap == modifiersMap) { + // not changed + return; + } + d->modifiersMap = modifiersMap; + d->sendModifiersMap(); +} + QPointer TextInputV2Interface::surface() const { return d->surface; diff --git a/src/wayland/textinput_v2_interface.h b/src/wayland/textinput_v2_interface.h index b009123ee6..f0c3530b22 100644 --- a/src/wayland/textinput_v2_interface.h +++ b/src/wayland/textinput_v2_interface.h @@ -211,6 +211,11 @@ public: */ void setLanguage(const QString &languageTag); + /** + * Sets the modifiers map to use when modifiers are included in a key event. + */ + void setModifiersMap(const QByteArray &modifiersMap); + Q_SIGNALS: /** * Requests input panels (virtual keyboard) to show. diff --git a/src/wayland/textinput_v2_interface_p.h b/src/wayland/textinput_v2_interface_p.h index f69dac359b..1498989e75 100644 --- a/src/wayland/textinput_v2_interface_p.h +++ b/src/wayland/textinput_v2_interface_p.h @@ -46,6 +46,7 @@ public: void keysymReleased(quint32 keysym, quint32 modifiers); void sendInputPanelState(); void sendLanguage(); + void sendModifiersMap(); QList textInputsForClient(ClientConnection *client) const; static TextInputV2InterfacePrivate *get(TextInputV2Interface *inputInterface) @@ -65,6 +66,7 @@ public: bool inputPanelVisible = false; QRect overlappedSurfaceArea; QString language; + QByteArray modifiersMap; TextInputV2Interface *q; QSet m_enabledSurfaces;