From 1c72063150ce9a805f13970b7a87694809d7165a Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 9 Jan 2014 22:09:59 +0100 Subject: [PATCH 01/12] Destroy the input wayland objects They are not automatically destroyed by the compositor when the seat loses them. Change-Id: I72d45d664948afb4b39f137c91870f21d26dcb4a Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c03647e5463..a979baff3f5 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -112,6 +112,7 @@ public: if (mXkbContext) xkb_context_unref(mXkbContext); #endif + wl_keyboard_destroy(object()); } void keyboard_keymap(uint32_t format, @@ -161,6 +162,7 @@ public: } ~Pointer() { + wl_pointer_destroy(object()); } void pointer_enter(uint32_t serial, struct wl_surface *surface, @@ -193,6 +195,7 @@ public: } ~Touch() { + wl_touch_destroy(object()); } void touch_down(uint32_t serial, From 003db66339b91ab998ed910c0c95ac25d260e2d6 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 10 Jan 2014 11:34:20 +0200 Subject: [PATCH 02/12] Make the glx backend compile again Still needs some renaming and verification, but this makes it compile at least Change-Id: Ifb7fc68e8705f235bf0edf2ae9bb38274b693d3c Reviewed-by: Laszlo Agocs --- .../plugins/hardwareintegration/xcomposite-glx/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 4beb7e6e3cb..751ff3189ab 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include -#include "qwaylandxcompositeglxclientbufferintegration.h" +#include +#include "qwaylandxcompositeglxintegration.h" QT_BEGIN_NAMESPACE @@ -64,7 +64,7 @@ QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlu { Q_UNUSED(paramList); if (system.toLower() == "xcomposite-glx") - return new QWaylandXCompositeGLXClientBufferIntegration(); + return new QWaylandXCompositeGLXIntegration(); return 0; } From 67f9cef815e7945e6bbbbfbae0e9348f5a908ad0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 11:51:05 +0100 Subject: [PATCH 03/12] Fix build without xkbcommon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If6f0c5e14cea659a42dc0ba10c05356a5703ba14 Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandinputdevice.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index a979baff3f5..46054128d5a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -736,17 +736,20 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, { Q_UNUSED(serial); QWaylandWindow *window = mFocus; + uint32_t code = key + 8; + bool isDown = state != 0; + QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; + QString text; + int qtkey = key + 8; // qt-compositor substracts 8 for some reason + #ifndef QT_NO_WAYLAND_XKB if (!mXkbMap) return; - uint32_t code = key + 8; - bool isDown = state != 0; const xkb_keysym_t *syms; uint32_t numSyms = xkb_key_get_syms(mXkbState, code, &syms); xkb_state_update_key(mXkbState, code, isDown ? XKB_KEY_DOWN : XKB_KEY_UP); - QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; if (!window) { // We destroyed the keyboard focus surface, but the server @@ -754,9 +757,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, return; } - int qtkey = key + 8; // qt-compositor substracts 8 for some reason - QString text; - if (numSyms == 1) { xkb_keysym_t sym = syms[0]; Qt::KeyboardModifiers modifiers = mParent->modifiers(); From 60fd8b1612d9261898c13dada04d38bb11c10136 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 14 Jan 2014 12:26:42 +0100 Subject: [PATCH 04/12] Fixup the brcm-egl hardware integrations Change-Id: I2a25c7d0b5019c30f31cba1f608a8731be6b1f10 Reviewed-by: Laszlo Agocs --- .../wayland/plugins/hardwareintegration/brcm-egl/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index b7f376555cf..d1bef5e8caf 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include -#include "qwaylandbrcmeglclientbufferintegration.h" +#include +#include "qwaylandbrcmeglintegration.h" QT_BEGIN_NAMESPACE @@ -60,11 +60,11 @@ QStringList QWaylandBrcmEglClientBufferPlugin::keys() const return list; } -QWaylandEglClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); if (system.toLower() == "brcm") - return new QWaylandBrcmEglClientBufferIntegration(); + return new QWaylandBrcmEglIntegration(); return 0; } From 3a2ece17c3ddcfba584cfdf90482a260d7e9c3ee Mon Sep 17 00:00:00 2001 From: Tomasz Olszak Date: Tue, 14 Jan 2014 21:29:08 +0100 Subject: [PATCH 05/12] Don't flushWindowSystemEvents in QWaylandWindow ctor. tests/auto/gui/kernel/qbackingstore test crashed because the flush in QWaylandWindow::setWindowState invoked backing store expose event handling which in turn tried to use related (not yet created) QWaylandWindow. Change-Id: Ic9f29cc3433e6e671deb756aebe26530ebc72042 Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandwindow.cpp | 58 ++++++++++--------- .../platforms/wayland/qwaylandwindow_p.h | 2 + 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 810239a7b7a..3c7b2eac165 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -119,7 +119,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) setWindowFlags(window->flags()); setGeometry(window->geometry()); - setWindowState(window->windowState()); + setWindowStateInternal(window->windowState()); } QWaylandWindow::~QWaylandWindow() @@ -409,31 +409,8 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient void QWaylandWindow::setWindowState(Qt::WindowState state) { - if (mState == state) { - return; - } - - // As of february 2013 QWindow::setWindowState sets the new state value after - // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState - // here. We use then this mState variable. - mState = state; - createDecoration(); - switch (state) { - case Qt::WindowFullScreen: - mShellSurface->setFullscreen(); - break; - case Qt::WindowMaximized: - mShellSurface->setMaximized(); - break; - case Qt::WindowMinimized: - mShellSurface->setMinimized(); - break; - default: - mShellSurface->setNormal(); - } - - QWindowSystemInterface::handleWindowStateChanged(window(), mState); - QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged + if (setWindowStateInternal(state)) + QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged } void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) @@ -605,4 +582,33 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab) return true; } +bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) +{ + if (mState == state) { + return false; + } + + // As of february 2013 QWindow::setWindowState sets the new state value after + // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState + // here. We use then this mState variable. + mState = state; + createDecoration(); + switch (state) { + case Qt::WindowFullScreen: + mShellSurface->setFullscreen(); + break; + case Qt::WindowMaximized: + mShellSurface->setMaximized(); + break; + case Qt::WindowMinimized: + mShellSurface->setMinimized(); + break; + default: + mShellSurface->setNormal(); + } + + QWindowSystemInterface::handleWindowStateChanged(window(), mState); + return true; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6078dab7f6e..e99e31bdf63 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -204,6 +204,8 @@ protected: Qt::WindowState mState; private: + bool setWindowStateInternal(Qt::WindowState flags); + void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF & local, From cb09f9a7faddbc70dad0dbcd168c6f771d238cf8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 14:18:50 +0100 Subject: [PATCH 06/12] Send the globals to new listeners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8d2a74cdc305fb086f3b5c63d0abe4c46c40bbde Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylanddisplay.cpp | 28 ++++++++++++++----- .../platforms/wayland/qwaylanddisplay_p.h | 12 +++++++- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ec439b5d2cf..0b715c0ae2c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -175,12 +175,6 @@ QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const return 0; } -void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) -{ - Listener l = { listener, data }; - mRegistryListeners.append(l); -} - void QWaylandDisplay::waitForScreens() { flushRequests(); @@ -234,13 +228,33 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_text_input_manager")) { mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id)); } else if (interface == QStringLiteral("qt_hardware_integration")) { - mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); + mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); } + mGlobals.append(RegistryGlobal(id, interface, version, registry)); + foreach (Listener l, mRegistryListeners) (*l.listener)(l.data, registry, id, interface, version); } +void QWaylandDisplay::registry_global_remove(uint32_t id) +{ + for (int i = 0, ie = mGlobals.count(); i != ie; ++i) { + if (mGlobals[i].id == id) { + mGlobals.removeAt(i); + break; + } + } +} + +void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) +{ + Listener l = { listener, data }; + mRegistryListeners.append(l); + for (int i = 0, ie = mGlobals.count(); i != ie; ++i) + (*l.listener)(l.data, mGlobals[i].registry, mGlobals[i].id, mGlobals[i].interface, mGlobals[i].version); +} + uint32_t QWaylandDisplay::currentTimeMillisec() { //### we throw away the time information diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 5ba4f51beab..40cb2b2c5f9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -130,6 +130,15 @@ public: QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } + struct RegistryGlobal { + uint32_t id; + QString interface; + uint32_t version; + struct ::wl_registry *registry; + RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_) + : id(id_), interface(interface_), version(version_), registry(registry_) { } + }; + /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ void addRegistryListener(RegistryListener listener, void *data); @@ -173,13 +182,14 @@ private: QScopedPointer mWindowManagerIntegration; QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; - QSocketNotifier *mReadNotifier; int mFd; int mWritableNotificationFd; bool mScreensInitialized; + QList mGlobals; void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; + void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; static void shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, From 30cd553ea616ab097217d6c499e754f5d126d6f8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 14:40:37 +0100 Subject: [PATCH 07/12] Fix brcm keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Did not match the key used in the plugin metadata. Change-Id: I58cf08c684b33d8d7166a074dbafb4187b010498 Reviewed-by: Jørgen Lind --- .../wayland/plugins/hardwareintegration/brcm-egl/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index d1bef5e8caf..2cf144e71cc 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -56,14 +56,14 @@ public: QStringList QWaylandBrcmEglClientBufferPlugin::keys() const { QStringList list; - list << "brcm"; + list << "wayland-brcm"; return list; } QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "brcm") + if (system.toLower() == "wayland-brcm") return new QWaylandBrcmEglIntegration(); return 0; From 8738267dbcda8fa924d0672415d995b2aa1e3b84 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 13:31:26 +0100 Subject: [PATCH 08/12] Fix some typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5c734561c0c13192acd9ffd590eb2e8eeb3ca4e1 Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 2e36a16da79..b354ac0706e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -285,7 +285,7 @@ void QWaylandIntegration::initializeClientBufferIntegration() if (mClientBufferIntegration) mClientBufferIntegration->initialize(mDisplay); else - qWarning("Failed to load client buffer intgration: %s\n", qPrintable(targetKey)); + qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey)); } void QWaylandIntegration::initializeServerBufferIntegration() @@ -304,7 +304,7 @@ void QWaylandIntegration::initializeServerBufferIntegration() } if (targetKey.isEmpty()) { - qWarning("Failed to determin what server buffer integration to use"); + qWarning("Failed to determine what server buffer integration to use"); return; } From e8df7316cde91c2916509bd71012aca18a1ae72e Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 9 Jan 2014 16:22:33 +0100 Subject: [PATCH 09/12] Fixup the iid versions for the plugins Change-Id: Iac1b8b070d3bf87b29d0be9a2a76fd56e7046f0f Reviewed-by: Laszlo Agocs --- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../wayland/plugins/hardwareintegration/brcm-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/drm-egl-server/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/wayland-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 476e31a781a..18cc7beb67d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWaylandClientBufferIntegration; -#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" +#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject { diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 39d9a8ba6f4..d893da2abdd 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWaylandServerBufferIntegration; -#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" +#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.2" class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject { diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index 2cf144e71cc..4c8846d9c25 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "brcm-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "brcm-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 460ccb7a10a..bc530a4c980 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" FILE "drm-egl-server.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.2" FILE "drm-egl-server.json") public: QStringList keys() const; QWaylandServerBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 44ce6019d86..72cb555f874 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "wayland-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "wayland-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 7c6135ccc58..f6995319e45 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "xcomposite-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 751ff3189ab..4269a9c263c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-glx.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "xcomposite-glx.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); From 5f52b6b5082e4845b54ea530aaa3505b25ccad60 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 21 Jan 2014 17:07:32 +0200 Subject: [PATCH 10/12] Allow resizing the Qt window after the buffers swap Some EGL implementations resize the EGL buffers after eglSwapBuffers, so we need to send the geometry change event after the swap, or else the Qt window size and the physical buffer size will be different to each other. Do not force this behavior though, but use it only when the QT_WAYLAND_RESIZE_AFTER_SWAP environment variable is set. Change-Id: I79e39442b3010c563a81d7c94e747a982e158fc1 Reviewed-by: Gunnar Sletta --- .../platforms/wayland/qwaylandwindow.cpp | 24 +++++++++++++------ .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3c7b2eac165..67f122fb4a6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -80,6 +80,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mFrameCallback(0) , mRequestResizeSent(false) , mCanResize(true) + , mResizeDirty(false) + , mResizeAfterSwap(!qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) , mSentInitialResize(false) , mMouseDevice(0) , mMouseSerial(0) @@ -195,10 +197,11 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (mWindowDecoration && window()->isVisible()) mWindowDecoration->update(); - if (mConfigure.isEmpty()) { + if (mResizeAfterSwap) + mResizeDirty = true; + else QWindowSystemInterface::handleGeometryChange(window(), geometry()); - QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); - } + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); } void QWaylandWindow::setVisible(bool visible) @@ -287,7 +290,6 @@ void QWaylandWindow::doResize() setGeometry(geometry); mConfigure.clear(); - QWindowSystemInterface::handleGeometryChange(window(), geometry); } void QWaylandWindow::setCanResize(bool canResize) @@ -295,9 +297,17 @@ void QWaylandWindow::setCanResize(bool canResize) QMutexLocker lock(&mResizeLock); mCanResize = canResize; - if (canResize && !mConfigure.isEmpty()) { - doResize(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + if (canResize) { + if (mResizeDirty) { + QWindowSystemInterface::handleGeometryChange(window(), geometry()); + } + if (!mConfigure.isEmpty()) { + doResize(); + QWindowSystemInterface::handleExposeEvent(window(), geometry()); + } else if (mResizeDirty) { + QWindowSystemInterface::handleExposeEvent(window(), geometry()); + mResizeDirty = false; + } } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e99e31bdf63..fe6f319087b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -193,6 +193,8 @@ protected: QWaylandWindowConfigure mConfigure; bool mRequestResizeSent; bool mCanResize; + bool mResizeDirty; + bool mResizeAfterSwap; bool mSentInitialResize; QPoint mOffset; From 43aaab280862bf73ef05ad419b260511798c47f5 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 3 Feb 2014 14:31:14 +0100 Subject: [PATCH 11/12] init mTouchDevice to null Since QWaylandInputDevice::seat_capabilities checks the pointer before creating this object, it must be initially null so that the device will be registered. Change-Id: Ia15b407b1636eab41c04f30bb631306095e5aefb Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 46054128d5a..08e2945741b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -232,6 +232,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) , mTouch(0) , mTime(0) , mSerial(0) + , mTouchDevice(0) { if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); From 70c578cb5ec2964a75069ed6ca1353627e8cbe55 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 4 Feb 2014 11:28:31 +0200 Subject: [PATCH 12/12] Fix the client behavior when showing or hiding a surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce the chances of seeing a bad frame. Change-Id: Idac3450d92210fc5fc33cb68862b089964c9a8ce Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 67f122fb4a6..920c97780e7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -207,9 +207,6 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (mBuffer) - attach(mBuffer->buffer(), 0, 0); - if (window()->type() == Qt::Popup && transientParent()) { QWaylandWindow *parent = transientParent(); mMouseDevice = parent->mMouseDevice; @@ -230,10 +227,10 @@ void QWaylandWindow::setVisible(bool visible) // QWaylandShmBackingStore::beginPaint(). } else { QWindowSystemInterface::handleExposeEvent(window(), QRegion()); + QWindowSystemInterface::flushWindowSystemEvents(); attach(static_cast(0), 0, 0); + commit(); } - damage(QRect(QPoint(0,0),geometry().size())); - commit(); }