diff options
author | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-09-03 23:16:27 +0300 |
---|---|---|
committer | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-09-04 09:55:04 +0200 |
commit | 1e052dd2de91506f71443e50bf225756d5ad69b1 (patch) | |
tree | c0130818c7d5f2ae688c97acef39a2750340e175 /src | |
parent | a6a288ecce01082de69ec17a0493c859a8e6fde6 (diff) | |
download | qtwayland-1e052dd2de91506f71443e50bf225756d5ad69b1.tar.gz |
Destroy the QScreen when its wl_output is removed
Change-Id: I4532d05cca44c88fe38c14eacbe90c190f272b2c
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 12 | ||||
-rw-r--r-- | src/client/qwaylanddisplay_p.h | 4 | ||||
-rw-r--r-- | src/client/qwaylandintegration.cpp | 3 | ||||
-rw-r--r-- | src/client/qwaylandscreen.cpp | 1 | ||||
-rw-r--r-- | src/client/qwaylandscreen_p.h | 2 |
5 files changed, 18 insertions, 4 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 595d2ce7..a037bb96 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -262,7 +262,17 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin void QWaylandDisplay::registry_global_remove(uint32_t id) { for (int i = 0, ie = mGlobals.count(); i != ie; ++i) { - if (mGlobals[i].id == id) { + RegistryGlobal &global = mGlobals[i]; + if (global.id == id) { + if (global.interface == QStringLiteral("wl_output")) { + foreach (QWaylandScreen *screen, mScreens) { + if (screen->outputId() == id) { + delete screen; + mScreens.removeOne(screen); + break; + } + } + } mGlobals.removeAt(i); break; } diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 6ed30d19..64c02054 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -97,7 +97,7 @@ public: QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void); - QList<QPlatformScreen *> screens() const { return mScreens; } + QList<QWaylandScreen *> screens() const { return mScreens; } QWaylandScreen *screenForOutput(struct wl_output *output) const; @@ -176,7 +176,7 @@ private: QWaylandEventThread *mEventThreadObject; QScopedPointer<QtWayland::wl_shell> mShell; QScopedPointer<QWaylandXdgShell> mShellXdg; - QList<QPlatformScreen *> mScreens; + QList<QWaylandScreen *> mScreens; QList<QWaylandInputDevice *> mInputDevices; QList<Listener> mRegistryListeners; QWaylandIntegration *mWaylandIntegration; diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 3b6d4acf..224466cc 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -49,6 +49,7 @@ #include "qwaylandclipboard_p.h" #include "qwaylanddnd_p.h" #include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandscreen_p.h" #include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> @@ -127,7 +128,7 @@ QWaylandIntegration::QWaylandIntegration() mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); - foreach (QPlatformScreen *screen, mDisplay->screens()) + foreach (QWaylandScreen *screen, mDisplay->screens()) screenAdded(screen); mInputContext.reset(new QWaylandInputContext(mDisplay)); diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp index 19c3e5d4..2cc71977 100644 --- a/src/client/qwaylandscreen.cpp +++ b/src/client/qwaylandscreen.cpp @@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) : QPlatformScreen() , QtWayland::wl_output(waylandDisplay->wl_registry(), id, 2) + , m_outputId(id) , mWaylandDisplay(waylandDisplay) , mExtendedOutput(0) , mDepth(32) diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h index 5d06227a..90b8fc90 100644 --- a/src/client/qwaylandscreen_p.h +++ b/src/client/qwaylandscreen_p.h @@ -77,6 +77,7 @@ public: QPlatformCursor *cursor() const; QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; + uint32_t outputId() const { return m_outputId; } ::wl_output *output() { return object(); } QWaylandExtendedOutput *extendedOutput() const; @@ -93,6 +94,7 @@ private: const QString &model, int32_t transform) Q_DECL_OVERRIDE; + int m_outputId; QWaylandDisplay *mWaylandDisplay; QWaylandExtendedOutput *mExtendedOutput; QRect mGeometry; |