diff options
197 files changed, 1234 insertions, 974 deletions
diff --git a/config.tests/brcm_egl/brcm_egl.pro b/config.tests/brcm_egl/brcm_egl.pro deleted file mode 100644 index a6b416f1..00000000 --- a/config.tests/brcm_egl/brcm_egl.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = brcm_egl -CONFIG -= qt - -INCLUDEPATH += $$QMAKE_INCDIR_EGL - -for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p -} - -LIBS += $$QMAKE_LIBS_EGL - -# Input -SOURCES += main.cpp diff --git a/config.tests/brcm_egl/main.cpp b/config.tests/brcm_egl/main.cpp deleted file mode 100644 index bb3cab73..00000000 --- a/config.tests/brcm_egl/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <stdio.h> - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#include <EGL/eglext_brcm.h> - -int main() -{ - EGLDisplay display = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); - if (!display) { - fprintf(stderr, "No EGL display"); - return -1; - } - - EGLint major, minor; - if (!eglInitialize(display, &major, &minor)) { - fprintf(stderr, "Failed to initialize EGL"); - return -1; - } - - EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM; - - EGLint id[2]; - PFNEGLCREATEGLOBALIMAGEBRCMPROC createImage = (PFNEGLCREATEGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglCreateGlobalImageBRCM"); - createImage(32, 32, pixel_format, 0, 32 * 4, id); - - eglTerminate(display); - - return 0; -} diff --git a/config.tests/drm_egl_server/drm_egl_server.pro b/config.tests/drm_egl_server/drm_egl_server.pro index 328354eb..28dcadcb 100644 --- a/config.tests/drm_egl_server/drm_egl_server.pro +++ b/config.tests/drm_egl_server/drm_egl_server.pro @@ -1,14 +1 @@ -TARGET = drm_egl_server -QT = core - -!contains(QT_CONFIG, opengl): error("drm_egl_server support requires Qt configured with OpenGL") - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += egl -} else { - LIBS += -legl -} - -# Input SOURCES += main.cpp diff --git a/config.tests/glx/glx.pro b/config.tests/glx/glx.pro index 74cc6083..28dcadcb 100644 --- a/config.tests/glx/glx.pro +++ b/config.tests/glx/glx.pro @@ -1,14 +1 @@ -TARGET = glx -QT = core - -!contains(QT_CONFIG, opengl): error("glx support requires Qt configured with OpenGL") - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += x11 gl -} else { - LIBS += -lX11 -lGL -} - -# Input SOURCES += main.cpp diff --git a/config.tests/libhybris_egl_server/libhybris_egl_server.pro b/config.tests/libhybris_egl_server/libhybris_egl_server.pro index bc358d55..28dcadcb 100644 --- a/config.tests/libhybris_egl_server/libhybris_egl_server.pro +++ b/config.tests/libhybris_egl_server/libhybris_egl_server.pro @@ -1,14 +1 @@ -TARGET = libhybris_egl_server -QT = core - -!contains(QT_CONFIG, opengl): error("libhybris_egl_server support requires Qt configured with OpenGL") - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += egl -} else { - LIBS += -legl -} - -# Input SOURCES += main.cpp diff --git a/config.tests/wayland/wayland.pro b/config.tests/wayland/wayland.pro index 5873d92d..28dcadcb 100644 --- a/config.tests/wayland/wayland.pro +++ b/config.tests/wayland/wayland.pro @@ -1,12 +1 @@ -TARGET = wayland -QT = core - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client -} else { - LIBS += -lwayland-client -} - -# Input -SOURCES += main.cpp
\ No newline at end of file +SOURCES += main.cpp diff --git a/config.tests/wayland_cursor/wayland_cursor.pro b/config.tests/wayland_cursor/wayland_cursor.pro index aa38d32f..28dcadcb 100644 --- a/config.tests/wayland_cursor/wayland_cursor.pro +++ b/config.tests/wayland_cursor/wayland_cursor.pro @@ -1,12 +1 @@ -TARGET = wayland_cursor -QT = core - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-cursor -} else { - LIBS += -lwayland-cursor -} - -# Input SOURCES += main.cpp diff --git a/config.tests/wayland_egl/wayland_egl.pro b/config.tests/wayland_egl/wayland_egl.pro index 42d6b131..28dcadcb 100644 --- a/config.tests/wayland_egl/wayland_egl.pro +++ b/config.tests/wayland_egl/wayland_egl.pro @@ -1,15 +1 @@ -TARGET = wayland_egl -QT = core - -!contains(QT_CONFIG, opengl): error("wayland_egl support requires Qt configured with OpenGL") -!contains(QT_CONFIG, egl): error("wayland_egl support requires Qt configured with EGL") - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-egl -} else { - LIBS += -lwayland-egl -} - -# Input SOURCES += main.cpp diff --git a/config.tests/wayland_scanner/wayland_scanner.pro b/config.tests/wayland_scanner/wayland_scanner.pro index 300e439e..03da69dc 100644 --- a/config.tests/wayland_scanner/wayland_scanner.pro +++ b/config.tests/wayland_scanner/wayland_scanner.pro @@ -2,13 +2,6 @@ TARGET = wayland_scanner isEmpty(QMAKE_WAYLAND_SCANNER):error("QMAKE_WAYLAND_SCANNER not defined for this mkspec") -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client -} else { - LIBS += -lwayland-client -} - # Input SOURCES += main.cpp diff --git a/config.tests/xcomposite/xcomposite.pro b/config.tests/xcomposite/xcomposite.pro index 6838970a..28dcadcb 100644 --- a/config.tests/xcomposite/xcomposite.pro +++ b/config.tests/xcomposite/xcomposite.pro @@ -1,14 +1 @@ -TARGET = xcomposite -QT = core - -!contains(QT_CONFIG, opengl): error("xcomposite support requires Qt configured with OpenGL") - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xcomposite -} else { - LIBS += -lXcomposite -} - -# Input SOURCES += main.cpp diff --git a/config.tests/xkbcommon/xkbcommon.pro b/config.tests/xkbcommon/xkbcommon.pro deleted file mode 100644 index af6668bc..00000000 --- a/config.tests/xkbcommon/xkbcommon.pro +++ /dev/null @@ -1,12 +0,0 @@ -TARGET = xkbcommon -QT = core - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xkbcommon -} else { - LIBS += -lxkbcommon -} - -# Input -SOURCES += main.cpp diff --git a/configure.json b/configure.json new file mode 100644 index 00000000..42bfa9d9 --- /dev/null +++ b/configure.json @@ -0,0 +1,6 @@ +{ + "subconfigs": [ + "src/client", + "src/compositor" + ] +} diff --git a/examples/wayland/custom-extension/client-common/client.pro b/examples/wayland/custom-extension/client-common/client.pro index 9ba72bc9..95b99578 100644 --- a/examples/wayland/custom-extension/client-common/client.pro +++ b/examples/wayland/custom-extension/client-common/client.pro @@ -1,14 +1,7 @@ CONFIG += wayland-scanner -CONFIG += link_pkgconfig - TARGET = custom-wayland QT += waylandclient-private -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client -} else { - LIBS += -lwayland-client -} WAYLANDCLIENTSOURCES += ../protocol/custom.xml diff --git a/examples/wayland/custom-extension/compositor/compositor.pro b/examples/wayland/custom-extension/compositor/compositor.pro index 4ffafdb8..b0ff7b2f 100644 --- a/examples/wayland/custom-extension/compositor/compositor.pro +++ b/examples/wayland/custom-extension/compositor/compositor.pro @@ -18,13 +18,6 @@ WAYLANDSERVERSOURCES += \ RESOURCES += compositor.qrc -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-server -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-server -} - TARGET = custom-compositor HEADERS += \ diff --git a/examples/wayland/custom-extension/cpp-client/cpp-client.pro b/examples/wayland/custom-extension/cpp-client/cpp-client.pro index 54fead07..b700f236 100644 --- a/examples/wayland/custom-extension/cpp-client/cpp-client.pro +++ b/examples/wayland/custom-extension/cpp-client/cpp-client.pro @@ -1,17 +1,8 @@ QT += waylandclient-private gui-private - -CONFIG += c++11 CONFIG += wayland-scanner -CONFIG += link_pkgconfig WAYLANDCLIENTSOURCES += ../protocol/custom.xml -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client -} else { - LIBS += -lwayland-client -} - SOURCES += main.cpp \ ../client-common/customextension.cpp diff --git a/examples/wayland/custom-extension/qml-client/qml-client.pro b/examples/wayland/custom-extension/qml-client/qml-client.pro index aec29d2b..d45067e5 100644 --- a/examples/wayland/custom-extension/qml-client/qml-client.pro +++ b/examples/wayland/custom-extension/qml-client/qml-client.pro @@ -1,19 +1,9 @@ TEMPLATE = app - QT += qml quick waylandclient-private - -CONFIG += c++11 CONFIG += wayland-scanner -CONFIG += link_pkgconfig WAYLANDCLIENTSOURCES += ../protocol/custom.xml -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client -} else { - LIBS += -lwayland-client -} - SOURCES += main.cpp \ ../client-common/customextension.cpp diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml index d2ff5cc2..dc3ad473 100644 --- a/examples/wayland/pure-qml/qml/Chrome.qml +++ b/examples/wayland/pure-qml/qml/Chrome.qml @@ -44,6 +44,8 @@ import QtWayland.Compositor 1.0 ShellSurfaceItem { id: rootChrome + property bool isChild: parent.shellSurface !== undefined + onSurfaceDestroyed: { bufferLocked = true; destroyAnimation.start(); @@ -67,6 +69,7 @@ ShellSurfaceItem { ParallelAnimation { NumberAnimation { target: scaleTransform; property: "yScale"; to: 2/height; duration: 150 } NumberAnimation { target: scaleTransform; property: "xScale"; to: 0.4; duration: 150 } + NumberAnimation { target: rootChrome; property: "opacity"; to: rootChrome.isChild ? 0 : 1; duration: 150 } } NumberAnimation { target: scaleTransform; property: "xScale"; to: 0; duration: 150 } ScriptAction { script: { rootChrome.destroy(); } } diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml index 9bce7bcb..5eece078 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/pure-qml/qml/main.qml @@ -81,7 +81,8 @@ WaylandCompositor { } onXdgPopupCreated: { var parentView = viewsBySurface[xdgPopup.parentSurface]; - chromeComponent.createObject(parentView, { "shellSurface": xdgPopup } ); + var item = chromeComponent.createObject(parentView, { "shellSurface": xdgPopup } ); + viewsBySurface[xdgPopup.surface] = item; } } diff --git a/examples/wayland/qwindow-compositor/window.cpp b/examples/wayland/qwindow-compositor/window.cpp index 371e0de8..a61e4d98 100644 --- a/examples/wayland/qwindow-compositor/window.cpp +++ b/examples/wayland/qwindow-compositor/window.cpp @@ -257,10 +257,9 @@ void Window::mouseMoveEvent(QMouseEvent *e) void Window::sendMouseEvent(QMouseEvent *e, View *target) { - if (!target) - return; - - QPointF mappedPos = e->localPos() - target->position(); + QPointF mappedPos = e->localPos(); + if (target) + mappedPos -= target->position(); QMouseEvent viewEvent(e->type(), mappedPos, e->localPos(), e->button(), e->buttons(), e->modifiers()); m_compositor->handleMouseEvent(target, &viewEvent); } diff --git a/examples/wayland/server-buffer/client/client.pro b/examples/wayland/server-buffer/client/client.pro index 6e5cc87e..459a407a 100644 --- a/examples/wayland/server-buffer/client/client.pro +++ b/examples/wayland/server-buffer/client/client.pro @@ -3,14 +3,6 @@ TARGET = client INCLUDEPATH += . QT += waylandclient-private - -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-client -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client -} - CONFIG += wayland-scanner WAYLANDCLIENTSOURCES += ../share-buffer.xml diff --git a/examples/wayland/server-buffer/compositor/compositor.pro b/examples/wayland/server-buffer/compositor/compositor.pro index 28a781bd..45240af9 100644 --- a/examples/wayland/server-buffer/compositor/compositor.pro +++ b/examples/wayland/server-buffer/compositor/compositor.pro @@ -1,12 +1,5 @@ QT += core-private gui-private quick-private waylandcompositor-private -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-server -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-server -} - SOURCES += \ main.cpp \ serverbufferitem.cpp diff --git a/examples/wayland/wayland.pro b/examples/wayland/wayland.pro index 2a539500..6024dd2d 100644 --- a/examples/wayland/wayland.pro +++ b/examples/wayland/wayland.pro @@ -1,17 +1,21 @@ +requires(qtHaveModule(waylandcompositor)) +requires(qtConfig(opengl)) TEMPLATE=subdirs -contains(QT_CONFIG, opengl) { - SUBDIRS += qwindow-compositor - SUBDIRS += minimal-cpp -} +SUBDIRS += \ + qwindow-compositor + minimal-cpp -contains(QT_CONFIG, opengl):qtHaveModule(quick) { +qtHaveModule(quick) { SUBDIRS += minimal-qml SUBDIRS += spanning-screens SUBDIRS += pure-qml SUBDIRS += multi-output SUBDIRS += multi-screen - SUBDIRS += custom-extension - SUBDIRS += server-buffer SUBDIRS += ivi-compositor + qtHaveModule(waylandclient) { + SUBDIRS += \ + custom-extension \ + server-buffer + } } diff --git a/qtwayland.pro b/qtwayland.pro index f71b842d..0401ab02 100644 --- a/qtwayland.pro +++ b/qtwayland.pro @@ -1,38 +1,2 @@ requires(linux:!android) - -load(configure) -qtCompileTest(wayland) -qtCompileTest(xkbcommon) -qtCompileTest(wayland_cursor) -qtCompileTest(wayland_scanner) -qtCompileTest(wayland_egl) -qtCompileTest(brcm_egl) -qtCompileTest(glx) -qtCompileTest(xcomposite) -qtCompileTest(drm_egl_server) -qtCompileTest(libhybris_egl_server) - load(qt_parts) - -!config_wayland { - warning("QtWayland requires Wayland 1.6.0 or higher, QtWayland will not be built") - SUBDIRS = -} - -!config_xkbcommon { - warning("No xkbcommon 0.2.0 or higher found, disabling support for it") -} - -!config_wayland_scanner { - warning("QtWayland requires wayland-scanner, QtWayland will not be built") - SUBDIRS = -} - -!config_wayland_cursor { - warning("QtWayland requires wayland-cursor, QtWayland will not be built") - SUBDIRS = -} - -!config_wayland_egl { - message("no wayland-egl support detected, cross-toolkit compatibility disabled"); -} diff --git a/src/client/client.pro b/src/client/client.pro index 34955dfb..7482cfd6 100644 --- a/src/client/client.pro +++ b/src/client/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/client/configure.json b/src/client/configure.json new file mode 100644 index 00000000..b2a8fbc0 --- /dev/null +++ b/src/client/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/client/global/qwaylandclientextension.h b/src/client/global/qwaylandclientextension.h index d1610c27..37345202 100644 --- a/src/client/global/qwaylandclientextension.h +++ b/src/client/global/qwaylandclientextension.h @@ -38,7 +38,7 @@ #define QWAYLANDCLIENTEXTENSION_H #include <QObject> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> struct wl_registry; diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h index adaf2902..f1f0cf93 100644 --- a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -52,7 +52,7 @@ // #include <QtCore/qglobal.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index aa197e3d..4e7e7ee5 100644 --- a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/client/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/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index c70a2bd5..7eaeed16 100644 --- a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 2830f95f..6496b33e 100644 --- a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/client/hardwareintegration/qwaylandhardwareintegration_p.h b/src/client/hardwareintegration/qwaylandhardwareintegration_p.h index db9e19ac..8b4a7162 100644 --- a/src/client/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/client/hardwareintegration/qwaylandhardwareintegration_p.h @@ -52,7 +52,7 @@ // #include <QtWaylandClient/private/qwayland-hardware-integration.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h index e3943da8..67f857db 100644 --- a/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -55,7 +55,7 @@ #include <QtGui/qopengl.h> #include <QtWaylandClient/private/qwayland-server-buffer-extension.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index dfa0b465..527dc571 100644 --- a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/client/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/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index f1785620..600c24c9 100644 --- a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 7eaaa170..b3ed3ccc 100644 --- a/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index ada63b71..1fa0fd6d 100644 --- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -52,7 +52,7 @@ // #include <QtCore/qglobal.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <stdint.h> diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index de303d00..c069a364 100644 --- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/client/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/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index d6d0e843..80096e79 100644 --- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index c4a578d2..2d9961db 100644 --- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/client/qwaylandclientexport.h b/src/client/qtwaylandclientglobal.h index f49f1aee..5f474f37 100644 --- a/src/client/qwaylandclientexport.h +++ b/src/client/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 <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> +#include <QtWaylandClient/qtwaylandclient-config.h> QT_BEGIN_NAMESPACE @@ -65,5 +66,5 @@ QT_BEGIN_NAMESPACE QT_END_NAMESPACE -#endif //QWAYLANDCLIENTEXPORT_H +#endif //QWAYLANDCLIENTGLOBAL_H diff --git a/src/client/qtwaylandclientglobal_p.h b/src/client/qtwaylandclientglobal_p.h new file mode 100644 index 00000000..f2106d0b --- /dev/null +++ b/src/client/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 <QtWaylandClient/qtwaylandclientglobal.h> +#include <QtGui/private/qtguiglobal_p.h> +#include <QtWaylandClient/private/qtwaylandclient-config_p.h> + +#endif //QWAYLANDCLIENTGLOBAL_P_H + diff --git a/src/client/qwaylandabstractdecoration_p.h b/src/client/qwaylandabstractdecoration_p.h index 3220dab9..42c65be6 100644 --- a/src/client/qwaylandabstractdecoration_p.h +++ b/src/client/qwaylandabstractdecoration_p.h @@ -59,7 +59,7 @@ #include <QtGui/QColor> #include <QtGui/QStaticText> #include <QtGui/QImage> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <wayland-client.h> diff --git a/src/client/qwaylandbuffer_p.h b/src/client/qwaylandbuffer_p.h index 8d651f82..9e8cba2e 100644 --- a/src/client/qwaylandbuffer_p.h +++ b/src/client/qwaylandbuffer_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/QSize> #include <QtCore/QRect> diff --git a/src/client/qwaylandclipboard.cpp b/src/client/qwaylandclipboard.cpp index 2e3c204c..68fb737c 100644 --- a/src/client/qwaylandclipboard.cpp +++ b/src/client/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/client/qwaylandclipboard_p.h b/src/client/qwaylandclipboard_p.h index aa008eef..584322e0 100644 --- a/src/client/qwaylandclipboard_p.h +++ b/src/client/qwaylandclipboard_p.h @@ -53,9 +53,11 @@ #include <qpa/qplatformclipboard.h> #include <QtCore/QVariant> +#include <QtCore/QMimeData> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> +#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/client/qwaylandcursor_p.h b/src/client/qwaylandcursor_p.h index 11333d34..a7d188f5 100644 --- a/src/client/qwaylandcursor_p.h +++ b/src/client/qwaylandcursor_p.h @@ -53,7 +53,7 @@ #include <qpa/qplatformcursor.h> #include <QtCore/QMap> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> struct wl_cursor; struct wl_cursor_image; diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index d04c20bf..b76647ea 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -56,6 +56,8 @@ #include <qpa/qplatformdrag.h> #include <qpa/qwindowsysteminterface.h> +#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/client/qwaylanddatadevice_p.h b/src/client/qwaylanddatadevice_p.h index 7daa9f0d..0b16f97d 100644 --- a/src/client/qwaylanddatadevice_p.h +++ b/src/client/qwaylanddatadevice_p.h @@ -52,12 +52,15 @@ // We mean it. // +#include <qtwaylandclientglobal.h> #include <QObject> #include <QPointer> #include <QPoint> #include <QtWaylandClient/private/qwayland-wayland.h> +#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/client/qwaylanddatadevicemanager.cpp b/src/client/qwaylanddatadevicemanager.cpp index 35d67307..c398b86f 100644 --- a/src/client/qwaylanddatadevicemanager.cpp +++ b/src/client/qwaylanddatadevicemanager.cpp @@ -46,6 +46,8 @@ #include <QtCore/QDebug> +#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/client/qwaylanddatadevicemanager_p.h b/src/client/qwaylanddatadevicemanager_p.h index 0c1d95d8..e7fc2113 100644 --- a/src/client/qwaylanddatadevicemanager_p.h +++ b/src/client/qwaylanddatadevicemanager_p.h @@ -51,9 +51,11 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-wayland.h> +#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/client/qwaylanddataoffer.cpp b/src/client/qwaylanddataoffer.cpp index 2491c658..56a18f00 100644 --- a/src/client/qwaylanddataoffer.cpp +++ b/src/client/qwaylanddataoffer.cpp @@ -47,6 +47,8 @@ #include <QtCore/QDebug> +#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/client/qwaylanddataoffer_p.h b/src/client/qwaylanddataoffer_p.h index 5e635c1a..96799c86 100644 --- a/src/client/qwaylanddataoffer_p.h +++ b/src/client/qwaylanddataoffer_p.h @@ -53,9 +53,10 @@ #include <QtGui/private/qdnd_p.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-wayland.h> +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -105,5 +106,5 @@ private: } QT_END_NAMESPACE - +#endif // draganddrop #endif diff --git a/src/client/qwaylanddatasource.cpp b/src/client/qwaylanddatasource.cpp index 40beea31..036bd0d8 100644 --- a/src/client/qwaylanddatasource.cpp +++ b/src/client/qwaylanddatasource.cpp @@ -49,6 +49,8 @@ #include <unistd.h> +#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/client/qwaylanddatasource_p.h b/src/client/qwaylanddatasource_p.h index c099ff62..540e6ad7 100644 --- a/src/client/qwaylanddatasource_p.h +++ b/src/client/qwaylanddatasource_p.h @@ -54,7 +54,9 @@ #include <QObject> #include <QtWaylandClient/private/qwayland-wayland.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> + +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -92,4 +94,6 @@ private: QT_END_NAMESPACE +#endif // draganddrop + #endif // QWAYLANDDATASOURCE_H diff --git a/src/client/qwaylanddecorationfactory.cpp b/src/client/qwaylanddecorationfactory.cpp index 43c712fc..1279e303 100644 --- a/src/client/qwaylanddecorationfactory.cpp +++ b/src/client/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/client/qwaylanddecorationfactory_p.h b/src/client/qwaylanddecorationfactory_p.h index 9d4e7a9f..606d9b89 100644 --- a/src/client/qwaylanddecorationfactory_p.h +++ b/src/client/qwaylanddecorationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/client/qwaylanddecorationplugin_p.h b/src/client/qwaylanddecorationplugin_p.h index dd33f341..c549b24b 100644 --- a/src/client/qwaylanddecorationplugin_p.h +++ b/src/client/qwaylanddecorationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 3fd2aa56..534373b1 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/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/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 2864b357..a4631b95 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -61,7 +61,7 @@ #include <wayland-client.h> #include <QtWaylandClient/private/qwayland-wayland.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-xdg-shell.h> #include <QtWaylandClient/private/qwaylandshm_p.h> @@ -137,9 +137,9 @@ public: QList<QWaylandInputDevice *> 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<QWaylandInputDevice *> mInputDevices; QList<Listener> mRegistryListeners; QWaylandIntegration *mWaylandIntegration; +#if QT_CONFIG(draganddrop) QScopedPointer<QWaylandDataDeviceManager> mDndSelectionHandler; +#endif QScopedPointer<QtWayland::qt_surface_extension> mWindowExtension; QScopedPointer<QtWayland::wl_subcompositor> mSubCompositor; QScopedPointer<QWaylandTouchExtension> mTouchExtension; diff --git a/src/client/qwaylanddnd.cpp b/src/client/qwaylanddnd.cpp index b59ac6d7..54c075c4 100644 --- a/src/client/qwaylanddnd.cpp +++ b/src/client/qwaylanddnd.cpp @@ -50,7 +50,7 @@ #include <QDebug> 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/client/qwaylanddnd_p.h b/src/client/qwaylanddnd_p.h index 2ff00b9f..215a8b74 100644 --- a/src/client/qwaylanddnd_p.h +++ b/src/client/qwaylanddnd_p.h @@ -57,14 +57,14 @@ #include <QtGui/QDrag> #include <QtCore/QMimeData> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> 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/client/qwaylandextendedsurface_p.h b/src/client/qwaylandextendedsurface_p.h index 39b85438..39dc4fcf 100644 --- a/src/client/qwaylandextendedsurface_p.h +++ b/src/client/qwaylandextendedsurface_p.h @@ -54,7 +54,7 @@ #include <QtCore/QString> #include <QtCore/QVariant> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <wayland-client.h> #include <QtWaylandClient/private/qwayland-surface-extension.h> diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index f490f07f..4e8ef7b6 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/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/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index ea685223..6d458e35 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWaylandClient/private/qtwaylandclientglobal_p.h> #include <QtWaylandClient/private/qwaylandwindow_p.h> #include <QSocketNotifier> @@ -64,7 +65,7 @@ #include <QtWaylandClient/private/qwayland-wayland.h> -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) #include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon-keysyms.h> #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<QWaylandBuffer> &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/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 3e263061..748f4f29 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/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/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h index bd66f55a..1689581a 100644 --- a/src/client/qwaylandintegration_p.h +++ b/src/client/qwaylandintegration_p.h @@ -51,9 +51,8 @@ // We mean it. // +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <qpa/qplatformintegration.h> - -#include <QtWaylandClient/qwaylandclientexport.h> #include <QtCore/QScopedPointer> 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<QWaylandDisplay> mDisplay; + protected: QScopedPointer<QWaylandClientBufferIntegration> mClientBufferIntegration; QScopedPointer<QWaylandServerBufferIntegration> mServerBufferIntegration; @@ -128,12 +131,13 @@ private: QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); QScopedPointer<QPlatformFontDatabase> mFontDb; +#if QT_CONFIG(draganddrop) QScopedPointer<QPlatformClipboard> mClipboard; QScopedPointer<QPlatformDrag> mDrag; - QScopedPointer<QWaylandDisplay> mDisplay; +#endif QScopedPointer<QPlatformNativeInterface> mNativeInterface; QScopedPointer<QPlatformInputContext> mInputContext; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QScopedPointer<QPlatformAccessibility> mAccessibility; #endif bool mClientBufferIntegrationInitialized; diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index 4a79fb5a..9946c323 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/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/client/qwaylandnativeinterface_p.h b/src/client/qwaylandnativeinterface_p.h index 83e3fe5f..7b8b2834 100644 --- a/src/client/qwaylandnativeinterface_p.h +++ b/src/client/qwaylandnativeinterface_p.h @@ -54,7 +54,7 @@ #include <QVariantMap> #include <qpa/qplatformnativeinterface.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> 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/client/qwaylandqtkey_p.h b/src/client/qwaylandqtkey_p.h index b749bd5f..155b6254 100644 --- a/src/client/qwaylandqtkey_p.h +++ b/src/client/qwaylandqtkey_p.h @@ -53,7 +53,7 @@ #include <qpa/qwindowsysteminterface.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-qtkey-extension.h> QT_BEGIN_NAMESPACE diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h index 64980280..9c1f4673 100644 --- a/src/client/qwaylandscreen_p.h +++ b/src/client/qwaylandscreen_p.h @@ -52,7 +52,7 @@ // #include <qpa/qplatformscreen.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-wayland.h> diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index 79f65b15..e700d5a1 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -57,7 +57,7 @@ #include <wayland-client.h> #include <QtWaylandClient/private/qwayland-wayland.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> 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/client/qwaylandshm_p.h b/src/client/qwaylandshm_p.h index aafe4463..519482d0 100644 --- a/src/client/qwaylandshm_p.h +++ b/src/client/qwaylandshm_p.h @@ -54,7 +54,7 @@ #include <QVector> #include <QImage> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-wayland.h> QT_BEGIN_NAMESPACE diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp index 13f823ed..0afdda4c 100644 --- a/src/client/qwaylandshmbackingstore.cpp +++ b/src/client/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<QRect> 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<QWaylandWindow *>(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/client/qwaylandshmbackingstore_p.h b/src/client/qwaylandshmbackingstore_p.h index c3e76350..a5b809c7 100644 --- a/src/client/qwaylandshmbackingstore_p.h +++ b/src/client/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/client/qwaylandsubsurface_p.h b/src/client/qwaylandsubsurface_p.h index 0abd168b..00fb8d8e 100644 --- a/src/client/qwaylandsubsurface_p.h +++ b/src/client/qwaylandsubsurface_p.h @@ -56,7 +56,7 @@ #include <QtCore/qglobal.h> #include <QtCore/qmutex.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-wayland.h> QT_BEGIN_NAMESPACE diff --git a/src/client/qwaylandtouch_p.h b/src/client/qwaylandtouch_p.h index dc32b84a..b17bce6a 100644 --- a/src/client/qwaylandtouch_p.h +++ b/src/client/qwaylandtouch_p.h @@ -54,7 +54,7 @@ #include <qpa/qwindowsysteminterface.h> #include <QtWaylandClient/private/qwayland-touch-extension.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 2b7d81f8..d16746ba 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/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<QtWayland::wl_surface *>(this))); + if (window()->type() == Qt::Desktop) + return; + + if (!isInitialized()) + init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this))); if (shouldCreateSubSurface()) { + Q_ASSERT(!mSubSurfaceWindow); + QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent()); if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); } } else if (shouldCreateShellSurface()) { + 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<QWaylandWlShellSurface*>(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<QWaylandWindow> deleteGuard(this); QWindowSystemInterface::flushWindowSystemEvents(); - if (!deleteGuard.isNull()) { - attach(static_cast<QWaylandBuffer *>(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<QRect> 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<QWaylandWindow *>(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<QWaylandWindow *>(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/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index e0c42ace..ce295a0d 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -60,7 +60,7 @@ #include <qpa/qplatformwindow.h> #include <QtWaylandClient/private/qwayland-wayland.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> 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/client/qwaylandwindowmanagerintegration_p.h b/src/client/qwaylandwindowmanagerintegration_p.h index 09a79d48..463b67ef 100644 --- a/src/client/qwaylandwindowmanagerintegration_p.h +++ b/src/client/qwaylandwindowmanagerintegration_p.h @@ -58,7 +58,7 @@ #include <QtServiceSupport/private/qgenericunixservices_p.h> #include <QtWaylandClient/private/qwayland-qt-windowmanager.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/client/qwaylandwlshellintegration.cpp b/src/client/qwaylandwlshellintegration.cpp index 6a9220d2..ce7c7834 100644 --- a/src/client/qwaylandwlshellintegration.cpp +++ b/src/client/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/client/qwaylandwlshellintegration_p.h b/src/client/qwaylandwlshellintegration_p.h index 8531eb3a..9082c762 100644 --- a/src/client/qwaylandwlshellintegration_p.h +++ b/src/client/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/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp index 3527015c..77434e98 100644 --- a/src/client/qwaylandwlshellsurface.cpp +++ b/src/client/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/client/qwaylandwlshellsurface_p.h b/src/client/qwaylandwlshellsurface_p.h index ef732ef8..89bce558 100644 --- a/src/client/qwaylandwlshellsurface_p.h +++ b/src/client/qwaylandwlshellsurface_p.h @@ -55,7 +55,7 @@ #include <wayland-client.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-wayland.h> #include <QtWaylandClient/private/qwaylandshellsurface_p.h> @@ -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/client/qwaylandxdgpopup_p.cpp b/src/client/qwaylandxdgpopup.cpp index abc25278..318f78ac 100644 --- a/src/client/qwaylandxdgpopup_p.cpp +++ b/src/client/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/client/qwaylandxdgpopup_p.h b/src/client/qwaylandxdgpopup_p.h index ff580411..e10e5e62 100644 --- a/src/client/qwaylandxdgpopup_p.h +++ b/src/client/qwaylandxdgpopup_p.h @@ -47,7 +47,7 @@ #include <wayland-client.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-xdg-shell.h> #include <QtWaylandClient/private/qwaylandshellsurface_p.h> @@ -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/client/qwaylandxdgshell.cpp b/src/client/qwaylandxdgshell.cpp index 6a378b8d..6a993060 100644 --- a/src/client/qwaylandxdgshell.cpp +++ b/src/client/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/client/qwaylandxdgshell_p.h b/src/client/qwaylandxdgshell_p.h index c04a9ce6..97a15e46 100644 --- a/src/client/qwaylandxdgshell_p.h +++ b/src/client/qwaylandxdgshell_p.h @@ -52,11 +52,12 @@ // #include <QtCore/QSize> +#include <QtCore/QVector> #include <wayland-client.h> #include <QtWaylandClient/private/qwayland-xdg-shell.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwaylandshellsurface_p.h> QT_BEGIN_NAMESPACE @@ -82,6 +83,9 @@ public: private: void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE; + + QVector<QWaylandWindow *> m_popups; + uint m_popupSerial; }; QT_END_NAMESPACE diff --git a/src/client/qwaylandxdgshellintegration.cpp b/src/client/qwaylandxdgshellintegration.cpp index b6b1d9d3..a48157df 100644 --- a/src/client/qwaylandxdgshellintegration.cpp +++ b/src/client/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<QWaylandXdgPopup *>(newFocus->shellSurface())) + m_display->handleWindowActivated(newFocus); + if (oldFocus && qobject_cast<QWaylandXdgPopup *>(oldFocus->shellSurface())) + m_display->handleWindowDeactivated(oldFocus); +} + } QT_END_NAMESPACE diff --git a/src/client/qwaylandxdgshellintegration_p.h b/src/client/qwaylandxdgshellintegration_p.h index 29374ff1..e0e6bda0 100644 --- a/src/client/qwaylandxdgshellintegration_p.h +++ b/src/client/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/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp index 4f9d8cfb..fe8761e5 100644 --- a/src/client/qwaylandxdgsurface.cpp +++ b/src/client/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<QWaylandWindow *>(parent->handle()); - if (!parent_wayland_window) + if (!parent) return; - set_parent(m_shell->get_xdg_surface(parent_wayland_window->object())); + auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(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<uint32_t*>(states->data); diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h index 27decabb..184ef13e 100644 --- a/src/client/qwaylandxdgsurface_p.h +++ b/src/client/qwaylandxdgsurface_p.h @@ -56,7 +56,7 @@ #include <wayland-client.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtWaylandClient/private/qwayland-xdg-shell.h> #include <QtWaylandClient/private/qwaylandshellsurface_p.h> @@ -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/client/shellintegration/qwaylandshellintegration_p.h b/src/client/shellintegration/qwaylandshellintegration_p.h index e8e46eca..ab9b736b 100644 --- a/src/client/shellintegration/qwaylandshellintegration_p.h +++ b/src/client/shellintegration/qwaylandshellintegration_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include <QtCore/qglobal.h> -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> +#include <QtWaylandClient/private/qwaylanddisplay_p.h> 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/client/shellintegration/qwaylandshellintegrationfactory.cpp b/src/client/shellintegration/qwaylandshellintegrationfactory.cpp index da622d13..8bee45c7 100644 --- a/src/client/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/client/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/client/shellintegration/qwaylandshellintegrationfactory_p.h b/src/client/shellintegration/qwaylandshellintegrationfactory_p.h index 0783465a..3edb0a89 100644 --- a/src/client/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/client/shellintegration/qwaylandshellintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/client/shellintegration/qwaylandshellintegrationplugin_p.h b/src/client/shellintegration/qwaylandshellintegrationplugin_p.h index be511bfc..266e6980 100644 --- a/src/client/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/client/shellintegration/qwaylandshellintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtWaylandClient/qwaylandclientexport.h> +#include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/compositor/compositor.pro b/src/compositor/compositor.pro index 251d757e..dc9000d9 100644 --- a/src/compositor/compositor.pro +++ b/src/compositor/compositor.pro @@ -5,19 +5,12 @@ QT = core gui-private qtHaveModule(quick): QT += quick -contains(QT_CONFIG, opengl):MODULE_DEFINES = QT_WAYLAND_COMPOSITOR_GL - CONFIG -= precompile_header CONFIG += link_pkgconfig -DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT QMAKE_DOCS = $$PWD/doc/qtwaylandcompositor.qdocconf -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG_PRIVATE += wayland-server -} else { - LIBS += -lwayland-server -} +QMAKE_USE += wayland-server INCLUDEPATH += ../shared diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri index 0253cd0e..1e9284c6 100644 --- a/src/compositor/compositor_api/compositor_api.pri +++ b/src/compositor/compositor_api/compositor_api.pri @@ -52,7 +52,7 @@ SOURCES += \ QT += core-private -qtHaveModule(quick):contains(QT_CONFIG, opengl) { +qtHaveModule(quick):qtConfig(opengl) { DEFINES += QT_WAYLAND_COMPOSITOR_QUICK SOURCES += \ diff --git a/src/compositor/compositor_api/qwaylandbufferref.cpp b/src/compositor/compositor_api/qwaylandbufferref.cpp index 6f175de9..9a40fe77 100644 --- a/src/compositor/compositor_api/qwaylandbufferref.cpp +++ b/src/compositor/compositor_api/qwaylandbufferref.cpp @@ -259,7 +259,7 @@ QImage QWaylandBufferRef::image() const return d->buffer->image(); } -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) /*! * Returns an OpenGL texture for the buffer. \a plane is the index for multi-plane formats, such as YUV. * diff --git a/src/compositor/compositor_api/qwaylandbufferref.h b/src/compositor/compositor_api/qwaylandbufferref.h index 06486ef3..7dd3a820 100644 --- a/src/compositor/compositor_api/qwaylandbufferref.h +++ b/src/compositor/compositor_api/qwaylandbufferref.h @@ -37,14 +37,15 @@ #ifndef QWAYLANDBUFFERREF_H #define QWAYLANDBUFFERREF_H +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QImage> -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) #include <QtGui/qopengl.h> #endif #include <QtWaylandCompositor/QWaylandSurface> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> struct wl_resource; @@ -99,7 +100,7 @@ public: bool isSharedMemory() const; QImage image() const; -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) QOpenGLTexture *toOpenGLTexture(int plane = 0) const; #endif diff --git a/src/compositor/compositor_api/qwaylandclient.h b/src/compositor/compositor_api/qwaylandclient.h index 50e7baf7..ac651b2b 100644 --- a/src/compositor/compositor_api/qwaylandclient.h +++ b/src/compositor/compositor_api/qwaylandclient.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDCLIENT_H #define QWAYLANDCLIENT_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QObject> diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index bcee61d8..29397f64 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -35,6 +35,7 @@ ** ****************************************************************************/ +#include "qtwaylandcompositorglobal_p.h" #include "qwaylandcompositor.h" #include "qwaylandcompositor_p.h" @@ -60,7 +61,7 @@ #include "hardware_integration/qwlserverbufferintegration_p.h" #include "hardware_integration/qwlserverbufferintegrationfactory_p.h" -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) #include "hardware_integration/qwlhwintegration_p.h" #endif @@ -80,7 +81,7 @@ #include <QtGui/qpa/qplatformnativeinterface.h> #include <QtGui/private/qguiapplication_p.h> -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) # include <QOpenGLTextureBlitter> # include <QOpenGLTexture> # include <QOpenGLContext> @@ -107,7 +108,7 @@ public: uint32_t code = ke->nativeScanCode; bool isDown = ke->keyType == QEvent::KeyPress; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) QString text; Qt::KeyboardModifiers modifiers = QWaylandXkb::modifiers(keyb->xkbState()); @@ -143,7 +144,7 @@ public: QWaylandCompositorPrivate::QWaylandCompositorPrivate(QWaylandCompositor *compositor) : display(0) -#if defined (QT_WAYLAND_COMPOSITOR_GL) +#if QT_CONFIG(opengl) , use_hw_integration_extension(true) , client_buffer_integration(0) , server_buffer_integration(0) @@ -354,7 +355,7 @@ QWaylandSurface *QWaylandCompositorPrivate::createDefaultSurface() void QWaylandCompositorPrivate::initializeHardwareIntegration() { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) Q_Q(QWaylandCompositor); if (use_hw_integration_extension) hw_integration.reset(new QtWayland::HardwareIntegration(q)); @@ -377,7 +378,7 @@ void QWaylandCompositorPrivate::initializeSeats() void QWaylandCompositorPrivate::loadClientBufferIntegration() { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) Q_Q(QWaylandCompositor); QStringList keys = QtWayland::ClientBufferIntegrationFactory::keys(); QString targetKey; @@ -406,7 +407,7 @@ void QWaylandCompositorPrivate::loadClientBufferIntegration() void QWaylandCompositorPrivate::loadServerBufferIntegration() { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) QStringList keys = QtWayland::ServerBufferIntegrationFactory::keys(); QString targetKey; QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); @@ -852,7 +853,7 @@ QWaylandSeat *QWaylandCompositor::seatFor(QInputEvent *inputEvent) */ bool QWaylandCompositor::useHardwareIntegrationExtension() const { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) Q_D(const QWaylandCompositor); return d->use_hw_integration_extension; #else @@ -862,7 +863,7 @@ bool QWaylandCompositor::useHardwareIntegrationExtension() const void QWaylandCompositor::setUseHardwareIntegrationExtension(bool use) { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) Q_D(QWaylandCompositor); if (use == d->use_hw_integration_extension) return; @@ -892,7 +893,7 @@ void QWaylandCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWay if (buffer.isSharedMemory()) { emit grabber->success(buffer.image()); } else { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) if (QOpenGLContext::currentContext()) { QOpenGLFramebufferObject fbo(buffer.size()); fbo.bind(); diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h index 8b190d1d..d0ec85f3 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.h +++ b/src/compositor/compositor_api/qwaylandcompositor.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDCOMPOSITOR_H #define QWAYLANDCOMPOSITOR_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/qwaylandcompositorextension.h> #include <QtWaylandCompositor/QWaylandOutput> diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h index 5255f3d5..e59fdcbb 100644 --- a/src/compositor/compositor_api/qwaylandcompositor_p.h +++ b/src/compositor/compositor_api/qwaylandcompositor_p.h @@ -49,7 +49,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/QWaylandCompositor> #include <QtCore/private/qobject_p.h> #include <QtCore/QSet> @@ -139,7 +139,7 @@ protected: QList<QWaylandClient *> clients; -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) bool use_hw_integration_extension; QScopedPointer<QtWayland::HardwareIntegration> hw_integration; QScopedPointer<QtWayland::ClientBufferIntegration> client_buffer_integration; @@ -159,7 +159,7 @@ protected: QtWayland::ClientBufferIntegration * QWaylandCompositorPrivate::clientBufferIntegration() const { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) return client_buffer_integration.data(); #else return 0; @@ -168,7 +168,7 @@ QtWayland::ClientBufferIntegration * QWaylandCompositorPrivate::clientBufferInte QtWayland::ServerBufferIntegration * QWaylandCompositorPrivate::serverBufferIntegration() const { -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) return server_buffer_integration.data(); #else return 0; diff --git a/src/compositor/compositor_api/qwaylanddestroylistener.h b/src/compositor/compositor_api/qwaylanddestroylistener.h index 580a5c46..81bbb7bc 100644 --- a/src/compositor/compositor_api/qwaylanddestroylistener.h +++ b/src/compositor/compositor_api/qwaylanddestroylistener.h @@ -39,7 +39,7 @@ #define QWAYLANDDESTROYLISTENER_H #include <QtCore/QObject> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> struct wl_resource; diff --git a/src/compositor/compositor_api/qwaylanddrag.h b/src/compositor/compositor_api/qwaylanddrag.h index 08ad1101..df192474 100644 --- a/src/compositor/compositor_api/qwaylanddrag.h +++ b/src/compositor/compositor_api/qwaylanddrag.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDDRAG_H #define QWAYLANDDRAG_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/QObject> #include <QtCore/QPointF> diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp index 68279bb9..539fc1b7 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp @@ -54,7 +54,7 @@ QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface) if (textInput) { connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled); -#ifndef QT_NO_IM +#if QT_CONFIG(im) connect(textInput, &QWaylandTextInput::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod); #endif } @@ -101,7 +101,7 @@ void QWaylandInputMethodControl::setEnabled(bool enabled) d->enabled = enabled; emit enabledChanged(enabled); -#ifndef QT_NO_IM +#if QT_CONFIG(im) emit updateInputMethod(Qt::ImQueryInput); #endif } diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h index ab894c9c..af02e1ae 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h @@ -37,6 +37,7 @@ #ifndef QWAYLANDINPUTMETHODCONTROL_H #define QWAYLANDINPUTMETHODCONTROL_H +#include <QtGui/qtguiglobal.h> #include <QObject> QT_BEGIN_NAMESPACE @@ -56,7 +57,7 @@ class QWaylandInputMethodControl : public QObject public: explicit QWaylandInputMethodControl(QWaylandSurface *surface); -#ifndef QT_NO_IM +#if QT_CONFIG(im) QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif @@ -69,7 +70,7 @@ public: Q_SIGNALS: void enabledChanged(bool enabled); -#ifndef QT_NO_IM +#if QT_CONFIG(im) void updateInputMethod(Qt::InputMethodQueries queries); #endif diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h index a4f9ce87..4517f5ee 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/qwaylandinputmethodcontrol.h> #include <QtCore/private/qobject_p.h> diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp index 5bbec0a4..55381b45 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard.cpp +++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp @@ -35,6 +35,7 @@ ** ****************************************************************************/ +#include "qtwaylandcompositorglobal_p.h" #include "qwaylandkeyboard.h" #include "qwaylandkeyboard_p.h" #include <QtWaylandCompositor/QWaylandKeymap> @@ -47,7 +48,7 @@ #include <fcntl.h> #include <unistd.h> -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) #include <sys/mman.h> #include <sys/types.h> #endif @@ -65,7 +66,7 @@ QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandSeat *seat) , modsLocked() , group() , pendingKeymap(false) -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) , keymap_fd(-1) , xkb_state(0) #endif @@ -76,7 +77,7 @@ QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandSeat *seat) QWaylandKeyboardPrivate::~QWaylandKeyboardPrivate() { -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (xkb_context) { if (keymap_area) munmap(keymap_area, keymap_size); @@ -146,7 +147,7 @@ void QWaylandKeyboardPrivate::keyboard_bind_resource(wl_keyboard::Resource *reso if (resource->version() >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) send_repeat_info(resource->handle, repeatRate, repeatDelay); -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (xkb_context) { send_keymap(resource->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymap_fd, keymap_size); @@ -201,7 +202,7 @@ void QWaylandKeyboardPrivate::modifiers(uint32_t serial, uint32_t mods_depressed void QWaylandKeyboardPrivate::updateModifierState(uint code, uint32_t state) { -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (!xkb_context) return; @@ -241,7 +242,7 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap() return; pendingKeymap = false; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (!xkb_context) return; @@ -261,7 +262,7 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap() #endif } -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) static int createAnonymousFile(size_t size) { QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); @@ -404,7 +405,7 @@ QWaylandKeyboard::QWaylandKeyboard(QWaylandSeat *seat, QObject *parent) connect(keymap, &QWaylandKeymap::optionsChanged, this, &QWaylandKeyboard::updateKeymap); connect(keymap, &QWaylandKeymap::rulesChanged, this, &QWaylandKeyboard::updateKeymap); connect(keymap, &QWaylandKeymap::modelChanged, this, &QWaylandKeyboard::updateKeymap); -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) d->initXKB(); #endif } diff --git a/src/compositor/compositor_api/qwaylandkeyboard_p.h b/src/compositor/compositor_api/qwaylandkeyboard_p.h index fc43853c..b65dab44 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard_p.h +++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h @@ -49,7 +49,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h> #include <QtWaylandCompositor/qwaylandseat.h> #include <QtWaylandCompositor/qwaylandkeyboard.h> #include <QtWaylandCompositor/qwaylanddestroylistener.h> @@ -59,7 +59,7 @@ #include <QtCore/QVector> -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) #include <xkbcommon/xkbcommon.h> #endif @@ -83,7 +83,7 @@ public: void modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group); -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) struct xkb_state *xkbState() const { return xkb_state; } uint32_t xkbModsMask() const { return modsDepressed | modsLatched | modsLocked; } #endif @@ -102,7 +102,7 @@ protected: void keyboard_release(Resource *resource) Q_DECL_OVERRIDE; private: -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) void initXKB(); void createXKBKeymap(); void createXKBState(xkb_keymap *keymap); @@ -124,7 +124,7 @@ private: uint32_t group; bool pendingKeymap; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) size_t keymap_size; int keymap_fd; char *keymap_area; diff --git a/src/compositor/compositor_api/qwaylandkeymap.h b/src/compositor/compositor_api/qwaylandkeymap.h index c543691d..b72807a9 100644 --- a/src/compositor/compositor_api/qwaylandkeymap.h +++ b/src/compositor/compositor_api/qwaylandkeymap.h @@ -38,7 +38,7 @@ #define QWAYLANDKEYMAP_H #include <QtCore/QObject> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandoutput_p.h b/src/compositor/compositor_api/qwaylandoutput_p.h index 638575db..dffde7f9 100644 --- a/src/compositor/compositor_api/qwaylandoutput_p.h +++ b/src/compositor/compositor_api/qwaylandoutput_p.h @@ -50,7 +50,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/QWaylandOutput> #include <QtWaylandCompositor/QWaylandClient> #include <QtWaylandCompositor/QWaylandSurface> diff --git a/src/compositor/compositor_api/qwaylandoutputmode.h b/src/compositor/compositor_api/qwaylandoutputmode.h index 4ef57f2e..0bcdaa6c 100644 --- a/src/compositor/compositor_api/qwaylandoutputmode.h +++ b/src/compositor/compositor_api/qwaylandoutputmode.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDOUTPUTMODE_H #define QWAYLANDOUTPUTMODE_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/QSize> QT_BEGIN_NAMESPACE @@ -66,6 +66,7 @@ private: void setWidth(int width); void setHeight(int height); }; +Q_DECLARE_TYPEINFO(QWaylandOutputMode, Q_MOVABLE_TYPE); QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandpointer_p.h b/src/compositor/compositor_api/qwaylandpointer_p.h index 54ac72d1..c02f831b 100644 --- a/src/compositor/compositor_api/qwaylandpointer_p.h +++ b/src/compositor/compositor_api/qwaylandpointer_p.h @@ -49,7 +49,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/QWaylandDestroyListener> #include <QtWaylandCompositor/QWaylandPointer> diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index e6cfce34..4c5bf075 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -481,6 +481,7 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event) seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); seat->sendMousePressEvent(event->button()); + d->hoverPos = event->pos(); } /*! @@ -503,6 +504,7 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event) } } else { seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); + d->hoverPos = event->pos(); } } else { emit mouseMove(event->windowPos()); @@ -543,6 +545,7 @@ void QWaylandQuickItem::hoverEnterEvent(QHoverEvent *event) if (d->shouldSendInputEvents()) { QWaylandSeat *seat = compositor()->seatFor(event); seat->sendMouseMoveEvent(d->view.data(), event->pos(), mapToScene(event->pos())); + d->hoverPos = event->pos(); } else { event->ignore(); } @@ -562,7 +565,10 @@ void QWaylandQuickItem::hoverMoveEvent(QHoverEvent *event) } if (d->shouldSendInputEvents()) { QWaylandSeat *seat = compositor()->seatFor(event); - seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->pos()), mapToScene(event->pos())); + if (event->pos() != d->hoverPos) { + seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->pos()), mapToScene(event->pos())); + d->hoverPos = event->pos(); + } } else { event->ignore(); } @@ -661,7 +667,7 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event) } } -#ifndef QT_NO_IM +#if QT_CONFIG(im) /*! * \internal */ @@ -830,7 +836,7 @@ void QWaylandQuickItem::handleSurfaceChanged() disconnect(d->oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update); disconnect(d->oldSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded); disconnect(d->oldSurface, &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted); -#ifndef QT_NO_IM +#if QT_CONFIG(im) disconnect(d->oldSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod); #endif } @@ -843,7 +849,7 @@ void QWaylandQuickItem::handleSurfaceChanged() connect(newSurface, &QWaylandSurface::redraw, this, &QQuickItem::update); connect(newSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded); connect(newSurface, &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted); -#ifndef QT_NO_IM +#if QT_CONFIG(im) connect(newSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod); #endif @@ -860,7 +866,7 @@ void QWaylandQuickItem::handleSurfaceChanged() } surfaceChangedEvent(d->view->surface(), d->oldSurface); d->oldSurface = d->view->surface(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(Qt::ImQueryInput); #endif } @@ -1007,7 +1013,7 @@ void QWaylandQuickItem::setSizeFollowsSurface(bool sizeFollowsSurface) emit sizeFollowsSurfaceChanged(); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) QVariant QWaylandQuickItem::inputMethodQuery(Qt::InputMethodQuery query) const { return inputMethodQuery(query, QVariant()); @@ -1074,11 +1080,16 @@ void QWaylandQuickItem::updateBuffer(bool hasBuffer) void QWaylandQuickItem::updateWindow() { Q_D(QWaylandQuickItem); + + QQuickWindow *newWindow = window(); + if (newWindow == d->connectedWindow) + return; + if (d->connectedWindow) { disconnect(d->connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync); } - d->connectedWindow = window(); + d->connectedWindow = newWindow; if (d->connectedWindow) { connect(d->connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync, Qt::DirectConnection); @@ -1100,7 +1111,7 @@ void QWaylandQuickItem::beforeSync() } } -#ifndef QT_NO_IM +#if QT_CONFIG(im) void QWaylandQuickItem::updateInputMethod(Qt::InputMethodQueries queries) { Q_D(QWaylandQuickItem); diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 821826d6..87d10b02 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDSURFACEITEM_H #define QWAYLANDSURFACEITEM_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtQuick/QQuickItem> #include <QtQuick/qsgtexture.h> @@ -102,7 +102,7 @@ public: bool sizeFollowsSurface() const; void setSizeFollowsSurface(bool sizeFollowsSurface); -#ifndef QT_NO_IM +#if QT_CONFIG(im) QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif @@ -135,7 +135,7 @@ protected: void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_IM +#if QT_CONFIG(im) void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE; #endif @@ -157,7 +157,7 @@ private Q_SLOTS: void handleSubsurfaceAdded(QWaylandSurface *childSurface); void handleSubsurfacePosition(const QPoint &pos); void handleDragStarted(QWaylandDrag *drag); -#ifndef QT_NO_IM +#if QT_CONFIG(im) void updateInputMethod(Qt::InputMethodQueries queries); #endif diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h index 5eba9957..fc69fe09 100644 --- a/src/compositor/compositor_api/qwaylandquickitem_p.h +++ b/src/compositor/compositor_api/qwaylandquickitem_p.h @@ -142,6 +142,8 @@ public: QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::outputChanged); QObject::connect(view.data(), &QWaylandView::bufferLockedChanged, q, &QWaylandQuickItem::bufferLockedChanged); QObject::connect(view.data(), &QWaylandView::allowDiscardFrontBufferChanged, q, &QWaylandQuickItem::allowDiscardFrontBuffer); + + q->updateWindow(); } void setInputEventsEnabled(bool enable) @@ -171,6 +173,7 @@ public: bool newTexture; bool focusOnClick; bool sizeFollowsSurface; + QPoint hoverPos; QQuickWindow *connectedWindow; QWaylandSurface::Origin origin; diff --git a/src/compositor/compositor_api/qwaylandresource.h b/src/compositor/compositor_api/qwaylandresource.h index bfb4b096..32a6d53f 100644 --- a/src/compositor/compositor_api/qwaylandresource.h +++ b/src/compositor/compositor_api/qwaylandresource.h @@ -38,7 +38,7 @@ #define QWAYLANDRESOURCE_H #include <QtCore/QObject> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> struct wl_resource; diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp index 169d5de6..f6a5276d 100644 --- a/src/compositor/compositor_api/qwaylandseat.cpp +++ b/src/compositor/compositor_api/qwaylandseat.cpp @@ -257,8 +257,8 @@ void QWaylandSeat::sendKeyReleaseEvent(uint code) } /*! - * Sends a touch point event with the given \a id and \a state to the touch device. The position - * of the touch point is given by \a point. + * Sends a touch point event to the \a surface on a touch device with the given + * \a id, \a point and \a state. * * Returns the serial for the touch up or touch down event. */ @@ -273,7 +273,7 @@ uint QWaylandSeat::sendTouchPointEvent(QWaylandSurface *surface, int id, const Q } /*! - * Sends a frame event to the touch device. + * Sends a frame event to the touch device of a \a client. */ void QWaylandSeat::sendTouchFrameEvent(QWaylandClient *client) { @@ -283,7 +283,7 @@ void QWaylandSeat::sendTouchFrameEvent(QWaylandClient *client) } /*! - * Sends a cancel event to the touch device. + * Sends a cancel event to the touch device of a \a client. */ void QWaylandSeat::sendTouchCancelEvent(QWaylandClient *client) { @@ -293,7 +293,7 @@ void QWaylandSeat::sendTouchCancelEvent(QWaylandClient *client) } /*! - * Sends the \a event to the touch device. + * Sends the \a event to the specified \a surface on the touch device. */ void QWaylandSeat::sendFullTouchEvent(QWaylandSurface *surface, QTouchEvent *event) { diff --git a/src/compositor/compositor_api/qwaylandseat.h b/src/compositor/compositor_api/qwaylandseat.h index 3e90342c..49c63260 100644 --- a/src/compositor/compositor_api/qwaylandseat.h +++ b/src/compositor/compositor_api/qwaylandseat.h @@ -41,7 +41,7 @@ #include <QtCore/QPoint> #include <QtCore/QString> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/qwaylandcompositorextension.h> #include <QtWaylandCompositor/qwaylandkeyboard.h> diff --git a/src/compositor/compositor_api/qwaylandseat_p.h b/src/compositor/compositor_api/qwaylandseat_p.h index eb86aec3..1d687080 100644 --- a/src/compositor/compositor_api/qwaylandseat_p.h +++ b/src/compositor/compositor_api/qwaylandseat_p.h @@ -50,7 +50,7 @@ #include <stdint.h> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h> #include <QtWaylandCompositor/qwaylandseat.h> #include <QtCore/QList> @@ -58,10 +58,6 @@ #include <QtCore/QScopedPointer> #include <QtCore/private/qobject_p.h> -#ifndef QT_NO_WAYLAND_XKB -#include <xkbcommon/xkbcommon.h> -#endif - #include <QtWaylandCompositor/private/qwayland-server-wayland.h> QT_BEGIN_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index 80e8715e..f79fd57e 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -269,7 +269,7 @@ void QWaylandSurfacePrivate::surface_commit(Resource *) { Q_Q(QWaylandSurface); - if (pending.buffer.hasBuffer()) + if (pending.buffer.hasBuffer() || pending.newlyAttached) bufferRef = pending.buffer; auto buffer = bufferRef.buffer(); @@ -872,13 +872,13 @@ void QWaylandSurfacePrivate::Subsurface::subsurface_set_desync(wl_subsurface::Re /*! * \qmlsignal void QtWaylandCompositor::WaylandSurface::dragStarted(object drag) * - * This signal is emitted when a drag has started from this surface. + * This signal is emitted when a \a drag has started from this surface. */ /*! * \fn void QWaylandSurface::dragStarted(QWaylandDrag *drag) * - * This signal is emitted when a drag has started from this surface. + * This signal is emitted when a \a drag has started from this surface. */ QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h index 40753ad4..38043695 100644 --- a/src/compositor/compositor_api/qwaylandsurface.h +++ b/src/compositor/compositor_api/qwaylandsurface.h @@ -38,7 +38,7 @@ #ifndef QWAYLANDSURFACE_H #define QWAYLANDSURFACE_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/qwaylandcompositorextension.h> #include <QtWaylandCompositor/qwaylandclient.h> diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h index 94ec287b..23263107 100644 --- a/src/compositor/compositor_api/qwaylandsurface_p.h +++ b/src/compositor/compositor_api/qwaylandsurface_p.h @@ -49,7 +49,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <private/qobject_p.h> #include <private/qwlclientbuffer_p.h> diff --git a/src/compositor/compositor_api/qwaylandsurfacegrabber.h b/src/compositor/compositor_api/qwaylandsurfacegrabber.h index 28f98410..512bd2ab 100644 --- a/src/compositor/compositor_api/qwaylandsurfacegrabber.h +++ b/src/compositor/compositor_api/qwaylandsurfacegrabber.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDSURFACEGRABBER_H #define QWAYLANDSURFACEGRABBER_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/QObject> QT_BEGIN_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp index 168edc49..92a8f5cf 100644 --- a/src/compositor/compositor_api/qwaylandtouch.cpp +++ b/src/compositor/compositor_api/qwaylandtouch.cpp @@ -133,7 +133,7 @@ QWaylandCompositor *QWaylandTouch::compositor() const } /*! - * Sends a touch point event for the touch device with the given \a id, + * Sends a touch point event to the touch device of \a surface with the given \a id, * \a position, and \a state. * * Returns the serial of the down or up event if sent, otherwise 0. @@ -162,7 +162,7 @@ uint QWaylandTouch::sendTouchPointEvent(QWaylandSurface *surface, int id, const } /*! - * Sends a touch frame event for the touch device. This indicates the end of a + * Sends a touch frame event to the touch device of a \a client. This indicates the end of a * contact point list. */ void QWaylandTouch::sendFrameEvent(QWaylandClient *client) @@ -174,7 +174,7 @@ void QWaylandTouch::sendFrameEvent(QWaylandClient *client) } /*! - * Sends a touch cancel event for the touch device. + * Sends a touch cancel event to the touch device of a \a client. */ void QWaylandTouch::sendCancelEvent(QWaylandClient *client) { @@ -185,8 +185,8 @@ void QWaylandTouch::sendCancelEvent(QWaylandClient *client) } /*! - * Sends all the touch points in \a event for this touch device, followed - * by a touch frame event. + * Sends all touch points in \a event to the specified \a surface, + * followed by a touch frame event. * * \sa sendTouchPointEvent(), sendFrameEvent() */ diff --git a/src/compositor/compositor_api/qwaylandtouch_p.h b/src/compositor/compositor_api/qwaylandtouch_p.h index 75529134..9ee3e9c1 100644 --- a/src/compositor/compositor_api/qwaylandtouch_p.h +++ b/src/compositor/compositor_api/qwaylandtouch_p.h @@ -49,7 +49,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/QWaylandDestroyListener> #include <QtWaylandCompositor/QWaylandTouch> #include <QtWaylandCompositor/QWaylandSeat> diff --git a/src/compositor/compositor_api/qwaylandview.h b/src/compositor/compositor_api/qwaylandview.h index 98734003..e19f1ec4 100644 --- a/src/compositor/compositor_api/qwaylandview.h +++ b/src/compositor/compositor_api/qwaylandview.h @@ -38,7 +38,7 @@ #define QWAYLANDSURFACEVIEW_H #include <QtWaylandCompositor/QWaylandBufferRef> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/QPointF> #include <QtCore/QObject> diff --git a/src/compositor/configure.json b/src/compositor/configure.json new file mode 100644 index 00000000..2ddccd98 --- /dev/null +++ b/src/compositor/configure.json @@ -0,0 +1,99 @@ +{ + "module": "waylandcompositor", + "depends": [ + "gui-private" + ], + "testDir": "../../config.tests", + + "libraries": { + "wayland-server": { + "label": "wayland-server", + "test": "wayland", + "sources": [ + { "type": "pkgConfig", "args": "wayland-server" }, + "-lwayland-server" + ] + }, + "wayland-egl": { + "test": "wayland_egl", + "sources": [ + { "type": "pkgConfig", "args": "wayland-egl" }, + "-lwayland-egl" + ] + }, + "xcomposite": { + "test": "xcomposite", + "sources": [ + { "type": "pkgConfig", "args": "xcomposite" }, + "-lxcomposite" + ] + }, + "glx": { + "test": "glx", + "sources": [ + { "type": "pkgConfig", "args": "x11 gl" }, + "-lX11 -lGl" + ] + } + }, + + "tests": { + "wayland-scanner": { + "type": "compile", + "test": "wayland_scanner", + "use": "wayland-server" + }, + "drm-egl-server": { + "type": "compile", + "test": "drm_egl_server", + "use": "egl" + }, + "libhybris-egl-server": { + "type": "compile", + "test": "libhybris_egl_server", + "use": "egl" + } + }, + + "features": { + "wayland-server": { + "label": "Qt Wayland Compositor", + "condition": "!config.win32 && libs.wayland-server && tests.wayland-scanner", + "output": [ "privateFeature" ] + }, + "wayland-egl": { + "label": "EGL", + "condition": "features.wayland-server && features.opengl && features.egl && libs.wayland-egl", + "output": [ "privateFeature" ] + }, + "wayland-brcm": { + "label": "Rasberry Pi", + "condition": "features.wayland-server && features.eglfs_brcm", + "output": [ "privateFeature" ] + }, + "xcomposite-egl": { + "label": "XComposite EGL", + "condition": "features.wayland-server && features.egl && features.opengl && libs.xcomposite", + "output": [ "privateFeature" ] + }, + "xcomposite-glx": { + "label": "XComposite EGL", + "condition": "features.wayland-server && features.opengl && !features.opengles2 && libs.xcomposite && libs.glx", + "output": [ "privateFeature" ] + }, + "drm-egl-server": { + "label": "DRM EGL", + "condition": "features.wayland-server && features.opengl && features.egl && tests.drm-egl-server", + "output": [ "privateFeature" ] + }, + "libhybris-egl-server": { + "label": "libhybris EGL", + "condition": "features.wayland-server && features.opengl && features.egl && tests.libhybris-egl-server", + "output": [ "privateFeature" ] + } + }, + + "summary": [ + "wayland-server" + ] +} diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp index fc3102df..06e12a5a 100644 --- a/src/compositor/extensions/qwaylandivisurface.cpp +++ b/src/compositor/extensions/qwaylandivisurface.cpp @@ -68,7 +68,7 @@ QWaylandIviSurface::QWaylandIviSurface() /*! * Constructs a QWaylandIviSurface for \a surface and initializes it with the - * given \a application, \a surface, \a iviId, and resource \a res. + * given \a application, \a surface, \a iviId, and \a resource. */ QWaylandIviSurface::QWaylandIviSurface(QWaylandIviApplication *application, QWaylandSurface *surface, uint iviId, const QWaylandResource &resource) : QWaylandShellSurfaceTemplate<QWaylandIviSurface>(*new QWaylandIviSurfacePrivate()) @@ -129,7 +129,7 @@ QWaylandSurface *QWaylandIviSurface::surface() const */ /*! - * \property QWaylandClient::iviId + * \property QWaylandIviSurface::iviId * * This property holds the ivi id of this QWaylandIviSurface. */ diff --git a/src/compositor/extensions/qwaylandivisurface.h b/src/compositor/extensions/qwaylandivisurface.h index 37c37c0f..ec536507 100644 --- a/src/compositor/extensions/qwaylandivisurface.h +++ b/src/compositor/extensions/qwaylandivisurface.h @@ -81,7 +81,7 @@ Q_SIGNALS: void iviIdChanged(); private: - void initialize(); + void initialize() Q_DECL_OVERRIDE; }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp index f6a88e43..91f9d777 100644 --- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp +++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp @@ -208,7 +208,7 @@ bool QWaylandQuickShellEventFilter::eventFilter(QObject *receiver, QEvent *e) QMouseEvent *event = static_cast<QMouseEvent*>(e); QWaylandQuickShellSurfaceItem *shellSurfaceItem = qobject_cast<QWaylandQuickShellSurfaceItem*>(item); bool finalRelease = (event->type() == QEvent::MouseButtonRelease) && (event->buttons() == Qt::NoButton); - bool popupClient = shellSurfaceItem && shellSurfaceItem->surface()->client() == client; + bool popupClient = shellSurfaceItem && shellSurfaceItem->surface() && shellSurfaceItem->surface()->client() == client; if (waitForRelease) { // We are eating events until all mouse buttons are released diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp index 3145c664..9b434679 100644 --- a/src/compositor/extensions/qwaylandwlshell.cpp +++ b/src/compositor/extensions/qwaylandwlshell.cpp @@ -335,7 +335,7 @@ QList<QWaylandWlShellSurface *> QWaylandWlShell::shellSurfacesForClient(QWayland Q_D(const QWaylandWlShell); QList<QWaylandWlShellSurface *> surfsForClient; Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) { - if (shellSurface->surface()->client() == client) + if (shellSurface->surface() && shellSurface->surface()->client() == client) surfsForClient.append(shellSurface); } return surfsForClient; @@ -347,7 +347,7 @@ QList<QWaylandWlShellSurface *> QWaylandWlShell::mappedPopups() const QList<QWaylandWlShellSurface *> popupSurfaces; Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) { if (shellSurface->windowType() == Qt::WindowType::Popup - && shellSurface->surface()->hasContent()) { + && shellSurface->surface() && shellSurface->surface()->hasContent()) { popupSurfaces.append(shellSurface); } } @@ -359,7 +359,7 @@ QWaylandClient *QWaylandWlShell::popupClient() const Q_D(const QWaylandWlShell); Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) { if (shellSurface->windowType() == Qt::WindowType::Popup - && shellSurface->surface()->hasContent()) { + && shellSurface->surface() && shellSurface->surface()->hasContent()) { return shellSurface->surface()->client(); } } diff --git a/src/compositor/extensions/qwaylandwlshell_p.h b/src/compositor/extensions/qwaylandwlshell_p.h index 5e890309..77229ef0 100644 --- a/src/compositor/extensions/qwaylandwlshell_p.h +++ b/src/compositor/extensions/qwaylandwlshell_p.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDWLSHELL_P_H #define QWAYLANDWLSHELL_P_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/qwaylandsurface.h> #include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> #include <QtWaylandCompositor/QWaylandWlShellSurface> @@ -98,7 +98,7 @@ public: private: QWaylandWlShell *m_shell; - QWaylandSurface *m_surface; + QPointer<QWaylandSurface> m_surface; QSet<uint32_t> m_pings; diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp index 30e4704a..761a9022 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration.cpp +++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp @@ -55,17 +55,17 @@ WlShellIntegration::WlShellIntegration(QWaylandQuickShellSurfaceItem *item) , nextState(State::Windowed) { m_item->setSurface(m_shellSurface->surface()); - connect(m_shellSurface, &QWaylandWlShellSurface::startMove, this, &WlShellIntegration::handleStartMove); - connect(m_shellSurface, &QWaylandWlShellSurface::startResize, this, &WlShellIntegration::handleStartResize); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::startMove, this, &WlShellIntegration::handleStartMove); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::startResize, this, &WlShellIntegration::handleStartResize); connect(m_shellSurface->surface(), &QWaylandSurface::redraw, this, &WlShellIntegration::handleRedraw); connect(m_shellSurface->surface(), &QWaylandSurface::offsetForNextFrame, this, &WlShellIntegration::adjustOffsetForNextFrame); connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged, this, &WlShellIntegration::handleSurfaceHasContentChanged); - connect(m_shellSurface, &QWaylandWlShellSurface::setDefaultToplevel, this, &WlShellIntegration::handleSetDefaultTopLevel); - connect(m_shellSurface, &QWaylandWlShellSurface::setTransient, this, &WlShellIntegration::handleSetTransient); - connect(m_shellSurface, &QWaylandWlShellSurface::setMaximized, this, &WlShellIntegration::handleSetMaximized); - connect(m_shellSurface, &QWaylandWlShellSurface::setFullScreen, this, &WlShellIntegration::handleSetFullScreen); - connect(m_shellSurface, &QWaylandWlShellSurface::setPopup, this, &WlShellIntegration::handleSetPopup); - connect(m_shellSurface, &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::setDefaultToplevel, this, &WlShellIntegration::handleSetDefaultTopLevel); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::setTransient, this, &WlShellIntegration::handleSetTransient); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::setMaximized, this, &WlShellIntegration::handleSetMaximized); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::setFullScreen, this, &WlShellIntegration::handleSetFullScreen); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::setPopup, this, &WlShellIntegration::handleSetPopup); + connect(m_shellSurface.data(), &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed); } void WlShellIntegration::handleStartMove(QWaylandSeat *seat) @@ -182,8 +182,9 @@ void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *par } isPopup = true; - QWaylandQuickShellEventFilter::startFilter(m_shellSurface->surface()->client(), [&]() { - m_shellSurface->shell()->closeAllPopups(); + auto shell = m_shellSurface->shell(); + QWaylandQuickShellEventFilter::startFilter(m_shellSurface->surface()->client(), [shell]() { + shell->closeAllPopups(); }); QObject::connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged, diff --git a/src/compositor/extensions/qwaylandwlshellintegration_p.h b/src/compositor/extensions/qwaylandwlshellintegration_p.h index bbdfbd73..c0bbcfd1 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration_p.h +++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h @@ -88,7 +88,7 @@ private: void handlePopupRemoved(); QWaylandQuickShellSurfaceItem *m_item; - QWaylandWlShellSurface *m_shellSurface; + QPointer<QWaylandWlShellSurface> m_shellSurface; GrabberState grabberState; struct { QWaylandSeat *seat; diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp index b73b84d7..fd23865c 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp @@ -912,13 +912,15 @@ QSize QWaylandXdgSurfaceV5::sizeForResize(const QSizeF &size, const QPointF &del } /*! - * \qmlmethod int QtWaylandCompositor::XdgSurface::sendConfigure(size size, List<uint>) + * \qmlmethod int QtWaylandCompositor::XdgSurface::sendConfigure(size size, list<uint> states) * - * Sends a configure event to the client. Known states are enumerated in XdgSurface::State + * Sends a configure event to the client. \a size contains the pixel size of the surface. + * Known \a states are enumerated in XdgSurface::State. */ /*! - * Sends a configure event to the client. Known states are enumerated in QWaylandXdgSurfaceV5::State + * Sends a configure event to the client. Parameter \a size contains the pixel size + * of the surface. Known \a states are enumerated in QWaylandXdgSurfaceV5::State. */ uint QWaylandXdgSurfaceV5::sendConfigure(const QSize &size, const QVector<uint> &states) { @@ -1038,8 +1040,8 @@ QWaylandXdgPopupV5::QWaylandXdgPopupV5() } /*! - * Constructs a QWaylandXdgPopupV5 for \a surface and initializes it with the - * given \a parentSurface and \a resource. + * Constructs a QWaylandXdgPopupV5, associating it with \a xdgShell at the specified \a position + * for \a surface and initializes it with the given \a parentSurface and \a resource. */ QWaylandXdgPopupV5::QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource) diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp index b3170333..e2aa6b3e 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp @@ -194,10 +194,14 @@ XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item , m_xdgShell(QWaylandXdgPopupV5Private::get(m_xdgPopup)->m_xdgShell) { item->setSurface(m_xdgPopup->surface()); - item->moveItem()->setPosition(QPointF(m_xdgPopup->position() * item->view()->output()->scaleFactor())); + if (item->view()->output()) + item->moveItem()->setPosition(QPointF(m_xdgPopup->position() * item->view()->output()->scaleFactor())); + else + qWarning() << "XdgPopupV5Integration popup item without output" << item; QWaylandClient *client = m_xdgPopup->surface()->client(); - QWaylandQuickShellEventFilter::startFilter(client, [&]() { m_xdgShell->closeAllPopups(); }); + auto shell = m_xdgShell; + QWaylandQuickShellEventFilter::startFilter(client, [shell]() { shell->closeAllPopups(); }); connect(m_xdgPopup, &QWaylandXdgPopupV5::destroyed, this, &XdgPopupV5Integration::handlePopupDestroyed); } diff --git a/src/compositor/global/global.pri b/src/compositor/global/global.pri index e48b8a8c..29d4f437 100644 --- a/src/compositor/global/global.pri +++ b/src/compositor/global/global.pri @@ -1,7 +1,7 @@ INCLUDEPATH += global/ HEADERS += \ - global/qwaylandexport.h \ + global/qtwaylandcompositorglobal.h \ global/qwaylandcompositorextension.h \ global/qwaylandcompositorextension_p.h \ global/qwaylandquickextension.h \ diff --git a/src/compositor/global/qtwaylandcompositorglobal.h b/src/compositor/global/qtwaylandcompositorglobal.h new file mode 100644 index 00000000..403f1962 --- /dev/null +++ b/src/compositor/global/qtwaylandcompositorglobal.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** 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 QWAYLANDCOMPOSITORGLOBAL_H +#define QWAYLANDCOMPOSITORGLOBAL_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 <QtGui/qtguiglobal.h> +#include <QtWaylandCompositor/qtwaylandcompositor-config.h> + +QT_BEGIN_NAMESPACE + +#if !defined(Q_WAYLAND_COMPOSITOR_EXPORT) +# if defined(QT_SHARED) && defined(QT_BUILD_COMPOSITOR_LIB) +# define Q_WAYLAND_COMPOSITOR_EXPORT Q_DECL_EXPORT +# elif defined(QT_SHARED) +# define Q_WAYLAND_COMPOSITOR_EXPORT Q_DECL_IMPORT +# else +# define Q_WAYLAND_COMPOSITOR_EXPORT +# endif +#endif + +QT_END_NAMESPACE + +#endif // QWAYLANDCOMPOSITORGLOBAL_H + diff --git a/src/compositor/global/qtwaylandcompositorglobal_p.h b/src/compositor/global/qtwaylandcompositorglobal_p.h new file mode 100644 index 00000000..629d5829 --- /dev/null +++ b/src/compositor/global/qtwaylandcompositorglobal_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 QWAYLANDCOMPOSITORGLOBAL_P_H +#define QWAYLANDCOMPOSITORGLOBAL_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 <QtWaylandCompositor/qtwaylandcompositorglobal.h> +#include <QtGui/private/qtguiglobal_p.h> +#include <QtWaylandCompositor/private/qtwaylandcompositor-config_p.h> + +#endif // QWAYLANDCOMPOSITORGLOBAL_P_H + diff --git a/src/compositor/global/qwaylandcompositorextension.h b/src/compositor/global/qwaylandcompositorextension.h index d666b4f2..e9aa8460 100644 --- a/src/compositor/global/qwaylandcompositorextension.h +++ b/src/compositor/global/qwaylandcompositorextension.h @@ -37,7 +37,7 @@ #ifndef QWAYLANDEXTENSION_H #define QWAYLANDEXTENSION_H -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/QObject> #include <QtCore/QVector> diff --git a/src/compositor/global/qwaylandexport.h b/src/compositor/global/qwaylandexport.h deleted file mode 100644 index ddfa6aa7..00000000 --- a/src/compositor/global/qwaylandexport.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WAYLANDEXPORT_H -#define WAYLANDEXPORT_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -#if !defined(Q_WAYLAND_COMPOSITOR_EXPORT) -# if defined(QT_SHARED) && defined(QT_BUILD_COMPOSITOR_LIB) -# define Q_WAYLAND_COMPOSITOR_EXPORT Q_DECL_EXPORT -# elif defined(QT_SHARED) -# define Q_WAYLAND_COMPOSITOR_EXPORT Q_DECL_IMPORT -# else -# define Q_WAYLAND_COMPOSITOR_EXPORT -# endif -#endif - -QT_END_NAMESPACE - -#endif //WAYLANDEXPORT_H diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri index 624190a6..dd892e07 100644 --- a/src/compositor/hardware_integration/hardware_integration.pri +++ b/src/compositor/hardware_integration/hardware_integration.pri @@ -1,4 +1,4 @@ -contains(QT_CONFIG, opengl) { +qtConfig(opengl) { CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ ../extensions/server-buffer-extension.xml \ @@ -21,8 +21,6 @@ contains(QT_CONFIG, opengl) { hardware_integration/qwlserverbufferintegrationfactory.cpp \ hardware_integration/qwlserverbufferintegrationplugin.cpp \ hardware_integration/qwlhwintegration.cpp \ - - DEFINES += QT_WAYLAND_COMPOSITOR_GL } else { system(echo "Qt-Compositor configured as raster only compositor") } diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h index a7de2c0e..c4bed100 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h +++ b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtWaylandCompositor/qwaylandsurface.h> #include <QtWaylandCompositor/qwaylandbufferref.h> #include <QtCore/QSize> diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp index 36ac56cf..e805f498 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp +++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE namespace QtWayland { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QtWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-server"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -54,7 +54,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList ClientBufferIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -77,7 +77,7 @@ QStringList ClientBufferIntegrationFactory::keys(const QString &pluginPath) ClientBufferIntegration *ClientBufferIntegrationFactory::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/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h index 3c1d856c..1ed99083 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h +++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h index d8bc33fb..e8fca43f 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h +++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h index 3a71f18f..9a1287fa 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h +++ b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h @@ -52,7 +52,7 @@ #include <QtCore/QSize> #include <QtGui/qopengl.h> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> struct wl_client; struct wl_resource; diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp index 05f16e52..c366921f 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp +++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE namespace QtWayland { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QtWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-server"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -54,7 +54,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList ServerBufferIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -77,7 +77,7 @@ QStringList ServerBufferIntegrationFactory::keys(const QString &pluginPath) ServerBufferIntegration *ServerBufferIntegrationFactory::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/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h index b29ddd04..15d54a29 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h +++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h index fc8c3bf1..6c144d74 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h +++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp index 589ab825..d5295038 100644 --- a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp +++ b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp @@ -36,7 +36,7 @@ #include "qwlclientbuffer_p.h" -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) #include "hardware_integration/qwlclientbufferintegration_p.h" #include <qpa/qplatformopenglcontext.h> #include <QOpenGLTexture> @@ -150,7 +150,7 @@ QImage SharedMemoryBuffer::image() const return QImage(); } -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) QOpenGLTexture *SharedMemoryBuffer::toOpenGlTexture(int plane) { Q_UNUSED(plane); diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h index 78e07ee9..dafb3c5e 100644 --- a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h +++ b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h @@ -97,7 +97,7 @@ public: bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); } -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) virtual QOpenGLTexture *toOpenGlTexture(int plane = 0) = 0; #endif @@ -132,7 +132,7 @@ public: QWaylandSurface::Origin origin() const Q_DECL_OVERRIDE; QImage image() const; -#ifdef QT_WAYLAND_COMPOSITOR_GL +#if QT_CONFIG(opengl) QOpenGLTexture *toOpenGlTexture(int plane = 0) Q_DECL_OVERRIDE; private: diff --git a/src/compositor/wayland_wrapper/qwlregion_p.h b/src/compositor/wayland_wrapper/qwlregion_p.h index ca14c7a5..c63cdbc4 100644 --- a/src/compositor/wayland_wrapper/qwlregion_p.h +++ b/src/compositor/wayland_wrapper/qwlregion_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include <QRegion> diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri index fa5d7629..48e55e51 100644 --- a/src/compositor/wayland_wrapper/wayland_wrapper.pri +++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri @@ -24,12 +24,5 @@ SOURCES += \ INCLUDEPATH += wayland_wrapper -config_xkbcommon { - !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG_PRIVATE += xkbcommon - } else { - LIBS_PRIVATE += -lxkbcommon - } -} else { - DEFINES += QT_NO_WAYLAND_XKB -} +qtConfig(xkbcommon-evdev): \ + QMAKE_USE += xkbcommon_evdev diff --git a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri index c4ccdcc6..64cb4467 100644 --- a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri +++ b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri @@ -1,13 +1,7 @@ INCLUDEPATH += $$PWD -contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client -} else { - LIBS += -lwayland-client -} - -CONFIG += egl +QMAKE_USE += egl wayland-client +QT += egl_support-private SOURCES += $$PWD/qwaylandbrcmeglintegration.cpp \ $$PWD/qwaylandbrcmglcontext.cpp \ diff --git a/src/hardwareintegration/client/drm-egl-server/drm-egl-server.pri b/src/hardwareintegration/client/drm-egl-server/drm-egl-server.pri index c3d592a9..700e95e3 100644 --- a/src/hardwareintegration/client/drm-egl-server/drm-egl-server.pri +++ b/src/hardwareintegration/client/drm-egl-server/drm-egl-server.pri @@ -1,13 +1,6 @@ INCLUDEPATH += $$PWD -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-client -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client -} - -CONFIG += egl +QMAKE_USE += egl wayland-client SOURCES += \ $$PWD/drmeglserverbufferintegration.cpp diff --git a/src/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri b/src/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri index 55e0ffd2..bc821574 100644 --- a/src/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri +++ b/src/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri @@ -1,11 +1,6 @@ INCLUDEPATH += $$PWD -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lEGL -lwayland-client -} else { - CONFIG += link_pkgconfig - PKGCONFIG += egl wayland-client -} +QMAKE_USE += egl wayland-client SOURCES += \ $$PWD/libhybriseglserverbufferintegration.cpp diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp index 236218e7..6b5c5326 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp @@ -159,6 +159,12 @@ void QWaylandEglWindow::setVisible(bool visible) { QWaylandWindow::setVisible(visible); if (!visible) + QMetaObject::invokeMethod(this, "doInvalidateSurface", Qt::QueuedConnection); +} + +void QWaylandEglWindow::doInvalidateSurface() +{ + if (!window()->isVisible()) invalidateSurface(); } @@ -168,6 +174,10 @@ void QWaylandEglWindow::invalidateSurface() eglDestroySurface(m_clientBufferIntegration->eglDisplay(), m_eglSurface); m_eglSurface = 0; } + if (m_waylandEglWindow) { + wl_egl_window_destroy(m_waylandEglWindow); + m_waylandEglWindow = nullptr; + } } EGLSurface QWaylandEglWindow::eglSurface() const diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h index 556ed687..bf656689 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h @@ -54,6 +54,7 @@ class QWaylandGLContext; class QWaylandEglWindow : public QWaylandWindow { + Q_OBJECT public: QWaylandEglWindow(QWindow *window); ~QWaylandEglWindow(); @@ -75,6 +76,9 @@ public: void invalidateSurface() Q_DECL_OVERRIDE; void setVisible(bool visible) Q_DECL_OVERRIDE; +private Q_SLOTS: + void doInvalidateSurface(); + private: QWaylandEglClientBufferIntegration *m_clientBufferIntegration; struct wl_egl_window *m_waylandEglWindow; diff --git a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri index 276b7b54..d7634b15 100644 --- a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri +++ b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri @@ -1,13 +1,7 @@ INCLUDEPATH += $$PWD -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client wayland-egl -} else { - LIBS += -lwayland-client -lwayland-egl -} -DEFINES += QT_EGL_WAYLAND -CONFIG += egl +QMAKE_USE += egl wayland-client wayland-egl + QT += egl_support-private SOURCES += $$PWD/qwaylandeglclientbufferintegration.cpp \ diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp index e2e2f551..c07ad534 100644 --- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp +++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp @@ -64,9 +64,7 @@ void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface) QSize size = w->geometry().size(); - w->attach(w->buffer(), 0, 0); - w->damage(QRect(QPoint(), size)); - w->commit(); + w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height())); w->waitForFrameSync(); } diff --git a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri index 3a5fcb54..f2beb1e0 100644 --- a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri +++ b/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri @@ -1,15 +1,9 @@ INCLUDEPATH += $$PWD include($$PWD/../xcomposite_share/xcomposite_share.pri) -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client xcomposite x11 -} else { - LIBS += -lXcomposite -lX11 -} +QMAKE_USE += egl wayland-client QT += egl_support-private -CONFIG += egl SOURCES += \ $$PWD/qwaylandxcompositeeglcontext.cpp \ diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp index bc6e94fe..439acc00 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp @@ -90,9 +90,7 @@ void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface) glXSwapBuffers(m_display, w->xWindow()); - w->attach(w->buffer(), 0, 0); - w->damage(QRect(QPoint(), size)); - w->commit(); + w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height())); w->waitForFrameSync(); } diff --git a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri b/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri index bc072bf0..067378af 100644 --- a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri +++ b/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri @@ -1,12 +1,7 @@ INCLUDEPATH += $$PWD include ($$PWD/../xcomposite_share/xcomposite_share.pri) -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client xcomposite gl x11 -} else { - LIBS += -lXcomposite -lGL -lX11 -} +QMAKE_USE += wayland-client glx QT += glx_support-private diff --git a/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri b/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri index be3c9fc1..f255f5c5 100644 --- a/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri +++ b/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri @@ -1,5 +1,6 @@ INCLUDEPATH += $$PWD +QMAKE_USE += xcomposite CONFIG += wayland-scanner WAYLANDCLIENTSOURCES += $$PWD/../../../extensions/xcomposite.xml diff --git a/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri b/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri index f4780710..e5f3d917 100644 --- a/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri +++ b/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri @@ -2,14 +2,7 @@ QT = waylandcompositor waylandcompositor-private core-private gui-private INCLUDEPATH += $$PWD -DEFINES += QT_NO_OPENGL_ES_3 - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-server -} else { - LIBS += -lwayland-server -} +QMAKE_USE_PRIVATE += wayland-server for(p, QMAKE_LIBDIR_EGL) { exists($$p):LIBS += -L$$p diff --git a/src/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri b/src/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri index 2ed5db68..7d684174 100644 --- a/src/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri +++ b/src/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri @@ -1,13 +1,6 @@ INCLUDEPATH += $$PWD -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-server -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-server -} - -CONFIG += egl +QMAKE_USE_PRIVATE += egl wayland-server SOURCES += \ $$PWD/drmeglserverbufferintegration.cpp diff --git a/src/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri b/src/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri index 5cbcb6b7..125be9c5 100644 --- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri +++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri @@ -1,13 +1,6 @@ INCLUDEPATH += $$PWD -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-server -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-server -} - -CONFIG += egl +QMAKE_USE_PRIVATE += egl wayland-server SOURCES += \ $$PWD/libhybriseglserverbufferintegration.cpp diff --git a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri index f3647489..df3aead3 100644 --- a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri +++ b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri @@ -1,13 +1,7 @@ INCLUDEPATH += $$PWD -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-server wayland-egl -} else { - LIBS += -lwayland-egl -lwayland-server -} +QMAKE_USE_PRIVATE += wayland-server wayland-egl -CONFIG += egl QT += egl_support-private SOURCES += \ diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri index d748c2b5..6d0f8165 100644 --- a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri +++ b/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri @@ -1,13 +1,6 @@ include($$PWD/../xcomposite_share/xcomposite_share.pri) -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xcomposite x11 wayland-server -} else { - LIBS += -lXcomposite -lX11 -} - -CONFIG += egl +QMAKE_USE_PRIVATE += egl wayland-server x11 INCLUDEPATH += $$PWD diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri b/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri index ccbbe46a..423ae181 100644 --- a/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri +++ b/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri @@ -1,11 +1,6 @@ include($$PWD/../xcomposite_share/xcomposite_share.pri) -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xcomposite gl x11 wayland-server -} else { - LIBS += -lXcomposite -lGL -lX11 -} +QMAKE_USE_PRIVATE += wayland-server glx INCLUDEPATH += $$PWD diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri b/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri index 06937c41..69ab6aa1 100644 --- a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri +++ b/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri @@ -1,5 +1,6 @@ INCLUDEPATH += $$PWD +QMAKE_USE += xcomposite CONFIG += wayland-scanner WAYLANDSERVERSOURCES += $$PWD/../../../extensions/xcomposite.xml $$PWD/../../../3rdparty/protocol/wayland.xml diff --git a/src/imports/compositor/qwaylandmousetracker_p.h b/src/imports/compositor/qwaylandmousetracker_p.h index d90b037f..45c80208 100644 --- a/src/imports/compositor/qwaylandmousetracker_p.h +++ b/src/imports/compositor/qwaylandmousetracker_p.h @@ -39,7 +39,7 @@ #include <QtQuick/private/qquickmousearea_p.h> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp index 28c517fd..0caa4a35 100644 --- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp +++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp @@ -59,7 +59,7 @@ #include <QtWaylandCompositor/QWaylandIviApplication> #include <QtWaylandCompositor/QWaylandIviSurface> -#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qtwaylandcompositorglobal.h> #include "qwaylandmousetracker_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/decorations/bradient/bradient.pro b/src/plugins/decorations/bradient/bradient.pro index 0f62db9c..843149e0 100644 --- a/src/plugins/decorations/bradient/bradient.pro +++ b/src/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/decorations/bradient/main.cpp b/src/plugins/decorations/bradient/main.cpp index f7ce0fca..f57b816e 100644 --- a/src/plugins/decorations/bradient/main.cpp +++ b/src/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/hardwareintegration/client/client.pro b/src/plugins/hardwareintegration/client/client.pro index 37a90ab0..a5967c71 100644 --- a/src/plugins/hardwareintegration/client/client.pro +++ b/src/plugins/hardwareintegration/client/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/hardwareintegration/compositor/compositor.pro b/src/plugins/hardwareintegration/compositor/compositor.pro index 1ecfe37a..29911625 100644 --- a/src/plugins/hardwareintegration/compositor/compositor.pro +++ b/src/plugins/hardwareintegration/compositor/compositor.pro @@ -1,20 +1,15 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += waylandcompositor-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/platforms.pro b/src/plugins/platforms/platforms.pro index 4bee8929..ec589ae8 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -1,19 +1,17 @@ TEMPLATE=subdirs CONFIG+=ordered +QT_FOR_CONFIG += waylandclient-private SUBDIRS += qwayland-generic -config_wayland_egl { +qtConfig(wayland-egl): \ SUBDIRS += qwayland-egl -} #The following integrations are only useful with QtWaylandCompositor -config_brcm_egl: \ +qtConfig(wayland-brcm): \ SUBDIRS += qwayland-brcm-egl -config_xcomposite { - contains(QT_CONFIG, egl): \ - SUBDIRS += qwayland-xcomposite-egl - !contains(QT_CONFIG, opengles2):config_glx: \ - SUBDIRS += qwayland-xcomposite-glx -} +qtConfig(xcomposite-egl): \ + SUBDIRS += qwayland-xcomposite-egl +qtConfig(xcomposite-glx): \ + SUBDIRS += qwayland-xcomposite-glx diff --git a/src/plugins/shellintegration/ivi-shell/ivi-shell.pro b/src/plugins/shellintegration/ivi-shell/ivi-shell.pro index 8fd77473..baaf1698 100644 --- a/src/plugins/shellintegration/ivi-shell/ivi-shell.pro +++ b/src/plugins/shellintegration/ivi-shell/ivi-shell.pro @@ -1,25 +1,13 @@ PLUGIN_TYPE = wayland-shell-integration load(qt_plugin) -QT += waylandclient-private +QT += gui-private waylandclient-private CONFIG += wayland-scanner -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client wayland-cursor - CONFIG += link_pkgconfig -} else { - LIBS += -lwayland-client -lwayland-cursor -} +QMAKE_USE += wayland-client -config_xkbcommon { - !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += xkbcommon - } else { - LIBS += -lxkbcommon - } -} else { - DEFINES += QT_NO_WAYLAND_XKB -} +qtConfig(xkbcommon-evdev): \ + QMAKE_USE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/ivi-application.xml \ diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp index 6876385b..6103e6be 100644 --- a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp +++ b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp @@ -66,6 +66,7 @@ QWaylandIviShellIntegration::~QWaylandIviShellIntegration() bool QWaylandIviShellIntegration::initialize(QWaylandDisplay *display) { + QWaylandShellIntegration::initialize(display); display->addRegistryListener(registryIvi, this); return true; diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp index f8871fa2..ecc47e0b 100644 --- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp +++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp @@ -71,6 +71,13 @@ QWaylandIviSurface::~QWaylandIviSurface() delete m_extendedWindow; } +void QWaylandIviSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + + Q_UNUSED(type) + Q_UNUSED(transientParent) +} + void QWaylandIviSurface::createExtendedSurface(QWaylandWindow *window) { if (window->display()->windowExtension()) diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h index 96978e28..9ac81ad6 100644 --- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h +++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h @@ -56,6 +56,8 @@ public: struct ::ivi_controller_surface *iviControllerSurface); virtual ~QWaylandIviSurface(); + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + private: void createExtendedSurface(QWaylandWindow *window); virtual void ivi_surface_configure(int32_t width, int32_t height) Q_DECL_OVERRIDE; diff --git a/src/shared/qwaylandxkb.cpp b/src/shared/qwaylandxkb.cpp index 2afdcce8..3e04467d 100644 --- a/src/shared/qwaylandxkb.cpp +++ b/src/shared/qwaylandxkb.cpp @@ -43,8 +43,6 @@ #include <QKeyEvent> #include <QString> -#ifndef QT_NO_WAYLAND_XKB - #include <xkbcommon/xkbcommon-keysyms.h> QT_BEGIN_NAMESPACE @@ -377,5 +375,3 @@ QVector<xkb_keysym_t> QWaylandXkb::toKeysym(QKeyEvent *event) } QT_END_NAMESPACE - -#endif // QT_NO_WAYLAND_XKB diff --git a/src/shared/qwaylandxkb_p.h b/src/shared/qwaylandxkb_p.h index cdebf1b0..230159fb 100644 --- a/src/shared/qwaylandxkb_p.h +++ b/src/shared/qwaylandxkb_p.h @@ -41,8 +41,6 @@ #ifndef QWAYLANDXKB_H #define QWAYLANDXKB_H -#ifndef QT_NO_WAYLAND_XKB - #include <Qt> #include <QEvent> #include <xkbcommon/xkbcommon.h> @@ -65,6 +63,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_WAYLAND_XKB - #endif diff --git a/src/src.pro b/src/src.pro index bf5ffe36..4ecbc71b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,25 +1,33 @@ TEMPLATE=subdirs +include($$OUT_PWD/client/qtwaylandclient-config.pri) +include($$OUT_PWD/compositor/qtwaylandcompositor-config.pri) +QT_FOR_CONFIG += waylandclient-private waylandcompositor-private -sub_qtwaylandscanner.subdir = qtwaylandscanner -sub_qtwaylandscanner.target = sub-qtwaylandscanner -SUBDIRS += sub_qtwaylandscanner +qtConfig(wayland-client) { + sub_qtwaylandscanner.subdir = qtwaylandscanner + sub_qtwaylandscanner.target = sub-qtwaylandscanner + SUBDIRS += sub_qtwaylandscanner -sub_compositor.subdir = compositor -sub_compositor.depends = sub-qtwaylandscanner -sub_compositor.target = sub-compositor -SUBDIRS += sub_compositor + sub_client.subdir = client + sub_client.depends = sub-qtwaylandscanner + sub_client.target = sub-client + SUBDIRS += sub_client -sub_imports.subdir = imports -sub_imports.depends += sub-compositor -sub_imports.target = sub-imports -SUBDIRS += sub_imports + qtConfig(wayland-server) { + sub_compositor.subdir = compositor + sub_compositor.depends = sub-qtwaylandscanner + sub_compositor.target = sub-compositor + SUBDIRS += sub_compositor -sub_client.subdir = client -sub_client.depends = sub-qtwaylandscanner -sub_client.target = sub-client -SUBDIRS += sub_client + sub_imports.subdir = imports + sub_imports.depends += sub-compositor + sub_imports.target = sub-imports + SUBDIRS += sub_imports + + sub_plugins.subdir = plugins + sub_plugins.depends = sub-qtwaylandscanner sub-client sub-compositor + sub_plugins.target = sub-plugins + SUBDIRS += sub_plugins + } +} -sub_plugins.subdir = plugins -sub_plugins.depends = sub-qtwaylandscanner sub-client sub-compositor -sub_plugins.target = sub-plugins -SUBDIRS += sub_plugins diff --git a/sync.profile b/sync.profile index 6fee67e4..458ee9f2 100644 --- a/sync.profile +++ b/sync.profile @@ -7,19 +7,13 @@ %classnames = ( ); %deprecatedheaders = ( + "QtWaylandClient" => { + "qwaylandclientexport.h" => "QtWaylandClient/qtwaylandclientglobal.h" + }, + "QtWaylandCompositor" => { + "qwaylandexport.h" => "QtWaylandCompositor/qtwaylandcompositorglobal.h" + } ); -# Module dependencies. -# Every module that is required to build this module should have one entry. -# Each of the module version specifiers can take one of the following values: -# - A specific Git revision. -# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) -# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) -# -%dependencies = ( - "qtbase" => "", - "qtdeclarative" => "", -); - %classnames = ( "qwaylandquickextension.h" => "QWaylandQuickExtension", ); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index a704c732..79ad29bd 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,5 +1,7 @@ TEMPLATE=subdirs +QT_FOR_CONFIG += waylandclient-private -SUBDIRS += client -SUBDIRS += cmake -SUBDIRS += compositor +qtConfig(wayland-client): \ + SUBDIRS += client cmake +qtHaveModule(waylandcompositor): \ + SUBDIRS += compositor diff --git a/tests/auto/client/client/client.pro b/tests/auto/client/client/client.pro index 006d130a..34fc6747 100644 --- a/tests/auto/client/client/client.pro +++ b/tests/auto/client/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/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index 0749239f..f48bb872 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/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 diff --git a/tests/auto/compositor/compositor/compositor.pro b/tests/auto/compositor/compositor/compositor.pro index 1d4456f6..f0cdaf32 100644 --- a/tests/auto/compositor/compositor/compositor.pro +++ b/tests/auto/compositor/compositor/compositor.pro @@ -5,21 +5,10 @@ TARGET = tst_compositor QT += testlib QT += core-private gui-private waylandcompositor waylandcompositor-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_xkbcommon { - !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG_PRIVATE += xkbcommon - } else { - LIBS_PRIVATE += -lxkbcommon - } -} else { - DEFINES += QT_NO_WAYLAND_XKB -} +qtConfig(xkbcommon-evdev) + QMAKE_USE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ ../../../../src/3rdparty/protocol/xdg-shell.xml \ diff --git a/config.tests/xkbcommon/main.cpp b/tests/manual/qmlclient/main.cpp index 97162f3d..cb2044c2 100644 --- a/config.tests/xkbcommon/main.cpp +++ b/tests/manual/qmlclient/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Contact: http://www.qt-project.org/legal ** -** This file is part of the Qt Compositor. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,30 +38,14 @@ ** ****************************************************************************/ -#include <xkbcommon/xkbcommon.h> -#include <xkbcommon/xkbcommon-keysyms.h> -#include <string.h> +#include <QtGui/QGuiApplication> +#include <QtQml/QQmlApplicationEngine> -int main() +int main(int argc, char* argv[]) { - xkb_rule_names names; - names.rules = strdup("evdev"); - names.model = strdup("pc105"); - names.layout = strdup("us"); - names.variant = strdup(""); - names.options = strdup(""); + setenv("QT_QPA_PLATFORM", "wayland", 1); - xkb_context *context = xkb_context_new(xkb_context_flags(0)); - if (context) { - xkb_keymap * keymap = xkb_map_new_from_names(context, &names, xkb_map_compile_flags(0)); - if (keymap) { - xkb_state *state = xkb_state_new(keymap); - if (state) - xkb_state_unref(state); - xkb_map_unref(keymap); - } - xkb_context_unref(context); - } - - return 0; + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); } diff --git a/tests/manual/qmlclient/main.qml b/tests/manual/qmlclient/main.qml new file mode 100644 index 00000000..a1fe241c --- /dev/null +++ b/tests/manual/qmlclient/main.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Window 2.2 + +Window { + id: window + width: 400 + height: 400 + color: "blue" + visible: true + + Column { + spacing: 8 + + Row { + spacing: 8 + + Repeater { + model: ListModel { + ListElement { label: "Windowed"; value: Window.Windowed } + ListElement { label: "Maximized"; value: Window.Maximized } + ListElement { label: "FullScreen"; value: Window.FullScreen } + } + + Rectangle { + width: 96 + height: 40 + color: "gainsboro" + + MouseArea { + anchors.fill: parent + onClicked: window.visibility = model.value + + Text { + anchors.centerIn: parent + text: model.label + } + } + } + } + } + + Text { + color: "white" + text: { + switch (window.visibility) { + case Window.Windowed: + return "windowed"; + case Window.Maximized: + return "maximized"; + case Window.FullScreen: + return "fullscreen"; + case Window.Minimized: + return "minimized"; + case Window.AutomaticVisibility: + return "automatic"; + case Window.Hidden: + return "hidden"; + default: + break; + } + return "unknown"; + } + } + } +} diff --git a/tests/manual/qmlclient/qml.qrc b/tests/manual/qmlclient/qml.qrc new file mode 100644 index 00000000..6b2d0a78 --- /dev/null +++ b/tests/manual/qmlclient/qml.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>main.qml</file> +</qresource> +</RCC> diff --git a/tests/manual/qmlclient/qmlclient.pro b/tests/manual/qmlclient/qmlclient.pro new file mode 100644 index 00000000..dcf66db5 --- /dev/null +++ b/tests/manual/qmlclient/qmlclient.pro @@ -0,0 +1,12 @@ +TEMPLATE = app + +QT += \ + gui gui-private core-private \ + quick \ + waylandclient \ + +SOURCES += \ + main.cpp + +RESOURCES += \ + qml.qrc |