client: reimplement QPlatformIntegration::possibleKeys()
This is required to trigger more complex shortcut sequences. For example, with 'us' keyboard layout to enter '%' or '+' you have to press 'Shift' button. Previosly the following shortcuts could not be triggered: 'Shift' + '5' '%' 'Ctrl' + '+' 'Ctrl' + 'Shift' + '=' The same function also ensures that these shortcuts work with non-latin keyboard layouts. Change-Id: Id50c7bb28cf76b9f7a861ced7894b2cacae6ed65 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
e70fd9016d
commit
f7eada4f19
@ -476,6 +476,17 @@ QPointF QWaylandInputDevice::pointerSurfacePosition() const
|
||||
return mPointer ? mPointer->mSurfacePos : QPointF();
|
||||
}
|
||||
|
||||
QList<int> QWaylandInputDevice::possibleKeys(const QKeyEvent *event) const
|
||||
{
|
||||
#if QT_CONFIG(xkbcommon)
|
||||
if (mKeyboard && mKeyboard->mXkbState)
|
||||
return QXkbCommon::possibleKeys(mKeyboard->mXkbState.get(), event);
|
||||
#else
|
||||
Q_UNUSED(event);
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
||||
Qt::KeyboardModifiers QWaylandInputDevice::modifiers() const
|
||||
{
|
||||
if (!mKeyboard)
|
||||
|
@ -124,6 +124,8 @@ public:
|
||||
QWaylandWindow *keyboardFocus() const;
|
||||
QWaylandWindow *touchFocus() const;
|
||||
|
||||
QList<int> possibleKeys(const QKeyEvent *event) const;
|
||||
|
||||
QPointF pointerSurfacePosition() const;
|
||||
|
||||
Qt::KeyboardModifiers modifiers() const;
|
||||
@ -245,6 +247,7 @@ private:
|
||||
QXkbCommon::ScopedXKBKeymap mXkbKeymap;
|
||||
QXkbCommon::ScopedXKBState mXkbState;
|
||||
#endif
|
||||
friend class QWaylandInputDevice;
|
||||
};
|
||||
|
||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer
|
||||
|
@ -293,6 +293,13 @@ QWaylandDisplay *QWaylandIntegration::display() const
|
||||
return mDisplay.data();
|
||||
}
|
||||
|
||||
QList<int> QWaylandIntegration::possibleKeys(const QKeyEvent *event) const
|
||||
{
|
||||
if (auto *seat = mDisplay->currentInputDevice())
|
||||
return seat->possibleKeys(event);
|
||||
return {};
|
||||
}
|
||||
|
||||
QStringList QWaylandIntegration::themeNames() const
|
||||
{
|
||||
return GenericWaylandTheme::themeNames();
|
||||
|
@ -106,6 +106,8 @@ public:
|
||||
|
||||
QWaylandDisplay *display() const;
|
||||
|
||||
QList<int> possibleKeys(const QKeyEvent *event) const override;
|
||||
|
||||
QStringList themeNames() const override;
|
||||
|
||||
QPlatformTheme *createPlatformTheme(const QString &name) const override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user