Introduce a configure feature for Wayland

Using the presence of the wayland-client lib as a condition.

Fixes: QTBUG-117386
Change-Id: If4336965ea06e3f4b06e9af661efdec38ba46136
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
David Redondo 2023-12-06 14:39:55 +01:00
parent 6866e6f2fa
commit a2ff329d2e
9 changed files with 22 additions and 12 deletions

View File

@ -62,6 +62,7 @@ qt_find_package(WrapVulkanHeaders PROVIDED_TARGETS WrapVulkanHeaders::WrapVulkan
MODULE_NAME gui QMAKE_LIB vulkan MARK_OPTIONAL)
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(Wayland PROVIDED_TARGETS Wayland::Server MODULE_NAME gui QMAKE_LIB wayland_server)
qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client MODULE_NAME gui QMAKE_LIB wayland_client)
endif()
if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib)
@ -863,7 +864,7 @@ qt_feature("eglfs_rcar" PRIVATE
)
qt_feature("eglfs_viv_wl" PRIVATE
LABEL "EGLFS i.Mx6 Wayland"
CONDITION QT_FEATURE_eglfs_viv AND Wayland_FOUND
CONDITION QT_FEATURE_eglfs_viv AND TARGET Wayland::Server
)
qt_feature("eglfs_openwfd" PRIVATE
LABEL "EGLFS OpenWFD"
@ -1243,6 +1244,11 @@ qt_feature("graphicsframecapture" PRIVATE
CONDITION TEST_renderdoc OR (MACOS OR IOS)
)
qt_feature_definition("undogroup" "QT_NO_UNDOGROUP" NEGATE VALUE "1")
qt_feature("wayland" PUBLIC
SECTION "Platform plugins"
LABEL "Wayland"
CONDITION TARGET Wayland::Client
)
qt_configure_add_summary_section(NAME "Qt Gui")
qt_configure_add_summary_entry(ARGS "accessibility")
qt_configure_add_summary_entry(ARGS "freetype")

View File

@ -4386,7 +4386,7 @@ void *QGuiApplication::resolveInterface(const char *name, int revision) const
#if QT_CONFIG(xcb)
QT_NATIVE_INTERFACE_RETURN_IF(QX11Application, platformNativeInterface());
#endif
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
QT_NATIVE_INTERFACE_RETURN_IF(QWaylandApplication, platformNativeInterface());
#endif

View File

@ -23,7 +23,7 @@ typedef struct _XDisplay Display;
struct xcb_connection_t;
#endif
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
struct wl_display;
struct wl_compositor;
struct wl_seat;
@ -46,7 +46,7 @@ struct Q_GUI_EXPORT QX11Application
};
#endif
#if defined(Q_OS_UNIX) || defined(Q_CLANG_QDOC)
#if QT_CONFIG(wayland) || defined(Q_QDOC)
struct Q_GUI_EXPORT QWaylandApplication
{
QT_DECLARE_NATIVE_INTERFACE(QWaylandApplication, 1, QGuiApplication)

View File

@ -24,7 +24,7 @@
#include <qwindowdefs_win.h>
#endif
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
struct wl_output;
#endif
@ -84,7 +84,7 @@ struct Q_GUI_EXPORT QWindowsScreen
};
#endif
#if defined(Q_OS_UNIX) || defined(Q_CLANG_QDOC)
#if QT_CONFIG(wayland) || defined(Q_QDOC)
struct Q_GUI_EXPORT QWaylandScreen
{
QT_DECLARE_NATIVE_INTERFACE(QWaylandScreen, 1, QScreen)

View File

@ -21,7 +21,7 @@
#include <QtCore/qnativeinterface.h>
#include <QtGui/qwindow.h>
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
#include <any>
#include <QtCore/qobject.h>
@ -106,7 +106,7 @@ struct Q_GUI_EXPORT QWindowsWindow
};
#endif // Q_OS_WIN
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
struct Q_GUI_EXPORT QWaylandWindow : public QObject
{
Q_OBJECT

View File

@ -732,7 +732,7 @@ void *QScreen::resolveInterface(const char *name, int revision) const
QT_NATIVE_INTERFACE_RETURN_IF(QAndroidScreen, platformScreen);
#endif
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
QT_NATIVE_INTERFACE_RETURN_IF(QWaylandScreen, platformScreen);
#endif

View File

@ -3129,7 +3129,7 @@ void *QWindow::resolveInterface(const char *name, int revision) const
QT_NATIVE_INTERFACE_RETURN_IF(QCocoaWindow, platformWindow);
#endif
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
QT_NATIVE_INTERFACE_RETURN_IF(QWaylandWindow, platformWindow);
#endif

View File

@ -418,6 +418,7 @@ QByteArray QGenericUnixServices::desktopEnvironment() const
template<typename F>
void runWithXdgActivationToken(F &&functionToCall)
{
#if QT_CONFIG(wayland)
QWindow *window = qGuiApp->focusWindow();
if (!window) {
@ -439,6 +440,9 @@ void runWithXdgActivationToken(F &&functionToCall)
&QNativeInterface::Private::QWaylandWindow::xdgActivationTokenCreated,
waylandWindow, functionToCall, Qt::SingleShotConnection);
waylandWindow->requestXdgActivationToken(waylandApp->lastInputSerial());
#else
functionToCall({});
#endif
}
bool QGenericUnixServices::openUrl(const QUrl &url)

View File

@ -231,7 +231,7 @@ QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QEvdevKeyMapper);
#endif // QT_CONFIG(evdev)
#if defined(Q_OS_UNIX)
#if QT_CONFIG(wayland)
/*!
\class QNativeInterface::QWaylandApplication
@ -301,6 +301,6 @@ QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWaylandScreen);
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWaylandWindow);
#endif // Q_OS_UNIX
#endif // QT_CONFIG(wayland)
QT_END_NAMESPACE