summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-05-29 15:44:12 +0200
committerMarco Martin <notmart@gmail.com>2017-06-09 15:11:07 +0000
commita7d7bb54ad30d10370d80dc91adbc329d5a350fa (patch)
tree3501b19a98085cd35cf167f7df7b0fcb999a416e /src/client/qwaylandwindow.cpp
parente6c944939f88afe852d2d0a604fd9815c409f2eb (diff)
Send SurfaceCreated and SurfaceAboutToBeDestroyed events for wl_surface
Previously, the events were matching the life cycle of QWaylandWindow. This commit changes it so the events are matching the life cycle of wl_surfaces instead (a QWaylandWindow can outlive several wl_surfaces). Some of these events were already sent in QWindowPrivate (the first and last). Now we handle the cases where the wl_surface is destroyed and recreated due to hiding/showing the window or when changing the role of the wl_surface. Task-number: QTBUG-58423 Change-Id: Ie4a4e7dd529e1a41a2cf42e02cebb3c8aca4a4cc Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Marco Martin <notmart@gmail.com>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r--src/client/qwaylandwindow.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 9b994508..5bfa158a 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -110,7 +110,7 @@ QWaylandWindow::~QWaylandWindow()
delete mWindowDecoration;
if (isInitialized())
- reset();
+ reset(false);
QList<QWaylandInputDevice *> inputDevices = mDisplay->inputDevices();
for (int i = 0; i < inputDevices.size(); ++i)
@@ -132,8 +132,11 @@ void QWaylandWindow::initWindow()
if (window()->type() == Qt::Desktop)
return;
- if (!isInitialized())
+ if (!isInitialized()) {
initializeWlSurface();
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);
+ QGuiApplication::sendEvent(window(), &e);
+ }
if (shouldCreateSubSurface()) {
Q_ASSERT(!mSubSurfaceWindow);
@@ -240,8 +243,12 @@ bool QWaylandWindow::shouldCreateSubSurface() const
return QPlatformWindow::parent() != Q_NULLPTR;
}
-void QWaylandWindow::reset()
+void QWaylandWindow::reset(bool sendDestroyEvent)
{
+ if (isInitialized() && sendDestroyEvent) {
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
+ QGuiApplication::sendEvent(window(), &e);
+ }
delete mShellSurface;
mShellSurface = 0;
delete mSubSurfaceWindow;