TextInputV2: Add API to set modifiers map on clients

This commit is contained in:
Rodney Dawes 2021-09-30 17:23:07 -04:00
parent b58cc08a36
commit dff485f13b
3 changed files with 28 additions and 0 deletions

View file

@ -301,6 +301,17 @@ void TextInputV2InterfacePrivate::sendLanguage()
} }
} }
void TextInputV2InterfacePrivate::sendModifiersMap()
{
if (!surface) {
return;
}
const QList<Resource *> textInputs = textInputsForClient(surface->client());
for (auto resource : textInputs) {
send_modifiers_map(resource->handle, modifiersMap);
}
}
TextInputV2InterfacePrivate::TextInputV2InterfacePrivate(SeatInterface *seat, TextInputV2Interface *_q) TextInputV2InterfacePrivate::TextInputV2InterfacePrivate(SeatInterface *seat, TextInputV2Interface *_q)
: seat(seat) : seat(seat)
, q(_q) , q(_q)
@ -489,6 +500,16 @@ void TextInputV2Interface::setLanguage(const QString &languageTag)
d->sendLanguage(); d->sendLanguage();
} }
void TextInputV2Interface::setModifiersMap(const QByteArray &modifiersMap)
{
if (d->modifiersMap == modifiersMap) {
// not changed
return;
}
d->modifiersMap = modifiersMap;
d->sendModifiersMap();
}
QPointer<SurfaceInterface> TextInputV2Interface::surface() const QPointer<SurfaceInterface> TextInputV2Interface::surface() const
{ {
return d->surface; return d->surface;

View file

@ -211,6 +211,11 @@ public:
*/ */
void setLanguage(const QString &languageTag); 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: Q_SIGNALS:
/** /**
* Requests input panels (virtual keyboard) to show. * Requests input panels (virtual keyboard) to show.

View file

@ -46,6 +46,7 @@ public:
void keysymReleased(quint32 keysym, quint32 modifiers); void keysymReleased(quint32 keysym, quint32 modifiers);
void sendInputPanelState(); void sendInputPanelState();
void sendLanguage(); void sendLanguage();
void sendModifiersMap();
QList<Resource *> textInputsForClient(ClientConnection *client) const; QList<Resource *> textInputsForClient(ClientConnection *client) const;
static TextInputV2InterfacePrivate *get(TextInputV2Interface *inputInterface) static TextInputV2InterfacePrivate *get(TextInputV2Interface *inputInterface)
@ -65,6 +66,7 @@ public:
bool inputPanelVisible = false; bool inputPanelVisible = false;
QRect overlappedSurfaceArea; QRect overlappedSurfaceArea;
QString language; QString language;
QByteArray modifiersMap;
TextInputV2Interface *q; TextInputV2Interface *q;
QSet<SurfaceInterface *> m_enabledSurfaces; QSet<SurfaceInterface *> m_enabledSurfaces;