diff options
35 files changed, 112 insertions, 344 deletions
diff --git a/config.tests/brcm_egl/main.cpp b/config.tests/brcm_egl/main.cpp index 5102ba66..bb3cab73 100644 --- a/config.tests/brcm_egl/main.cpp +++ b/config.tests/brcm_egl/main.cpp @@ -43,7 +43,6 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> int main() @@ -63,8 +62,8 @@ int main() EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM; EGLint id[2]; - eglCreateGlobalImageBRCM(32, 32, pixel_format, 0, 32 * 4, id); - eglDestroyGlobalImageBRCM(id); + PFNEGLCREATEGLOBALIMAGEBRCMPROC createImage = (PFNEGLCREATEGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglCreateGlobalImageBRCM"); + createImage(32, 32, pixel_format, 0, 32 * 4, id); eglTerminate(display); diff --git a/config.tests/egl/egl.pro b/config.tests/egl/egl.pro deleted file mode 100644 index 402477db..00000000 --- a/config.tests/egl/egl.pro +++ /dev/null @@ -1,15 +0,0 @@ -TARGET = egl -QT = core - -!contains(QT_CONFIG, opengl): error("egl support requires Qt configured with OpenGL") -!contains(QT_CONFIG, egl): error("egl support requires Qt configured with EGL") - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += egl -} else { - LIBS += -lEGL -} - -# Input -SOURCES += main.cpp diff --git a/config.tests/egl/main.cpp b/config.tests/egl/main.cpp deleted file mode 100644 index a47358e6..00000000 --- a/config.tests/egl/main.cpp +++ /dev/null @@ -1,47 +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 <EGL/egl.h> - -int main(int argc, char **argv) -{ - EGLDisplay display = eglGetDisplay(0); - return 0; -} diff --git a/examples/wayland/qwindow-compositor/textureblitter.cpp b/examples/wayland/qwindow-compositor/textureblitter.cpp index c550985d..df4fa18d 100644 --- a/examples/wayland/qwindow-compositor/textureblitter.cpp +++ b/examples/wayland/qwindow-compositor/textureblitter.cpp @@ -44,6 +44,10 @@ #include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLFunctions> +#ifndef GL_TEXTURE_EXTERNAL_OES +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#endif + QT_BEGIN_NAMESPACE TextureBlitter::TextureBlitter() diff --git a/qtwayland.pro b/qtwayland.pro index 88761497..b5088072 100644 --- a/qtwayland.pro +++ b/qtwayland.pro @@ -6,7 +6,6 @@ qtCompileTest(xkbcommon) qtCompileTest(wayland_cursor) qtCompileTest(wayland_scanner) qtCompileTest(wayland_egl) -qtCompileTest(egl) qtCompileTest(brcm_egl) qtCompileTest(glx) qtCompileTest(xcomposite) diff --git a/src/client/client.pro b/src/client/client.pro index ca0e0a7d..6802cd47 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -16,7 +16,6 @@ load(qt_module) QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual CONFIG -= precompile_header -CONFIG -= create_cmake CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner !equals(QT_WAYLAND_GL_CONFIG, nogl) { @@ -78,7 +77,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandabstractdecoration.cpp \ qwaylanddecorationfactory.cpp \ qwaylanddecorationplugin.cpp \ - qwaylandeventthread.cpp\ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ qwaylanddatadevice.cpp \ @@ -112,7 +110,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandabstractdecoration_p.h \ qwaylanddecorationfactory_p.h \ qwaylanddecorationplugin_p.h \ - qwaylandeventthread_p.h \ qwaylandwindowmanagerintegration_p.h \ qwaylandinputcontext_p.h \ qwaylanddatadevice_p.h \ diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index a3e084a0..3276348e 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -157,7 +157,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); - QMimeData *dragData; + QMimeData *dragData = Q_NULLPTR; Qt::DropActions supportedActions; if (drag) { dragData = drag->mimeData(); diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index ccd18947..82c1f201 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -33,7 +33,6 @@ #include "qwaylanddisplay_p.h" -#include "qwaylandeventthread_p.h" #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" #include "qwaylandscreen_p.h" @@ -145,21 +144,15 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) { qRegisterMetaType<uint32_t>("uint32_t"); - mEventThreadObject = new QWaylandEventThread(0); - mEventThread = new QThread(this); - mEventThread->setObjectName(QStringLiteral("QtWayland")); - mEventThreadObject->moveToThread(mEventThread); - mEventThread->start(); - - mEventThreadObject->displayConnect(); - mDisplay = mEventThreadObject->display(); //blocks until display is available + mDisplay = wl_display_connect(NULL); + if (mDisplay == NULL) { + qErrnoWarning(errno, "Failed to create display"); + ::exit(1); + } struct ::wl_registry *registry = wl_display_get_registry(mDisplay); init(registry); - connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); - connect(mEventThreadObject, &QWaylandEventThread::fatalError, this, &QWaylandDisplay::exitWithError); - mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this)); forceRoundTrip(); @@ -175,15 +168,28 @@ QWaylandDisplay::~QWaylandDisplay(void) } mScreens.clear(); delete mDndSelectionHandler.take(); - mEventThread->quit(); - mEventThread->wait(); - delete mEventThreadObject; + wl_display_disconnect(mDisplay); +} + +void QWaylandDisplay::checkError() const +{ + int ecode = wl_display_get_error(mDisplay); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { + qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); + } } void QWaylandDisplay::flushRequests() { + if (wl_display_prepare_read(mDisplay) == 0) { + wl_display_read_events(mDisplay); + } + if (wl_display_dispatch_pending(mDisplay) < 0) { - mEventThreadObject->checkError(); + checkError(); exitWithError(); } @@ -194,15 +200,13 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { if (wl_display_dispatch(mDisplay) < 0) { - mEventThreadObject->checkError(); + checkError(); exitWithError(); } } void QWaylandDisplay::exitWithError() { - mEventThread->quit(); - mEventThread->wait(); ::exit(1); } diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 664407b8..f5167dd2 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -178,6 +178,7 @@ public slots: private: void waitForScreens(); void exitWithError(); + void checkError() const; struct Listener { RegistryListener listener; @@ -187,8 +188,6 @@ private: struct wl_display *mDisplay; QtWayland::wl_compositor mCompositor; QScopedPointer<QWaylandShm> mShm; - QThread *mEventThread; - QWaylandEventThread *mEventThreadObject; QScopedPointer<QtWayland::wl_shell> mShell; QScopedPointer<QWaylandXdgShell> mShellXdg; QList<QWaylandScreen *> mScreens; diff --git a/src/client/qwaylanddnd.cpp b/src/client/qwaylanddnd.cpp index 59f91411..e195d193 100644 --- a/src/client/qwaylanddnd.cpp +++ b/src/client/qwaylanddnd.cpp @@ -65,21 +65,9 @@ QMimeData * QWaylandDrag::platformDropData() void QWaylandDrag::startDrag() { - bool cancel = false; - if (!shapedPixmapWindow()) { - QBasicDrag::startDrag(); - // Don't call cancel() here, since that will hide 'shapedPixmapWindow()', and - // QWaylandWindow::setVisible(false) will flush the window system queue, - // ending up trying to render the window, which doesn't have a role yet, - // and so blocking waiting for a frame callback. - cancel = true; - } - + QBasicDrag::startDrag(); QWaylandWindow *icon = static_cast<QWaylandWindow *>(shapedPixmapWindow()->handle()); m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon); - if (cancel) - QBasicDrag::cancel(); - QBasicDrag::startDrag(); } void QWaylandDrag::cancel() diff --git a/src/client/qwaylandeventthread.cpp b/src/client/qwaylandeventthread.cpp deleted file mode 100644 index e0a3edcb..00000000 --- a/src/client/qwaylandeventthread.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandeventthread_p.h" -#include <QtCore/QSocketNotifier> -#include <QCoreApplication> - -#include <unistd.h> -#include <fcntl.h> -#include <stdio.h> -#include <errno.h> - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandEventThread::QWaylandEventThread(QObject *parent) - : QObject(parent) - , m_display(0) - , m_fileDescriptor(-1) - , m_readNotifier(0) - , m_displayLock(new QMutex) -{ -} - -QWaylandEventThread::~QWaylandEventThread() -{ - delete m_displayLock; - wl_display_disconnect(m_display); -} - -void QWaylandEventThread::displayConnect() -{ - m_displayLock->lock(); - QMetaObject::invokeMethod(this, "waylandDisplayConnect", Qt::QueuedConnection); -} - -// ### be careful what you do, this function may also be called from other -// threads to clean up & exit. -void QWaylandEventThread::checkError() const -{ - int ecode = wl_display_get_error(m_display); - if ((ecode == EPIPE || ecode == ECONNRESET)) { - // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); - } else { - qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); - } -} - -void QWaylandEventThread::readWaylandEvents() -{ - if (wl_display_prepare_read(m_display) == 0) { - wl_display_read_events(m_display); - } - emit newEventsRead(); -} - -void QWaylandEventThread::waylandDisplayConnect() -{ - m_display = wl_display_connect(NULL); - if (m_display == NULL) { - qErrnoWarning(errno, "Failed to create display"); - ::exit(1); - } - m_displayLock->unlock(); - - m_fileDescriptor = wl_display_get_fd(m_display); - - m_readNotifier = new QSocketNotifier(m_fileDescriptor, QSocketNotifier::Read, this); - connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(readWaylandEvents())); -} - -wl_display *QWaylandEventThread::display() const -{ - QMutexLocker displayLock(m_displayLock); - return m_display; -} - -} - -QT_END_NAMESPACE diff --git a/src/client/qwaylandeventthread_p.h b/src/client/qwaylandeventthread_p.h deleted file mode 100644 index 0920d403..00000000 --- a/src/client/qwaylandeventthread_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDEVENTTHREAD_H -#define QWAYLANDEVENTTHREAD_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 <QObject> -#include <QMutex> -#include <wayland-client.h> - -#include <QtWaylandClient/private/qwaylandclientexport_p.h> - -QT_BEGIN_NAMESPACE - -class QSocketNotifier; - -namespace QtWaylandClient { - -class Q_WAYLAND_CLIENT_EXPORT QWaylandEventThread : public QObject -{ - Q_OBJECT -public: - explicit QWaylandEventThread(QObject *parent = 0); - ~QWaylandEventThread(); - - void displayConnect(); - - wl_display *display() const; - - void checkError() const; - -private slots: - void readWaylandEvents(); - - void waylandDisplayConnect(); - -signals: - void newEventsRead(); - void fatalError(); - -private: - - struct wl_display *m_display; - int m_fileDescriptor; - - QSocketNotifier *m_readNotifier; - - QMutex *m_displayLock; - -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDEVENTTHREAD_H diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp index 119a1528..6a729509 100644 --- a/src/client/qwaylandinputcontext.cpp +++ b/src/client/qwaylandinputcontext.cpp @@ -74,6 +74,7 @@ static Qt::Key toQtKey(uint32_t sym) return Qt::Key_unknown; } #else + Q_UNUSED(sym) return Qt::Key_unknown; #endif } diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 407d90b9..c04ddb61 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -54,6 +54,7 @@ #include <qpa/qplatformcursor.h> #include <QtGui/QSurfaceFormat> #include <QtGui/QOpenGLContext> +#include <QSocketNotifier> #include <qpa/qplatforminputcontextfactory_p.h> #include <qpa/qplatformaccessibility.h> @@ -212,6 +213,10 @@ void QWaylandIntegration::initialize() QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests())); QObject::connect(dispatcher, SIGNAL(awake()), mDisplay, SLOT(flushRequests())); + + int fd = wl_display_get_fd(mDisplay->wl_display()); + QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay); + QObject::connect(sn, SIGNAL(activated(int)), mDisplay, SLOT(flushRequests())); } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index 050099f8..7df31bbc 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/qwaylandnativeinterface.cpp @@ -40,6 +40,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandwlshellsurface_p.h" #include <QtGui/private/qguiapplication_p.h> #include <QtGui/QScreen> #include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h> @@ -83,6 +84,15 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "surface") { return ((QWaylandWindow *) window->handle())->object(); } + if (lowerCaseResource == "wl_shell_surface") { + QWaylandWindow *w = (QWaylandWindow *) window->handle(); + if (!w) + return NULL; + QWaylandWlShellSurface *s = qobject_cast<QWaylandWlShellSurface *>(w->shellSurface()); + if (!s) + return NULL; + return s->object(); + } if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); diff --git a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri index eb8e450f..c4ccdcc6 100644 --- a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri +++ b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri @@ -7,12 +7,7 @@ contains(QT_CONFIG, no-pkg-config) { LIBS += -lwayland-client } -for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p -} - -LIBS += $$QMAKE_LIBS_EGL -INCLUDEPATH += $$QMAKE_INCDIR_EGL +CONFIG += egl SOURCES += $$PWD/qwaylandbrcmeglintegration.cpp \ $$PWD/qwaylandbrcmglcontext.cpp \ diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp index c9ebb96b..ca4b653a 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp @@ -90,13 +90,13 @@ void QWaylandBrcmEglIntegration::initialize(QWaylandDisplay *waylandDisplay) qWarning("failed to resolve eglFlushBRCM, performance will suffer"); } - eglCreateGlobalImageBRCM = ::eglCreateGlobalImageBRCM; + eglCreateGlobalImageBRCM = (PFNEGLCREATEGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglCreateGlobalImageBRCM"); if (!eglCreateGlobalImageBRCM) { qWarning("failed to resolve eglCreateGlobalImageBRCM"); return; } - eglDestroyGlobalImageBRCM = ::eglDestroyGlobalImageBRCM; + eglDestroyGlobalImageBRCM = (PFNEGLDESTROYGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglDestroyGlobalImageBRCM"); if (!eglDestroyGlobalImageBRCM) { qWarning("failed to resolve eglDestroyGlobalImageBRCM"); return; diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h index 7fe557fb..cc5940f4 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h @@ -40,7 +40,6 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> #include <QtCore/qglobal.h> diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp index 7cead1dc..54e95317 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp @@ -42,7 +42,6 @@ #include <QtGui/QWindow> #include <qpa/qwindowsysteminterface.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> #include <wayland-client.h> 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 dbc8dacf..c3d592a9 100644 --- a/src/hardwareintegration/client/drm-egl-server/drm-egl-server.pri +++ b/src/hardwareintegration/client/drm-egl-server/drm-egl-server.pri @@ -1,12 +1,14 @@ INCLUDEPATH += $$PWD contains(QT_CONFIG, no-pkg-config) { - LIBS += -lEGL -lwayland-client + LIBS += -lwayland-client } else { CONFIG += link_pkgconfig - PKGCONFIG += egl wayland-client + PKGCONFIG += wayland-client } +CONFIG += egl + SOURCES += \ $$PWD/drmeglserverbufferintegration.cpp diff --git a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri index 107a96f9..951d28c5 100644 --- a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri +++ b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri @@ -1,11 +1,13 @@ INCLUDEPATH += $$PWD !contains(QT_CONFIG, no-pkg-config) { CONFIG += link_pkgconfig - PKGCONFIG += wayland-client wayland-egl egl + PKGCONFIG += wayland-client wayland-egl } else { - LIBS += -lwayland-egl -lEGL + LIBS += -lwayland-egl } +CONFIG += egl + SOURCES += $$PWD/qwaylandeglclientbufferintegration.cpp \ $$PWD/qwaylandglcontext.cpp \ $$PWD/qwaylandeglwindow.cpp diff --git a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri index 89ec9840..4435f481 100644 --- a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri +++ b/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri @@ -3,11 +3,13 @@ include($$PWD/../xcomposite_share/xcomposite_share.pri) !contains(QT_CONFIG, no-pkg-config) { CONFIG += link_pkgconfig - PKGCONFIG += wayland-client xcomposite egl x11 + PKGCONFIG += wayland-client xcomposite x11 } else { - LIBS += -lXcomposite -lEGL -lX11 + LIBS += -lXcomposite -lX11 } +CONFIG += egl + SOURCES += \ $$PWD/qwaylandxcompositeeglcontext.cpp \ $$PWD/qwaylandxcompositeeglclientbufferintegration.cpp \ diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp index 79ea1470..7e0288bb 100644 --- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp +++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp @@ -42,7 +42,6 @@ #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> QT_BEGIN_NAMESPACE @@ -59,7 +58,9 @@ BrcmBuffer::BrcmBuffer(struct ::wl_client *client, uint32_t id, const QSize &siz BrcmBuffer::~BrcmBuffer() { - eglDestroyGlobalImageBRCM(handle()); + static PFNEGLDESTROYGLOBALIMAGEBRCMPROC eglDestroyGlobalImage = + (PFNEGLDESTROYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglDestroyGlobalImageBRCM"); + eglDestroyGlobalImage(handle()); } void BrcmBuffer::buffer_destroy_resource(Resource *) diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp index 9e2ae52b..9162a082 100644 --- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp +++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp @@ -52,7 +52,6 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> #include <GLES2/gl2.h> @@ -92,7 +91,7 @@ void BrcmEglIntegration::initializeHardware(QtWayland::Display *waylandDisplay) if (!d->egl_display) qWarning("Failed to acquire EGL display from platform integration"); - d->eglQueryGlobalImageBRCM = eglQueryGlobalImageBRCM; + d->eglQueryGlobalImageBRCM = (PFNEGLQUERYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglQueryGlobalImageBRCM"); if (!d->eglQueryGlobalImageBRCM) { qWarning("Failed to resolve eglQueryGlobalImageBRCM"); 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 cd2e2471..2ed5db68 100644 --- a/src/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri +++ b/src/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri @@ -1,12 +1,14 @@ INCLUDEPATH += $$PWD contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-server -lEGL + LIBS += -lwayland-server } else { CONFIG += link_pkgconfig - PKGCONFIG += wayland-server egl + PKGCONFIG += wayland-server } +CONFIG += egl + 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 84d90135..5cbcb6b7 100644 --- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri +++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri @@ -1,12 +1,14 @@ INCLUDEPATH += $$PWD contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-server -lEGL + LIBS += -lwayland-server } else { CONFIG += link_pkgconfig - PKGCONFIG += wayland-server egl + PKGCONFIG += wayland-server } +CONFIG += egl + 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 2d4771a2..8dacc130 100644 --- a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri +++ b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri @@ -2,11 +2,13 @@ INCLUDEPATH += $$PWD !contains(QT_CONFIG, no-pkg-config) { CONFIG += link_pkgconfig - PKGCONFIG += wayland-server wayland-egl egl + PKGCONFIG += wayland-server wayland-egl } else { - LIBS += -lwayland-egl -lwayland-server -lEGL + LIBS += -lwayland-egl -lwayland-server } +CONFIG += egl + SOURCES += \ $$PWD/waylandeglclientbufferintegration.cpp diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index e28d2f53..9b62d082 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -59,6 +59,10 @@ #define GL_TEXTURE_EXTERNAL_OES 0x8D65 #endif +#ifndef EGL_WAYLAND_BUFFER_WL +#define EGL_WAYLAND_BUFFER_WL 0x31D5 +#endif + /* Needed for compatibility with Mesa older than 10.0. */ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL_compat) (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value); diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri index cde790bd..d748c2b5 100644 --- a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri +++ b/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri @@ -2,11 +2,13 @@ include($$PWD/../xcomposite_share/xcomposite_share.pri) !contains(QT_CONFIG, no-pkg-config) { CONFIG += link_pkgconfig - PKGCONFIG += xcomposite egl x11 wayland-server + PKGCONFIG += xcomposite x11 wayland-server } else { - LIBS += -lXcomposite -lEGL -lX11 + LIBS += -lXcomposite -lX11 } +CONFIG += egl + INCLUDEPATH += $$PWD HEADERS += \ diff --git a/src/plugins/hardwareintegration/client/client.pro b/src/plugins/hardwareintegration/client/client.pro index b7a9b46e..37a90ab0 100644 --- a/src/plugins/hardwareintegration/client/client.pro +++ b/src/plugins/hardwareintegration/client/client.pro @@ -7,7 +7,7 @@ config_brcm_egl: \ SUBDIRS += brcm-egl config_xcomposite { - config_egl: \ + contains(QT_CONFIG, egl): \ SUBDIRS += xcomposite-egl !contains(QT_CONFIG, opengles2):config_glx: \ diff --git a/src/plugins/hardwareintegration/compositor/compositor.pro b/src/plugins/hardwareintegration/compositor/compositor.pro index 215cd257..1ecfe37a 100644 --- a/src/plugins/hardwareintegration/compositor/compositor.pro +++ b/src/plugins/hardwareintegration/compositor/compositor.pro @@ -6,7 +6,7 @@ config_brcm_egl: \ SUBDIRS += brcm-egl config_xcomposite { - config_egl: \ + contains(QT_CONFIG, egl): \ SUBDIRS += xcomposite-egl !contains(QT_CONFIG, opengles2):config_glx: \ diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 0665511c..43c02be0 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -13,7 +13,7 @@ contains(CONFIG, wayland-compositor) { SUBDIRS += qwayland-brcm-egl config_xcomposite { - config_egl: \ + contains(QT_CONFIG, egl): \ SUBDIRS += qwayland-xcomposite-egl !contains(QT_CONFIG, opengles2):config_glx: \ SUBDIRS += qwayland-xcomposite-glx diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index a3c4870d..9041fff9 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -13,3 +13,6 @@ include("${_Qt5CTestMacros}") test_module_includes( Compositor QWaylandBufferRef ) + +# Can't test in `test_module_includes`, WaylandClient has no public headers +expect_pass(test_waylandclient) diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt new file mode 100644 index 00000000..3788a492 --- /dev/null +++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt @@ -0,0 +1,12 @@ +project(test_plugins) + +cmake_minimum_required(VERSION 2.8) +cmake_policy(SET CMP0056 NEW) + +find_package(Qt5WaylandClient REQUIRED) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + +include_directories(${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}) +add_executable(test_waylandclient_exe main.cpp) +target_link_libraries(test_waylandclient_exe Qt5::WaylandClient) diff --git a/tests/auto/cmake/test_waylandclient/main.cpp b/tests/auto/cmake/test_waylandclient/main.cpp new file mode 100644 index 00000000..f0ccdef4 --- /dev/null +++ b/tests/auto/cmake/test_waylandclient/main.cpp @@ -0,0 +1,7 @@ +#include <private/qwaylandcursor_p.h> + +int main() +{ + // use symbol + QtWaylandClient::QWaylandCursor cursor(Q_NULLPTR); +} |