summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-09-03 23:16:27 +0300
committerGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-09-04 09:55:04 +0200
commit1e052dd2de91506f71443e50bf225756d5ad69b1 (patch)
treec0130818c7d5f2ae688c97acef39a2750340e175
parenta6a288ecce01082de69ec17a0493c859a8e6fde6 (diff)
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>
-rw-r--r--src/client/qwaylanddisplay.cpp12
-rw-r--r--src/client/qwaylanddisplay_p.h4
-rw-r--r--src/client/qwaylandintegration.cpp3
-rw-r--r--src/client/qwaylandscreen.cpp1
-rw-r--r--src/client/qwaylandscreen_p.h2
5 files changed, 18 insertions, 4 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 595d2ce77..a037bb962 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 6ed30d195..64c020546 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 3b6d4acf9..224466cc4 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 19c3e5d46..2cc719776 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 5d06227a5..90b8fc903 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;