summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2014-11-15 11:40:51 +0000
committerSean Harmer <sean.harmer@kdab.com>2014-11-17 10:38:22 +0100
commitc5ecabb70c0f0cb25a22bf3742f39648a34d1c3c (patch)
treee0c788b152d0cb7ec51d0d3e880aa0e286c9fd14 /src/gui/kernel/qwindow.cpp
parent3d575d4845926bd141ff0c14e57427bba79644d0 (diff)
Send events when platform surfaces are created/about to be destroyed
These synchronously delivered events allow applications to correctly and conveniently handle native platform surfaces being destroyed. This is particularly useful when doing rendering on a non-gui thread as it allows to shutdown rendering before the native surface gets destroyed from under us. Task-number: QTBUG-42476 Task-number: QTBUG-42483 Change-Id: I63f41bbdb32f281d0f3b8ec2537eb2b0361f3bb3 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index e23e0f8e57..a3b7f38c80 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -404,6 +404,11 @@ void QWindowPrivate::create(bool recursive)
window->d_func()->platformWindow->setParent(platformWindow);
}
}
+
+ if (platformWindow) {
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);
+ QGuiApplication::sendEvent(q, &e);
+ }
}
}
@@ -1590,6 +1595,10 @@ void QWindow::destroy()
bool wasVisible = isVisible();
setVisible(false);
+
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
+ QGuiApplication::sendEvent(this, &e);
+
delete d->platformWindow;
d->resizeEventPending = true;
d->receivedExpose = false;