diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 34955dfbbe2..7482cfd6bbd 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -15,26 +15,10 @@ use_gold_linker: CONFIG += no_linker_version_script CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner -contains(QT_CONFIG, opengl) { - DEFINES += QT_WAYLAND_GL_SUPPORT -} +qtConfig(xkbcommon-evdev): \ + QMAKE_USE_PRIVATE += xkbcommon_evdev -config_xkbcommon { - !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG_PRIVATE += xkbcommon - } else { - LIBS_PRIVATE += -lxkbcommon - } -} else { - DEFINES += QT_NO_WAYLAND_XKB -} - -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG_PRIVATE += wayland-client wayland-cursor - contains(QT_CONFIG, glib): PKGCONFIG_PRIVATE += glib-2.0 -} else { - LIBS_PRIVATE += -lwayland-client -lwayland-cursor $$QT_LIBS_GLIB -} +QMAKE_USE += wayland-client wayland-cursor INCLUDEPATH += $$PWD/../shared @@ -66,7 +50,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwlshellintegration.cpp \ qwaylandxdgshell.cpp \ qwaylandxdgsurface.cpp \ - qwaylandxdgpopup_p.cpp \ + qwaylandxdgpopup.cpp \ qwaylandxdgshellintegration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ @@ -117,7 +101,8 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputcontext_p.h \ qwaylanddatadevice_p.h \ qwaylandshm_p.h \ - qwaylandclientexport.h \ + qtwaylandclientglobal.h \ + qtwaylandclientglobal_p.h \ ../shared/qwaylandinputmethodeventbuilder_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json new file mode 100644 index 00000000000..b2a8fbc0b3e --- /dev/null +++ b/src/plugins/platforms/wayland/configure.json @@ -0,0 +1,134 @@ +{ + "module": "waylandclient", + "depends": [ + "gui-private" + ], + "testDir": "../../config.tests", + + "libraries": { + "wayland-client": { + "label": "Wayland client library", + "test": "wayland", + "sources": [ + { "type": "pkgConfig", "args": "wayland-client" }, + "-lwayland-client" + ] + }, + "wayland-cursor": { + "label": "Wayland cursor library", + "test": "wayland_cursor", + "use": "wayland-client", + "sources": [ + { "type": "pkgConfig", "args": "wayland-cursor" }, + "-lwayland-cursor" + ] + }, + "wayland-egl": { + "label": "Wayland EGL library", + "test": "wayland_egl", + "sources": [ + { "type": "pkgConfig", "args": "wayland-egl" }, + "-lwayland-egl" + ] + }, + "xcomposite": { + "label": "XComposite", + "test": "xcomposite", + "sources": [ + { "type": "pkgConfig", "args": "xcomposite" }, + "-lxcomposite" + ] + }, + "glx": { + "label": "GLX", + "test": "glx", + "sources": [ + { "type": "pkgConfig", "args": "x11 gl" }, + "-lX11 -lGl" + ] + } + }, + + "tests": { + "wayland-scanner": { + "label": "wayland-scanner", + "type": "compile", + "test": "wayland_scanner", + "use": "wayland-client" + }, + "drm-egl-server": { + "label": "DRM EGL Server", + "type": "compile", + "test": "drm_egl_server", + "use": "egl" + }, + "libhybris-egl-server": { + "label": "libhybris EGL Server", + "type": "compile", + "test": "libhybris_egl_server", + "use": "egl" + } + }, + + "features": { + "wayland-client": { + "label": "Qt Wayland Client", + "condition": "!config.win32 && libs.wayland-client && libs.wayland-cursor && tests.wayland-scanner", + "output": [ "privateFeature" ] + }, + "wayland-egl": { + "label": "EGL", + "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", + "output": [ "privateFeature" ] + }, + "wayland-brcm": { + "label": "Rasberry Pi", + "condition": "features.wayland-client && features.eglfs_brcm", + "output": [ "privateFeature" ] + }, + "xcomposite-egl": { + "label": "XComposite EGL", + "condition": "features.wayland-client && features.opengl && features.egl && libs.xcomposite", + "output": [ "privateFeature" ] + }, + "xcomposite-glx": { + "label": "XComposite GLX", + "condition": "features.wayland-client && features.opengl && !features.opengles2 && libs.xcomposite && libs.glx", + "output": [ "privateFeature" ] + }, + "drm-egl-server": { + "label": "DRM EGL", + "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server", + "output": [ "privateFeature" ] + }, + "libhybris-egl-server": { + "label": "libhybris EGL", + "condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server", + "output": [ "privateFeature" ] + } + }, + + "report": [ + { + "type": "note", + "condition": "!libs.wayland-egl", + "message": "No wayland-egl support detected. Cross-toolkit compatibility disabled." + } + ], + + "summary": [ + { + "section": "Qt Wayland Drivers", + "condition": "features.wayland-client", + "entries": [ + "wayland-egl", + "wayland-brcm", + "xcomposite-egl", + "xcomposite-glx", + "drm-egl-server", + "libhybris-egl-server" + ] + }, + "wayland-client" + ] +} diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index d1610c271e3..37345202cc8 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -38,7 +38,7 @@ #define QWAYLANDCLIENTEXTENSION_H #include -#include +#include struct wl_registry; diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index adaf2902a24..f1f0cf93282 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index aa197e3d104..4e7e7ee5cac 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPa QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index c70a2bd56a5..7eaeed16cc1 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 2830f95fa9a..6496b33ed3c 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index db9e19ac9de..8b4a7162927 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index e3943da805f..67f857db890 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -55,7 +55,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index dfa0b465485..527dc571a2e 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPa QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index f17856208b2..600c24c9bc3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 7eaaa1700cc..b3ed3ccc5bf 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index ada63b713cb..1fa0fd6de72 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index de303d009c2..c069a3645a4 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPat QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index d6d0e843c6b..80096e7900f 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index c4a578d2e21..2d9961dba65 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro index 0f62db9cc9d..843149e0836 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro @@ -5,12 +5,7 @@ OTHER_FILES += \ SOURCES += main.cpp -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-client -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client -} +QMAKE_USE += wayland-client PLUGIN_TYPE = wayland-decoration-client load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index f7ce0fca6f0..f57b816e845 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -56,7 +56,7 @@ namespace QtWaylandClient { #define BUTTON_SPACING 5 -#ifndef QT_NO_IMAGEFORMAT_XPM +#if QT_CONFIG(imageformat_xpm) # define BUTTON_WIDTH 10 static const char * const qt_close_xpm[] = { @@ -265,7 +265,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.restore(); } -#ifndef QT_NO_IMAGEFORMAT_XPM +#if QT_CONFIG(imageformat_xpm) p.save(); // Close button diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 37a90ab0d44..a5967c710dd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -1,21 +1,15 @@ TEMPLATE=subdirs +QT_FOR_CONFIG += waylandclient-private -config_wayland_egl: \ +qtConfig(wayland-egl): \ SUBDIRS += wayland-egl - -config_brcm_egl: \ +qtConfig(wayland-brcm): \ SUBDIRS += brcm-egl - -config_xcomposite { - contains(QT_CONFIG, egl): \ - SUBDIRS += xcomposite-egl - - !contains(QT_CONFIG, opengles2):config_glx: \ - SUBDIRS += xcomposite-glx -} - -config_drm_egl_server: \ +qtConfig(xcomposite-egl): \ + SUBDIRS += xcomposite-egl +qtConfig(xcomposite-glx): \ + SUBDIRS += xcomposite-glx +qtConfig(drm-egl-server): \ SUBDIRS += drm-egl-server - -config_libhybris_egl_server: \ +qtConfig(libhybris-egl-server): \ SUBDIRS += libhybris-egl-server diff --git a/src/plugins/platforms/wayland/qwaylandclientexport.h b/src/plugins/platforms/wayland/qtwaylandclientglobal.h similarity index 93% rename from src/plugins/platforms/wayland/qwaylandclientexport.h rename to src/plugins/platforms/wayland/qtwaylandclientglobal.h index f49f1aee9a4..5f474f378b9 100644 --- a/src/plugins/platforms/wayland/qwaylandclientexport.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDCLIENTEXPORT_H -#define QWAYLANDCLIENTEXPORT_H +#ifndef QWAYLANDCLIENTGLOBAL_H +#define QWAYLANDCLIENTGLOBAL_H // // W A R N I N G @@ -51,7 +51,8 @@ // We mean it. // -#include +#include +#include QT_BEGIN_NAMESPACE @@ -65,5 +66,5 @@ QT_BEGIN_NAMESPACE QT_END_NAMESPACE -#endif //QWAYLANDCLIENTEXPORT_H +#endif //QWAYLANDCLIENTGLOBAL_H diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h new file mode 100644 index 00000000000..f2106d0b875 --- /dev/null +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTGLOBAL_P_H +#define QWAYLANDCLIENTGLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +#endif //QWAYLANDCLIENTGLOBAL_P_H + diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 3220dab9ccc..42c65be64cc 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 8d651f82369..9e8cba2e490 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 2e3c204c406..68fb737ccb0 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -44,6 +44,8 @@ #include "qwaylanddatasource_p.h" #include "qwaylanddatadevice_p.h" +#if QT_CONFIG(draganddrop) + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -60,11 +62,11 @@ QWaylandClipboard::~QWaylandClipboard() QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) { if (mode != QClipboard::Clipboard) - return 0; + return &m_emptyData; QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); if (!inputDevice || !inputDevice->dataDevice()) - return 0; + return &m_emptyData; QWaylandDataSource *source = inputDevice->dataDevice()->selectionSource(); if (source) { @@ -74,7 +76,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) if (inputDevice->dataDevice()->selectionOffer()) return inputDevice->dataDevice()->selectionOffer()->mimeData(); - return 0; + return &m_emptyData; } void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) @@ -115,3 +117,5 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const } QT_END_NAMESPACE + +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index aa008eef939..584322e07db 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -53,9 +53,11 @@ #include #include +#include -#include +#include +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -76,10 +78,13 @@ public: private: QWaylandDisplay *mDisplay; + QMimeData m_emptyData; }; } QT_END_NAMESPACE +#endif // draganddrop + #endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 11333d34ddf..a7d188f5669 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -53,7 +53,7 @@ #include #include -#include +#include struct wl_cursor; struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index d04c20bf4d6..b76647ea2d0 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -56,6 +56,8 @@ #include #include +#if QT_CONFIG(draganddrop) + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -268,3 +270,5 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con } QT_END_NAMESPACE + +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 7daa9f0d3c8..0b16f97d2c0 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -52,12 +52,15 @@ // We mean it. // +#include #include #include #include #include +#if QT_CONFIG(draganddrop) + QT_BEGIN_NAMESPACE class QMimeData; @@ -120,4 +123,6 @@ private: QT_END_NAMESPACE +#endif // draganddrop + #endif // QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 35d67307fc3..c398b86fd5f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -46,6 +46,8 @@ #include +#if QT_CONFIG(draganddrop) + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -80,3 +82,5 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const } QT_END_NAMESPACE + +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 0c1d95d8223..e7fc2113a35 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -51,9 +51,11 @@ // We mean it. // -#include +#include #include +#if QT_CONFIG(draganddrop) + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -81,4 +83,6 @@ private: QT_END_NAMESPACE +#endif // draganddrop + #endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 2491c658b12..56a18f007d3 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -47,6 +47,8 @@ #include +#if QT_CONFIG(draganddrop) + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -181,3 +183,5 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const } QT_END_NAMESPACE + +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 5e635c1a0db..96799c861e8 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -53,9 +53,10 @@ #include -#include +#include #include +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -105,5 +106,5 @@ private: } QT_END_NAMESPACE - +#endif // draganddrop #endif diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 40beea317cd..036bd0d8651 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -49,6 +49,8 @@ #include +#if QT_CONFIG(draganddrop) + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -96,3 +98,5 @@ void QWaylandDataSource::data_source_target(const QString &mime_type) } QT_END_NAMESPACE + +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index c099ff62a49..540e6ad7a1d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -54,7 +54,9 @@ #include #include -#include +#include + +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -92,4 +94,6 @@ private: QT_END_NAMESPACE +#endif // draganddrop + #endif // QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 43c712fc092..1279e3039f6 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandDecorationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandDecorationFactory::keys(const QString &pluginPath) QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 9d4e7a9fb0d..606d9b89c2f 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index dd33f3416da..c549b24bee9 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 3fd2aa56515..534373b1606 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -120,7 +120,9 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) +#if QT_CONFIG(draganddrop) , mDndSelectionHandler(0) +#endif , mWindowExtension(0) , mSubCompositor(0) , mTouchExtension(0) @@ -158,7 +160,9 @@ QWaylandDisplay::~QWaylandDisplay(void) mWaylandIntegration->destroyScreen(screen); } mScreens.clear(); +#if QT_CONFIG(draganddrop) delete mDndSelectionHandler.take(); +#endif wl_display_disconnect(mDisplay); } @@ -251,8 +255,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id); mInputDevices.append(inputDevice); +#if QT_CONFIG(draganddrop) } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); +#endif } else if (interface == QStringLiteral("qt_surface_extension")) { mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); } else if (interface == QStringLiteral("wl_subcompositor")) { @@ -413,11 +419,7 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic if (mLastKeyboardFocus == keyboardFocus) return; - if (keyboardFocus && !keyboardFocus->shellManagesActiveState()) - handleWindowActivated(keyboardFocus); - - if (mLastKeyboardFocus && !mLastKeyboardFocus->shellManagesActiveState()) - handleWindowDeactivated(mLastKeyboardFocus); + mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); mLastKeyboardFocus = keyboardFocus; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 2864b357d80..a4631b95f84 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -61,7 +61,7 @@ #include #include -#include +#include #include #include @@ -137,9 +137,9 @@ public: QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } - +#if QT_CONFIG(draganddrop) QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } - +#endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } @@ -202,7 +202,9 @@ private: QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration; +#if QT_CONFIG(draganddrop) QScopedPointer mDndSelectionHandler; +#endif QScopedPointer mWindowExtension; QScopedPointer mSubCompositor; QScopedPointer mTouchExtension; diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index b59ac6d704c..54c075c4a3b 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -50,7 +50,7 @@ #include QT_BEGIN_NAMESPACE - +#if QT_CONFIG(draganddrop) namespace QtWaylandClient { QWaylandDrag::QWaylandDrag(QWaylandDisplay *display) @@ -98,7 +98,7 @@ void QWaylandDrag::drop(const QPoint &globalPos) void QWaylandDrag::endDrag() { - // Do nothing + m_display->currentInputDevice()->handleEndDrag(); } void QWaylandDrag::updateTarget(const QString &mimeType) @@ -131,5 +131,5 @@ void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response) } } - +#endif // draganddrop QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 2ff00b9ffcf..215a8b74d07 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -57,14 +57,14 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE namespace QtWaylandClient { class QWaylandDisplay; - +#if QT_CONFIG(draganddrop) class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag { public: @@ -88,7 +88,7 @@ protected: private: QWaylandDisplay *m_display; }; - +#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 39b85438a16..39dc4fcf05f 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index f490f07ffe5..4e8ef7b6787 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -73,7 +73,7 @@ namespace QtWaylandClient { QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) , mFocus(0) -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) , mXkbContext(0) , mXkbMap(0) , mXkbState(0) @@ -83,7 +83,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); } -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) bool QWaylandInputDevice::Keyboard::createDefaultKeyMap() { if (mXkbContext && mXkbMap && mXkbState) { @@ -125,7 +125,7 @@ void QWaylandInputDevice::Keyboard::releaseKeyMap() QWaylandInputDevice::Keyboard::~Keyboard() { -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) releaseKeyMap(); #endif if (mFocus) @@ -147,6 +147,8 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p) , mEnterSerial(0) , mCursorSerial(0) , mButtons(0) + , mCursorBuffer(nullptr) + , mCursorShape(Qt::BitmapCursor) { } @@ -188,9 +190,11 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mSerial(0) , mTouchDevice(0) { +#if QT_CONFIG(draganddrop) if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } +#endif if (mQDisplay->textInputManager()) { mTextInput = new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat())); @@ -268,6 +272,14 @@ void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) mTouch->mFocus = 0; } +void QWaylandInputDevice::handleEndDrag() +{ + if (mTouch) + mTouch->releasePoints(); + if (mPointer) + mPointer->releaseButtons(); +} + void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) { mDataDevice = device; @@ -322,7 +334,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const { Qt::KeyboardModifiers ret = Qt::NoModifier; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (!mXkbState) return ret; @@ -352,6 +364,10 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen) { + if (cursor.shape() != Qt::BitmapCursor && cursor.shape() == mPointer->mCursorShape) + return; + + mPointer->mCursorShape = cursor.shape(); if (cursor.shape() == Qt::BitmapCursor) { setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot()); return; @@ -369,8 +385,16 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_i void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size) { if (mCaps & WL_SEAT_CAPABILITY_POINTER) { + bool force = mPointer->mEnterSerial > mPointer->mCursorSerial; + + if (!force && mPointer->mCursorBuffer == buffer) + return; + mPixmapCursor.clear(); mPointer->mCursorSerial = mPointer->mEnterSerial; + + mPointer->mCursorBuffer = buffer; + /* Hide cursor */ if (!buffer) { @@ -532,6 +556,14 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time } } +void QWaylandInputDevice::Pointer::releaseButtons() +{ + mButtons = Qt::NoButton; + MotionEvent e(mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); + if (mFocus) + mFocus->handleMouse(mParent, e); +} + class WheelEvent : public QWaylandPointerEvent { public: @@ -570,7 +602,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) { -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { close(fd); return; @@ -670,7 +702,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, if (isDown) mParent->mQDisplay->setLastInputDevice(mParent, serial, window); -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (!createDefaultKeyMap()) { return; } @@ -688,7 +720,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, #endif if (state == WL_KEYBOARD_KEY_STATE_PRESSED -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) && xkb_keymap_key_repeats(mXkbMap, code) #endif ) { @@ -696,7 +728,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, mRepeatCode = code; mRepeatTime = time; mRepeatText = text; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) mRepeatSym = sym; #endif mRepeatTimer.setInterval(400); @@ -710,7 +742,7 @@ void QWaylandInputDevice::Keyboard::repeatKey() { mRepeatTimer.setInterval(25); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) mRepeatSym, mNativeModifiers, #else 0, 0, @@ -718,7 +750,7 @@ void QWaylandInputDevice::Keyboard::repeatKey() mRepeatText, true); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode, -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) mRepeatSym, mNativeModifiers, #else 0, 0, @@ -733,7 +765,7 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, uint32_t group) { Q_UNUSED(serial); -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (mXkbState) xkb_state_update_mask(mXkbState, mods_depressed, mods_latched, mods_locked, @@ -845,6 +877,16 @@ bool QWaylandInputDevice::Touch::allTouchPointsReleased() return true; } +void QWaylandInputDevice::Touch::releasePoints() +{ + Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) { + QWindowSystemInterface::TouchPoint tp = previousPoint; + tp.state = Qt::TouchPointReleased; + mTouchPoints.append(tp); + } + touch_frame(); +} + void QWaylandInputDevice::Touch::touch_frame() { // Copy all points, that are in the previous but not in the current list, as stationary. diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index ea685223d8d..6d458e35ddd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include #include #include @@ -64,7 +65,7 @@ #include -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) #include #include #endif @@ -99,12 +100,12 @@ public: struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } - void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); void setCursor(const QCursor &cursor, QWaylandScreen *screen); void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image); void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); void handleWindowDestroyed(QWaylandWindow *window); + void handleEndDrag(); void setDataDevice(QWaylandDataDevice *device); QWaylandDataDevice *dataDevice() const; @@ -128,6 +129,8 @@ public: virtual Touch *createTouch(QWaylandInputDevice *device); private: + void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); + QWaylandDisplay *mQDisplay; struct wl_display *mDisplay; @@ -192,7 +195,7 @@ public: QWaylandInputDevice *mParent; QWaylandWindow *mFocus; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) xkb_context *mXkbContext; xkb_keymap *mXkbMap; xkb_state *mXkbState; @@ -203,7 +206,7 @@ public: uint32_t mRepeatCode; uint32_t mRepeatTime; QString mRepeatText; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) xkb_keysym_t mRepeatSym; #endif QTimer mRepeatTimer; @@ -214,7 +217,7 @@ private slots: void repeatKey(); private: -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) bool createDefaultKeyMap(); void releaseKeyMap(); #endif @@ -239,6 +242,8 @@ public: uint32_t axis, wl_fixed_t value) Q_DECL_OVERRIDE; + void releaseButtons(); + QWaylandInputDevice *mParent; QWaylandWindow *mFocus; uint32_t mEnterSerial; @@ -246,6 +251,8 @@ public: QPointF mSurfacePos; QPointF mGlobalPos; Qt::MouseButtons mButtons; + wl_buffer *mCursorBuffer; + Qt::CursorShape mCursorShape; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch @@ -271,6 +278,7 @@ public: void touch_cancel() Q_DECL_OVERRIDE; bool allTouchPointsReleased(); + void releasePoints(); QWaylandInputDevice *mParent; QWaylandWindow *mFocus; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3e263061019..748f4f29c8d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -96,7 +96,7 @@ public: const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); if (desktopEnvironment == QByteArrayLiteral("KDE")) { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) result.push_back(QStringLiteral("kde")); #endif } else if (!desktopEnvironment.isEmpty() && @@ -122,7 +122,7 @@ QWaylandIntegration::QWaylandIntegration() , mInputDeviceIntegration(Q_NULLPTR) , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) , mAccessibility(new QPlatformAccessibility()) #endif , mClientBufferIntegrationInitialized(false) @@ -131,9 +131,10 @@ QWaylandIntegration::QWaylandIntegration() { initializeInputDeviceIntegration(); mDisplay.reset(new QWaylandDisplay(this)); +#if QT_CONFIG(draganddrop) mClipboard.reset(new QWaylandClipboard(mDisplay.data())); mDrag.reset(new QWaylandDrag(mDisplay.data())); - +#endif QString icStr = QPlatformInputContextFactory::requested(); if (!icStr.isNull()) { mInputContext.reset(QPlatformInputContextFactory::create(icStr)); @@ -187,14 +188,14 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons return new QWaylandShmWindow(window); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { if (mDisplay->clientBufferIntegration()) return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); return 0; } -#endif // QT_NO_OPENGL +#endif // opengl QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const { @@ -222,6 +223,7 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const return mFontDb.data(); } +#if QT_CONFIG(draganddrop) QPlatformClipboard *QWaylandIntegration::clipboard() const { return mClipboard.data(); @@ -231,6 +233,7 @@ QPlatformDrag *QWaylandIntegration::drag() const { return mDrag.data(); } +#endif // draganddrop QPlatformInputContext *QWaylandIntegration::inputContext() const { @@ -252,7 +255,7 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const return QPlatformIntegration::styleHint(hint); } -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QPlatformAccessibility *QWaylandIntegration::accessibility() const { return mAccessibility.data(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index bd66f55a775..1689581a2f6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -51,9 +51,8 @@ // We mean it. // +#include #include - -#include #include QT_BEGIN_NAMESPACE @@ -76,7 +75,7 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; #endif QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; @@ -87,16 +86,15 @@ public: QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; - +#if QT_CONFIG(draganddrop) QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; - QPlatformDrag *drag() const Q_DECL_OVERRIDE; - +#endif QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; #endif @@ -114,6 +112,11 @@ public: virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; virtual QWaylandShellIntegration *shellIntegration() const; +private: + // NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration. + // Do not move this definition into the private section at the bottom. + QScopedPointer mDisplay; + protected: QScopedPointer mClientBufferIntegration; QScopedPointer mServerBufferIntegration; @@ -128,12 +131,13 @@ private: QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); QScopedPointer mFontDb; +#if QT_CONFIG(draganddrop) QScopedPointer mClipboard; QScopedPointer mDrag; - QScopedPointer mDisplay; +#endif QScopedPointer mNativeInterface; QScopedPointer mInputContext; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QScopedPointer mAccessibility; #endif bool mClientBufferIntegrationInitialized; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 4a79fb5ab55..9946c323567 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -116,9 +116,10 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc return nullptr; } +#if QT_CONFIG(opengl) void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { -#ifdef QT_WAYLAND_GL_SUPPORT +#if QT_CONFIG(opengl) QByteArray lowerCaseResource = resource.toLower(); if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration()) @@ -133,6 +134,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour return nullptr; } +#endif // opengl QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 83e3fe5fa0f..7b8b2834255 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -72,8 +72,9 @@ public: QWindow *window) Q_DECL_OVERRIDE; void *nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen) Q_DECL_OVERRIDE; +#if QT_CONFIG(opengl) void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; - +#endif QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE; QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE; QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index b749bd5f9e8..155b625400d 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -53,7 +53,7 @@ #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 64980280a03..9c1f4673869 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 79f65b1544a..e700d5a183b 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -91,19 +91,17 @@ public: virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) } virtual void sendProperty(const QString &name, const QVariant &value); - virtual bool shellManagesActiveState() const { return false; } inline QWaylandWindow *window() { return m_window; } + virtual void setType(Qt::WindowType type, QWaylandWindow *transientParent) = 0; + protected: virtual void setMaximized() {} virtual void setFullscreen() {} virtual void setNormal() {} virtual void setMinimized() {} - virtual void setTopLevel() {} - virtual void updateTransientParent(QWindow * /*parent*/) {} - private: QWaylandWindow *m_window; friend class QWaylandWindow; diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index aafe4463291..519482d09eb 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 13f823edf81..0afdda4c0c3 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -185,10 +185,6 @@ void QWaylandShmBackingStore::endPaint() waylandWindow()->setCanResize(true); } -void QWaylandShmBackingStore::hidden() -{ -} - void QWaylandShmBackingStore::ensureSize() { waylandWindow()->setBackingStore(this); @@ -215,13 +211,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons QMargins margins = windowDecorationMargins(); - waylandWindow()->attachOffset(mFrontBuffer); - mFrontBuffer->setBusy(); - - QVector rects = region.rects(); - foreach (const QRect &rect, rects) - waylandWindow()->damage(rect.translated(margins.left(), margins.top())); - waylandWindow()->commit(); + waylandWindow()->commit(mFrontBuffer, region.translated(margins.left(), margins.top())); } void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) @@ -358,7 +348,7 @@ QWaylandWindow *QWaylandShmBackingStore::waylandWindow() const return static_cast(window()->handle()); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QImage QWaylandShmBackingStore::toImage() const { // Invoked from QPlatformBackingStore::composeAndFlush() that is called @@ -367,7 +357,7 @@ QImage QWaylandShmBackingStore::toImage() const return *contentSurface(); } -#endif // QT_NO_OPENGL +#endif // opengl } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index c3e7635029e..a5b809c769f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -96,7 +96,6 @@ public: void resize(const QSize &size); void beginPaint(const QRegion &) Q_DECL_OVERRIDE; void endPaint() Q_DECL_OVERRIDE; - void hidden(); QWaylandAbstractDecoration *windowDecoration() const; @@ -108,7 +107,7 @@ public: QWaylandWindow *waylandWindow() const; void iterateBuffer(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QImage toImage() const Q_DECL_OVERRIDE; #endif diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 0abd168bc18..00fb8d8edab 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -56,7 +56,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index dc32b84a063..b17bce6abe7 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2b7d81f8897..d16746bac2c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -81,7 +81,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mWindowDecoration(0) , mMouseEventsInContentArea(false) , mMousePressedInContentArea(Qt::NoButton) - , m_cursor(Qt::ArrowCursor) , mWaitingForFrameSync(false) , mFrameCallback(nullptr) , mRequestResizeSent(false) @@ -96,8 +95,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) { static WId id = 1; mWindowId = id++; - if (window->type() != Qt::Desktop) - initWindow(); } QWaylandWindow::~QWaylandWindow() @@ -126,20 +123,30 @@ QWaylandWindow::~QWaylandWindow() void QWaylandWindow::initWindow() { - init(mDisplay->createSurface(static_cast(this))); + if (window()->type() == Qt::Desktop) + return; + + if (!isInitialized()) + init(mDisplay->createSurface(static_cast(this))); if (shouldCreateSubSurface()) { + Q_ASSERT(!mSubSurfaceWindow); + QWaylandWindow *p = static_cast(QPlatformWindow::parent()); if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); } } else if (shouldCreateShellSurface()) { - mShellSurface = mDisplay->createShellSurface(this); - } + Q_ASSERT(!mShellSurface); + + mShellSurface = mDisplay->createShellSurface(this); + if (!mShellSurface) + qFatal("Could not create a shell surface object."); + + mShellSurface->setType(window()->type(), transientParent()); - if (mShellSurface) { // Set initial surface title - mShellSurface->setTitle(window()->title()); + setWindowTitle(window()->title()); // The appId is the desktop entry identifier that should follow the // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). @@ -171,17 +178,6 @@ void QWaylandWindow::initWindow() } } - if (mShellSurface) { - if (window()->transientParent()) { - if (window()->type() != Qt::Popup) { - mShellSurface->updateTransientParent(window()->transientParent()); - } - } else { - if (window()->type() != Qt::ToolTip) - mShellSurface->setTopLevel(); - } - } - // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. @@ -244,6 +240,9 @@ WId QWaylandWindow::winId() const void QWaylandWindow::setParent(const QPlatformWindow *parent) { + if (!window()->isVisible()) + return; + QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : 0; if (oldparent == parent) return; @@ -261,7 +260,8 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent) void QWaylandWindow::setWindowTitle(const QString &title) { if (mShellSurface) { - mShellSurface->setTitle(title); + const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH + mShellSurface->setTitle(formatWindowTitle(title, separator)); } if (mWindowDecoration && window()->isVisible()) @@ -285,8 +285,8 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) if (mSubSurfaceWindow) { QMargins m = QPlatformWindow::parent()->frameMargins(); mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top()); - } else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) - shellSurface()->updateTransientParent(window()->transientParent()); + mSubSurfaceWindow->parent()->window()->requestUpdate(); + } } void QWaylandWindow::setGeometry(const QRect &rect) @@ -311,20 +311,8 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (mShellSurface) { - if (window()->type() == Qt::Popup) { - QWaylandWindow *parent = transientParent(); - if (parent) { - QWaylandWlShellSurface *wlshellSurface = qobject_cast(mShellSurface); - if (wlshellSurface) - wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); - } - } else if (window()->type() == Qt::ToolTip) { - if (QWaylandWindow *parent = transientParent()) { - mShellSurface->updateTransientParent(parent->window()); - } - } - } + initWindow(); + mDisplay->flushRequests(); setGeometry(window()->geometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since @@ -336,13 +324,8 @@ void QWaylandWindow::setVisible(bool visible) // case 'this' will be deleted. When that happens, we must abort right away. QPointer deleteGuard(this); QWindowSystemInterface::flushWindowSystemEvents(); - if (!deleteGuard.isNull()) { - attach(static_cast(0), 0, 0); - commit(); - if (mBackingStore) { - mBackingStore->hidden(); - } - } + if (!deleteGuard.isNull()) + reset(); } } @@ -375,7 +358,7 @@ void QWaylandWindow::setMask(const QRegion &mask) wl_region_destroy(region); } - commit(); + wl_surface::commit(); } void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) @@ -462,6 +445,7 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) wl_callback_add_listener(callback, &QWaylandWindow::callbackListener, this); mFrameCallback = callback; mWaitingForFrameSync = true; + buffer->setBusy(); attach(buffer->buffer(), x, y); } else { @@ -480,6 +464,18 @@ void QWaylandWindow::damage(const QRect &rect) damage(rect.x(), rect.y(), rect.width(), rect.height()); } +void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) +{ + if (!isInitialized()) + return; + + attachOffset(buffer); + const QVector rects = damage.rects(); + for (const QRect &rect: rects) + wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height()); + wl_surface::commit(); +} + const wl_callback_listener QWaylandWindow::callbackListener = { QWaylandWindow::frameCallback }; @@ -528,11 +524,6 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const return mSubSurfaceWindow; } -bool QWaylandWindow::shellManagesActiveState() const -{ - return mShellSurface && mShellSurface->shellManagesActiveState(); -} - void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { if (mDisplay->compositorVersion() < 2) @@ -561,7 +552,7 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient } set_buffer_transform(transform); // set_buffer_transform is double buffered, we need to commit. - commit(); + wl_surface::commit(); } void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) @@ -687,15 +678,13 @@ static QWindow *topLevelWindow(QWindow *window) QWaylandWindow *QWaylandWindow::transientParent() const { - if (window()->transientParent()) { - // Take the top level window here, since the transient parent may be a QWidgetWindow - // or some other window without a shell surface, which is then not able to get mouse - // events. - return static_cast(topLevelWindow(window()->transientParent())->handle()); - } - // Try with the current focus window. It should be the right one and anyway - // better than having no parent at all. - return mDisplay->lastInputWindow(); + // Take the top level window here, since the transient parent may be a QWidgetWindow + // or some other window without a shell surface, which is then not able to get mouse + // events. + if (auto transientParent = window()->transientParent()) + return static_cast(topLevelWindow(transientParent)->handle()); + + return nullptr; } void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) @@ -790,10 +779,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { - if (device->serial() >= device->cursorSerial()) { - device->setCursor(cursor, mScreen); - m_cursor = cursor; - } + device->setCursor(cursor, mScreen); } void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) @@ -809,10 +795,12 @@ void QWaylandWindow::requestActivateWindow() void QWaylandWindow::unfocus() { +#if QT_CONFIG(draganddrop) QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); if (inputDevice && inputDevice->dataDevice()) { inputDevice->dataDevice()->invalidateSelectionOffer(); } +#endif } bool QWaylandWindow::isExposed() const diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e0c42ace53d..ce295a0de3b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -60,7 +60,7 @@ #include #include -#include +#include struct wl_egl_window; @@ -132,6 +132,8 @@ public: using QtWayland::wl_surface::damage; void damage(const QRect &rect); + void commit(QWaylandBuffer *buffer, const QRegion &damage); + void waitForFrameSync(); QMargins frameMargins() const Q_DECL_OVERRIDE; @@ -143,8 +145,6 @@ public: QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *screen() const { return mScreen; } - bool shellManagesActiveState() const; - void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; void setOrientationMask(Qt::ScreenOrientations mask); @@ -217,7 +217,6 @@ protected: QWaylandAbstractDecoration *mWindowDecoration; bool mMouseEventsInContentArea; Qt::MouseButtons mMousePressedInContentArea; - QCursor m_cursor; WId mWindowId; bool mWaitingForFrameSync; diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 09a79d48dc8..463b67ef6a8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -58,7 +58,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index 6a9220d2648..ce7c7834617 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -52,6 +52,12 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) } } +bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) +{ + QWaylandShellIntegration::initialize(display); + return m_wlShell != nullptr; +}; + QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h index 8531eb3aad1..9082c7628d1 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h @@ -58,7 +58,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellI { public: QWaylandWlShellIntegration(QWaylandDisplay* display); - bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_wlShell != Q_NULLPTR; } + bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; private: diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 3527015c715..77434e98b6c 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -215,6 +215,16 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic transientPos.x(), transientPos.y(), 0); } +void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + if (type == Qt::Popup && transientParent) + setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); + else if (transientParent) + updateTransientParent(transientParent->window()); + else + setTopLevel(); +} + void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial) { pong(serial); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index ef732ef85df..89bce55852d 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -55,7 +55,7 @@ #include -#include +#include #include #include @@ -92,14 +92,16 @@ public: void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + private: void setMaximized() Q_DECL_OVERRIDE; void setFullscreen() Q_DECL_OVERRIDE; void setNormal() Q_DECL_OVERRIDE; void setMinimized() Q_DECL_OVERRIDE; - void setTopLevel() Q_DECL_OVERRIDE; - void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; + void setTopLevel(); + void updateTransientParent(QWindow *parent); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); QWaylandWindow *m_window; diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp similarity index 89% rename from src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp rename to src/plugins/platforms/wayland/qwaylandxdgpopup.cpp index abc25278b1e..318f78ac738 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp @@ -45,6 +45,7 @@ QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *wi : QWaylandShellSurface(window) , QtWayland::xdg_popup(popup) , m_extendedWindow(nullptr) + , m_window(window) { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); @@ -56,6 +57,17 @@ QWaylandXdgPopup::~QWaylandXdgPopup() delete m_extendedWindow; } +void QWaylandXdgPopup::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + Q_UNUSED(type); + Q_UNUSED(transientParent); +} + +void QWaylandXdgPopup::xdg_popup_popup_done() +{ + m_window->window()->close(); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index ff58041134d..e10e5e62b98 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -47,7 +47,7 @@ #include -#include +#include #include #include @@ -68,8 +68,14 @@ public: QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window); virtual ~QWaylandXdgPopup(); + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + +protected: + void xdg_popup_popup_done() override; + private: QWaylandExtendedSurface *m_extendedWindow; + QWaylandWindow *m_window; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 6a378b8dbe6..6a99306081a 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -54,11 +54,13 @@ namespace QtWaylandClient { QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) : QtWayland::xdg_shell(shell) + , m_popupSerial(0) { } QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id) : QtWayland::xdg_shell(registry, id, 1) + , m_popupSerial(0) { use_unstable_version(QtWayland::xdg_shell::version_current); } @@ -75,15 +77,26 @@ QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window) QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window) { - QWaylandWindow *parentWindow = window->transientParent(); + QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last(); ::wl_surface *parentSurface = parentWindow->object(); + QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); + if (m_popupSerial == 0) + m_popupSerial = inputDevice->serial(); ::wl_seat *seat = inputDevice->wl_seat(); - uint serial = inputDevice->serial(); - QPoint position = window->geometry().topLeft(); + + QPoint position = window->geometry().topLeft() - parentWindow->geometry().topLeft(); int x = position.x() + parentWindow->frameMargins().left(); int y = position.y() + parentWindow->frameMargins().top(); - return new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, serial, x, y), window); + + auto popup = new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, m_popupSerial, x, y), window); + m_popups.append(window); + QObject::connect(popup, &QWaylandXdgPopup::destroyed, [this, window](){ + m_popups.removeOne(window); + if (m_popups.empty()) + m_popupSerial = 0; + }); + return popup; } void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index c04a9ce6673..97a15e46aee 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -52,11 +52,12 @@ // #include +#include #include #include -#include +#include #include QT_BEGIN_NAMESPACE @@ -82,6 +83,9 @@ public: private: void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE; + + QVector m_popups; + uint m_popupSerial; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index b6b1d9d35a3..a48157dfac9 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -54,6 +54,12 @@ QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *displa } } +bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) +{ + QWaylandShellIntegration::initialize(display); + return m_xdgShell != nullptr; +} + QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) { if (window->window()->type() == Qt::WindowType::Popup) @@ -62,6 +68,13 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi return m_xdgShell->createXdgSurface(window); } +void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { + if (newFocus && qobject_cast(newFocus->shellSurface())) + m_display->handleWindowActivated(newFocus); + if (oldFocus && qobject_cast(oldFocus->shellSurface())) + m_display->handleWindowDeactivated(oldFocus); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h index 29374ff1d6d..e0e6bda0dc5 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h @@ -59,8 +59,9 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShell { public: QWaylandXdgShellIntegration(QWaylandDisplay *display); - bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_xdgShell != Q_NULLPTR; } + bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; + void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE; private: QWaylandXdgShell *m_xdgShell; diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 4f9d8cfbffd..fe8761e5b6d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -128,17 +128,13 @@ void QWaylandXdgSurface::setMinimized() set_minimized(); } -void QWaylandXdgSurface::setTopLevel() +void QWaylandXdgSurface::updateTransientParent(QWaylandWindow *parent) { - // There's no xdg_shell_surface API for this, ignoring -} - -void QWaylandXdgSurface::updateTransientParent(QWindow *parent) -{ - QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); - if (!parent_wayland_window) + if (!parent) return; - set_parent(m_shell->get_xdg_surface(parent_wayland_window->object())); + auto parentXdgSurface = qobject_cast(parent->shellSurface()); + Q_ASSERT(parentXdgSurface); + set_parent(parentXdgSurface->object()); } void QWaylandXdgSurface::setTitle(const QString & title) @@ -181,6 +177,13 @@ void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value m_extendedWindow->updateGenericProperty(name, value); } +void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + Q_UNUSED(type) + if (transientParent) + updateTransientParent(transientParent); +} + void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) { uint32_t *state = reinterpret_cast(states->data); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 27decabb4e6..184ef13eb1f 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -56,7 +56,7 @@ #include -#include +#include #include #include @@ -96,19 +96,18 @@ public: void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; - bool shellManagesActiveState() const Q_DECL_OVERRIDE { return true; } - bool isFullscreen() const { return m_fullscreen; } bool isMaximized() const { return m_maximized; } + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + private: void setMaximized() Q_DECL_OVERRIDE; void setFullscreen() Q_DECL_OVERRIDE; void setNormal() Q_DECL_OVERRIDE; void setMinimized() Q_DECL_OVERRIDE; - void setTopLevel() Q_DECL_OVERRIDE; - void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; + void updateTransientParent(QWaylandWindow *parent); private: QWaylandWindow *m_window; diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 2afdcce8a05..3e04467deb3 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -43,8 +43,6 @@ #include #include -#ifndef QT_NO_WAYLAND_XKB - #include QT_BEGIN_NAMESPACE @@ -377,5 +375,3 @@ QVector QWaylandXkb::toKeysym(QKeyEvent *event) } QT_END_NAMESPACE - -#endif // QT_NO_WAYLAND_XKB diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h index cdebf1b08b0..230159fbb77 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h @@ -41,8 +41,6 @@ #ifndef QWAYLANDXKB_H #define QWAYLANDXKB_H -#ifndef QT_NO_WAYLAND_XKB - #include #include #include @@ -65,6 +63,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_WAYLAND_XKB - #endif diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index e8e46ecaa12..ab9b736bbca 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include -#include +#include +#include QT_BEGIN_NAMESPACE @@ -68,8 +68,20 @@ public: QWaylandShellIntegration() {} virtual ~QWaylandShellIntegration() {} - virtual bool initialize(QWaylandDisplay *display) = 0; + virtual bool initialize(QWaylandDisplay *display) { + m_display = display; + return true; + } virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; + virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { + if (newFocus) + m_display->handleWindowActivated(newFocus); + if (oldFocus) + m_display->handleWindowDeactivated(oldFocus); + } + +protected: + QWaylandDisplay *m_display; }; } diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index da622d13fba..8bee45c748f 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 0783465a82a..3edb0a89dbb 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index be511bfc338..266e6980cc0 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro index 006d130a039..34fc67474db 100644 --- a/tests/auto/wayland/client/client.pro +++ b/tests/auto/wayland/client/client.pro @@ -4,11 +4,7 @@ TARGET = tst_client QT += testlib QT += core-private gui-private -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client wayland-server -} else { - LIBS += -lwayland-client -lwayland-server -} +QMAKE_USE += wayland-client wayland-server CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 0749239f8ed..f48bb872440 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -248,8 +248,8 @@ void tst_WaylandClient::backingStore() window.hide(); - // hiding the window should detach the buffer - QTRY_VERIFY(surface->image.isNull()); + // hiding the window should destroy the surface + QTRY_VERIFY(!compositor->surface()); } class DndWindow : public QWindow