mirror of https://github.com/qt/qtbase.git
Add QWaylandApplication::xkbContext()
It is necessary for the apps that want to manually parse the stream of events from wl_keyborad. Change-Id: I8229ae6e43640d0e7b9597f5f7b35cba59db0f64 Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
1b4abf645a
commit
b5147dca11
|
@ -1245,7 +1245,7 @@ qt_feature("system-xcb-xinput" PRIVATE SYSTEM_LIBRARY
|
||||||
DISABLE INPUT_bundled_xcb_xinput STREQUAL 'yes'
|
DISABLE INPUT_bundled_xcb_xinput STREQUAL 'yes'
|
||||||
EMIT_IF QT_FEATURE_xcb
|
EMIT_IF QT_FEATURE_xcb
|
||||||
)
|
)
|
||||||
qt_feature("xkbcommon" PRIVATE
|
qt_feature("xkbcommon" PUBLIC
|
||||||
LABEL "xkbcommon"
|
LABEL "xkbcommon"
|
||||||
CONDITION XKB_FOUND
|
CONDITION XKB_FOUND
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,6 +30,11 @@ struct wl_seat;
|
||||||
struct wl_keyboard;
|
struct wl_keyboard;
|
||||||
struct wl_pointer;
|
struct wl_pointer;
|
||||||
struct wl_touch;
|
struct wl_touch;
|
||||||
|
|
||||||
|
#if QT_CONFIG(xkbcommon)
|
||||||
|
struct xkb_context;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_VISIONOS) || defined(Q_QDOC)
|
#if defined(Q_OS_VISIONOS) || defined(Q_QDOC)
|
||||||
|
@ -74,6 +79,9 @@ struct Q_GUI_EXPORT QWaylandApplication
|
||||||
virtual wl_touch *touch() const = 0;
|
virtual wl_touch *touch() const = 0;
|
||||||
virtual uint lastInputSerial() const = 0;
|
virtual uint lastInputSerial() const = 0;
|
||||||
virtual wl_seat *lastInputSeat() const = 0;
|
virtual wl_seat *lastInputSeat() const = 0;
|
||||||
|
#if QT_CONFIG(xkbcommon)
|
||||||
|
virtual xkb_context *xkbContext() const = 0;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,11 @@ QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QVxKeyMapper);
|
||||||
\return the seat associated with the default input device.
|
\return the seat associated with the default input device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn struct xkb_context *QNativeInterface::QWaylandApplication::xkbContext() const
|
||||||
|
\return the XKB context associated with the application.
|
||||||
|
*/
|
||||||
|
|
||||||
QT_DEFINE_NATIVE_INTERFACE(QWaylandApplication);
|
QT_DEFINE_NATIVE_INTERFACE(QWaylandApplication);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -64,6 +64,11 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
|
||||||
return touch->wl_touch();
|
return touch->wl_touch();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#if QT_CONFIG(xkbcommon)
|
||||||
|
if (lowerCaseResource == "xkb_context") {
|
||||||
|
return m_integration->display()->xkbContext();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (lowerCaseResource == "serial")
|
if (lowerCaseResource == "serial")
|
||||||
return reinterpret_cast<void *>(quintptr(m_integration->display()->defaultInputDevice()->serial()));
|
return reinterpret_cast<void *>(quintptr(m_integration->display()->defaultInputDevice()->serial()));
|
||||||
|
|
||||||
|
@ -126,6 +131,13 @@ wl_seat *QtWaylandClient::QWaylandNativeInterface::lastInputSeat() const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_CONFIG(xkbcommon)
|
||||||
|
struct xkb_context *QtWaylandClient::QWaylandNativeInterface::xkbContext() const
|
||||||
|
{
|
||||||
|
return m_integration->display()->xkbContext();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
|
void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
|
||||||
{
|
{
|
||||||
QByteArray lowerCaseResource = resourceString.toLower();
|
QByteArray lowerCaseResource = resourceString.toLower();
|
||||||
|
|
|
@ -62,6 +62,9 @@ public:
|
||||||
wl_touch *touch() const override;
|
wl_touch *touch() const override;
|
||||||
uint lastInputSerial() const override;
|
uint lastInputSerial() const override;
|
||||||
wl_seat *lastInputSeat() const override;
|
wl_seat *lastInputSeat() const override;
|
||||||
|
#if QT_CONFIG(xkbcommon)
|
||||||
|
struct xkb_context *xkbContext() const override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void setWindowMargins(QWindow *window, const QMargins &margins);
|
static void setWindowMargins(QWindow *window, const QMargins &margins);
|
||||||
|
|
Loading…
Reference in New Issue