Commit d0a0c70d authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Add aboutToBeDestroyed signal to various xdg-shell classes

With the aboutToBeDestroyed signal, the compositor will be able to
perform cleanup before the QObject::destroyed signal is emitted, which
saves us some nullptr checks.
parent 6ba9856a
......@@ -182,6 +182,7 @@ XdgSurfaceInterfacePrivate *XdgSurfaceInterfacePrivate::get(XdgSurfaceInterface
void XdgSurfaceInterfacePrivate::xdg_surface_destroy_resource(Resource *resource)
{
Q_UNUSED(resource)
Q_EMIT q->aboutToBeDestroyed();
XdgShellInterfacePrivate::get(shell)->unregisterXdgSurface(q);
delete q;
}
......@@ -374,6 +375,7 @@ void XdgToplevelInterfacePrivate::reset()
void XdgToplevelInterfacePrivate::xdg_toplevel_destroy_resource(Resource *resource)
{
Q_UNUSED(resource)
Q_EMIT q->aboutToBeDestroyed();
delete q;
}
......@@ -695,6 +697,7 @@ void XdgPopupInterfacePrivate::reset()
void XdgPopupInterfacePrivate::xdg_popup_destroy_resource(Resource *resource)
{
Q_UNUSED(resource)
Q_EMIT q->aboutToBeDestroyed();
delete q;
}
......
......@@ -162,6 +162,11 @@ public:
static XdgSurfaceInterface *get(::wl_resource *resource);
Q_SIGNALS:
/**
* This signal is emitted when the xdg-surface is about to be destroyed.
*/
void aboutToBeDestroyed();
/**
* This signal is emitted when a configure event with serial \a serial has been acknowledged.
*/
......@@ -280,6 +285,11 @@ public:
static XdgToplevelInterface *get(::wl_resource *resource);
Q_SIGNALS:
/**
* This signal is emitted when the xdg-toplevel is about to be destroyed.
*/
void aboutToBeDestroyed();
/**
* This signal is emitted when the xdg-toplevel has commited the initial state and wants to
* be configured. After initializing the toplevel, you must send a configure event.
......@@ -537,6 +547,11 @@ public:
static XdgPopupInterface *get(::wl_resource *resource);
Q_SIGNALS:
/**
* This signal is emitted when the xdg-popup is about to be destroyed.
*/
void aboutToBeDestroyed();
/**
* This signal is emitted when the xdg-popup has commited the initial state and wants to
* be configured. After initializing the popup, you must send a configure event.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment