diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-15 09:19:39 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-15 09:33:45 +0200 |
commit | d7b198605de9979b7875c2da20dea5e4657deb17 (patch) | |
tree | 7374f5b42572027f09c54e08b32ee3aac0bed4b8 | |
parent | e4a4a6dd7503f069efbae81c0587f6d8fe3cee99 (diff) | |
parent | d5e7965a87d81e2d7157c785403b0aba681de62a (diff) | |
download | qtwayland-d7b198605de9979b7875c2da20dea5e4657deb17.tar.gz qtwayland-d7b198605de9979b7875c2da20dea5e4657deb17.tar.bz2 qtwayland-d7b198605de9979b7875c2da20dea5e4657deb17.zip |
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
src/client/qwaylandshmbackingstore.cpp
src/client/qwaylandwindow.cpp
Change-Id: I795fd08f0fc5d3cb5ed55bf16e724f66b7567723
21 files changed, 54 insertions, 52 deletions
diff --git a/examples/wayland/qml-compositor/main.cpp b/examples/wayland/qml-compositor/main.cpp index b857f6bb..ab858998 100644 --- a/examples/wayland/qml-compositor/main.cpp +++ b/examples/wayland/qml-compositor/main.cpp @@ -87,7 +87,6 @@ public: signals: void windowAdded(QVariant window); - void windowDestroyed(QVariant window); void windowResized(QVariant window); void fullscreenSurfaceChanged(); @@ -112,14 +111,12 @@ private slots: QWaylandQuickSurface *surface = qobject_cast<QWaylandQuickSurface *>(sender()); if (surface == m_fullscreenSurface) m_fullscreenSurface = 0; - emit windowDestroyed(QVariant::fromValue(surface)); } - void surfaceDestroyed(QObject *object) { - QWaylandQuickSurface *surface = static_cast<QWaylandQuickSurface *>(object); + void surfaceDestroyed() { + QWaylandQuickSurface *surface = static_cast<QWaylandQuickSurface *>(sender()); if (surface == m_fullscreenSurface) m_fullscreenSurface = 0; - emit windowDestroyed(QVariant::fromValue(surface)); } void sendCallbacks() { @@ -137,7 +134,7 @@ protected: } void surfaceCreated(QWaylandSurface *surface) { - connect(surface, SIGNAL(destroyed(QObject *)), this, SLOT(surfaceDestroyed(QObject *))); + connect(surface, SIGNAL(surfaceDestroyed()), this, SLOT(surfaceDestroyed())); connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped())); connect(surface,SIGNAL(unmapped()), this,SLOT(surfaceUnmapped())); } diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp index 31751e05..0b39f110 100644 --- a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp +++ b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp @@ -90,6 +90,7 @@ public: if (bufferRef) { if (bufferRef.isShm()) { shmTex = new QOpenGLTexture(bufferRef.image(), QOpenGLTexture::DontGenerateMipMaps); + shmTex->setWrapMode(QOpenGLTexture::ClampToEdge); texture = shmTex->textureId(); } else { texture = bufferRef.createTexture(); diff --git a/examples/wayland/server-buffer/compositor/main.cpp b/examples/wayland/server-buffer/compositor/main.cpp index e0eb0ad2..312cff2c 100644 --- a/examples/wayland/server-buffer/compositor/main.cpp +++ b/examples/wayland/server-buffer/compositor/main.cpp @@ -100,7 +100,6 @@ public: signals: void windowAdded(QVariant window); - void windowDestroyed(QVariant window); void windowResized(QVariant window); void serverBufferItemCreated(QVariant); void serverBuffersCreated(); @@ -118,16 +117,6 @@ private slots: emit windowAdded(QVariant::fromValue(surface)); } - void surfaceUnmapped() { - QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender()); - emit windowDestroyed(QVariant::fromValue(surface)); - } - - void surfaceDestroyed(QObject *object) { - QWaylandSurface *surface = static_cast<QWaylandSurface *>(object); - emit windowDestroyed(QVariant::fromValue(surface)); - } - void sendCallbacks() { sendFrameCallbacks(surfaces()); } @@ -216,7 +205,6 @@ protected: void surfaceCreated(QWaylandSurface *surface) { connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped())); - connect(surface,SIGNAL(unmapped()), this,SLOT(surfaceUnmapped())); } void share_buffer_bind_resource(Resource *resource) Q_DECL_OVERRIDE diff --git a/src/client/qwaylandbuffer_p.h b/src/client/qwaylandbuffer_p.h index 6fff4501..e1a891d1 100644 --- a/src/client/qwaylandbuffer_p.h +++ b/src/client/qwaylandbuffer_p.h @@ -48,7 +48,10 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer { public: - QWaylandBuffer() { } + QWaylandBuffer() + : mBuffer(0) + { + } virtual ~QWaylandBuffer() { } wl_buffer *buffer() {return mBuffer;} virtual QSize size() const = 0; diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index e89cde99..4549d52e 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -198,7 +198,6 @@ private: QSocketNotifier *mReadNotifier; int mFd; int mWritableNotificationFd; - bool mScreensInitialized; QList<RegistryGlobal> mGlobals; int mCompositorVersion; uint32_t mLastInputSerial; diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index af5b6f22..2fb7ff9a 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -35,6 +35,7 @@ #define QWAYLANDSHELLSURFACE_H #include <QtCore/QSize> +#include <QObject> #include <wayland-client.h> @@ -51,8 +52,9 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandInputDevice; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject { + Q_OBJECT public: explicit QWaylandShellSurface(QWaylandWindow *window); virtual ~QWaylandShellSurface() {} diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp index c0004d0e..f009e081 100644 --- a/src/client/qwaylandshmbackingstore.cpp +++ b/src/client/qwaylandshmbackingstore.cpp @@ -55,7 +55,8 @@ namespace QtWaylandClient { QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) - : mMarginsImage(0) + : mShmPool(0) + , mMarginsImage(0) { int stride = size.width() * 4; int alloc = stride * size.height(); @@ -97,9 +98,12 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, QWaylandShmBuffer::~QWaylandShmBuffer(void) { delete mMarginsImage; - munmap((void *) mImage.constBits(), mImage.byteCount()); - wl_buffer_destroy(mBuffer); - wl_shm_pool_destroy(mShmPool); + if (mImage.constBits()) + munmap((void *) mImage.constBits(), mImage.byteCount()); + if (mBuffer) + wl_buffer_destroy(mBuffer); + if (mShmPool) + wl_shm_pool_destroy(mShmPool); } QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index d6e2b86c..a775080a 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -102,10 +102,24 @@ QWaylandWindow::QWaylandWindow(QWindow *window) // Set initial surface title mShellSurface->setTitle(window->title()); - // Set surface class to the .desktop file name (obtained from executable name) - QFileInfo exeFileInfo(qApp->applicationFilePath()); - QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); - mShellSurface->setAppId(className); + // 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), + // use the application domain if available, otherwise the executable base name. + // According to xdg-shell the appId is only the name, without the .desktop suffix. + QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + + if (domainName.isEmpty()) { + mShellSurface->setAppId(fi.baseName()); + } else { + QString appId; + for (int i = 0; i < domainName.count(); ++i) + appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + appId.append(fi.baseName()); + mShellSurface->setAppId(appId); + } } if (QPlatformWindow::parent() && mSubSurfaceWindow) { @@ -234,7 +248,7 @@ void QWaylandWindow::setVisible(bool visible) parent = mDisplay->lastInputWindow(); } if (parent) { - QWaylandWlShellSurface *wlshellSurface = dynamic_cast<QWaylandWlShellSurface*>(mShellSurface); + QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface); if (wlshellSurface) wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); } @@ -500,7 +514,7 @@ bool QWaylandWindow::createDecoration() { // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere if (mState == Qt::WindowMinimized) { - QWaylandXdgSurface *xdgSurface = dynamic_cast<QWaylandXdgSurface *>(mShellSurface); + QWaylandXdgSurface *xdgSurface = qobject_cast<QWaylandXdgSurface *>(mShellSurface); if ( xdgSurface ) { if (xdgSurface->isFullscreen()) { setWindowStateInternal(Qt::WindowFullScreen); @@ -639,7 +653,8 @@ bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { - if (mWindowDecoration->handleMouse(inputDevice, e.local, e.global, e.buttons, e.modifiers)) { + if (mMousePressedInContentArea == Qt::NoButton && + mWindowDecoration->handleMouse(inputDevice, e.local, e.global, e.buttons, e.modifiers)) { if (mMouseEventsInContentArea) QWindowSystemInterface::handleLeaveEvent(window()); return; diff --git a/src/client/qwaylandwlshellsurface_p.h b/src/client/qwaylandwlshellsurface_p.h index 88037d9c..47d4467c 100644 --- a/src/client/qwaylandwlshellsurface_p.h +++ b/src/client/qwaylandwlshellsurface_p.h @@ -52,9 +52,10 @@ class QWaylandWindow; class QWaylandInputDevice; class QWaylandExtendedSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QtWayland::wl_shell_surface - , public QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface + , public QtWayland::wl_shell_surface { + Q_OBJECT public: QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); virtual ~QWaylandWlShellSurface(); diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h index ffbe41a4..1a53a772 100644 --- a/src/client/qwaylandxdgsurface_p.h +++ b/src/client/qwaylandxdgsurface_p.h @@ -53,9 +53,10 @@ class QWaylandWindow; class QWaylandInputDevice; class QWaylandExtendedSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QtWayland::xdg_surface - , public QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface + , public QtWayland::xdg_surface { + Q_OBJECT public: QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window); virtual ~QWaylandXdgSurface(); diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 041f3e9e..0d5d84eb 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -105,7 +105,7 @@ void QWaylandCompositor::sendFrameCallbacks(QList<QWaylandSurface *> visibleSurf void QWaylandCompositor::frameStarted() { - for (QtWayland::Surface *surf: m_compositor->surfaces()) + foreach (QtWayland::Surface *surf, m_compositor->surfaces()) surf->frameStarted(); } diff --git a/src/compositor/compositor_api/qwaylandsurfaceview.cpp b/src/compositor/compositor_api/qwaylandsurfaceview.cpp index 57e3501f..1d4ba304 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceview.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceview.cpp @@ -61,7 +61,7 @@ QWaylandSurfaceView::~QWaylandSurfaceView() if (d->surface) { QWaylandInputDevice *i = d->surface->compositor()->defaultInputDevice(); if (i->mouseFocus() == this) - i->setMouseFocus(nullptr, QPointF()); + i->setMouseFocus(Q_NULLPTR, QPointF()); d->surface->destroy(); d->surface->d_func()->views.removeOne(this); diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp index 42c6a56e..beb11d09 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp @@ -106,6 +106,7 @@ ShellSurface::ShellSurface(Shell *shell, wl_client *client, uint32_t id, Surface ShellSurface::~ShellSurface() { + delete m_view; } void ShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height) diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h index 0dd3e412..7fe557fb 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h @@ -35,6 +35,7 @@ #define QWAYLANDBRCMEGLINTEGRATION_H #include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h> +#include <wayland-client.h> #include <EGL/egl.h> #include <EGL/eglext.h> diff --git a/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri b/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri index 72645ace..83c7b621 100644 --- a/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri +++ b/src/hardwareintegration/compositor/brcm-egl/brcm-egl.pri @@ -1,10 +1,9 @@ -PLUGIN_TYPE = waylandcompositors -load(qt_plugin) - QT = compositor compositor-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 diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h index 988db84a..d44a1cd3 100644 --- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h +++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h @@ -64,7 +64,7 @@ public: QSize size() { return m_size; } - static BrcmBuffer *fromResource(struct ::wl_resource *resource) { return static_cast<BrcmBuffer*>(Resource::fromResource(resource)->buffer); } + static BrcmBuffer *fromResource(struct ::wl_resource *resource) { return static_cast<BrcmBuffer*>(Resource::fromResource(resource)->buffer_object); } protected: void buffer_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; diff --git a/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro index 39dcf570..6dbe5373 100644 --- a/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro +++ b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro @@ -5,8 +5,6 @@ QT += waylandclient-private include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) -LIBS += -lEGL - OTHER_FILES += \ brcm-egl.json diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro b/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro index 3c069b7d..827228d2 100644 --- a/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro @@ -8,8 +8,6 @@ QT += waylandclient-private include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) -LIBS += -lEGL - OTHER_FILES += \ drm-egl-server.json diff --git a/src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro index 6af6d5c1..55f98415 100644 --- a/src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro +++ b/src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro @@ -5,8 +5,6 @@ QT += waylandclient-private include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri) -LIBS += -lEGL - OTHER_FILES += \ libhybris-egl-server.json diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro index 1608004f..f47898a4 100644 --- a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro +++ b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro @@ -5,8 +5,6 @@ QT = compositor compositor-private core-private gui-private OTHER_FILES += brcm-egl.json -LIBS += -lEGL - SOURCES += \ main.cpp diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro b/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro index 31bc718f..1e28043a 100644 --- a/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro +++ b/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro @@ -5,8 +5,6 @@ QT += waylandclient-private include(../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) -LIBS += -lEGL - OTHER_FILES += \ qwayland-brcm-egl.json |