diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro index 39dcf570dec..6dbe53732ed 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/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/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro index 3c069b7dd94..827228d2bdd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/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/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro index 6af6d5c10da..55f98415d58 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/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/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 6fff45014a7..e1a891d12ae 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/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/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index e89cde997fe..4549d52e6a6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -198,7 +198,6 @@ private: QSocketNotifier *mReadNotifier; int mFd; int mWritableNotificationFd; - bool mScreensInitialized; QList mGlobals; int mCompositorVersion; uint32_t mLastInputSerial; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index af5b6f22434..2fb7ff9af1d 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -35,6 +35,7 @@ #define QWAYLANDSHELLSURFACE_H #include +#include #include @@ -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/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index c0004d0ea8d..f009e08116b 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/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/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d6e2b86c556..a775080a37b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/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(mShellSurface); + QWaylandWlShellSurface *wlshellSurface = qobject_cast(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(mShellSurface); + QWaylandXdgSurface *xdgSurface = qobject_cast(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/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 88037d9ccb2..47d4467cef9 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/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/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index ffbe41a4458..1a53a772d13 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/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();