Introduce AbstractClient::destroyClient()

Summary:
The new method provides a generic way for destructing clients. Notice
that we can't just delete clients because we may need to discard
temporary window rules, which is usually done in destroyClient().

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27821
This commit is contained in:
Vlad Zahorodnii 2020-02-19 17:22:23 +02:00
parent be759b7d33
commit 861883895d
5 changed files with 5 additions and 8 deletions

View file

@ -787,6 +787,7 @@ public:
* Implementing subclasses can perform a windowing system solution for terminating.
*/
virtual void killWindow() = 0;
virtual void destroyClient() = 0;
enum class SameApplicationCheck {
RelaxedForActive = 1 << 0,

View file

@ -81,8 +81,8 @@ public:
void updateDecoration(bool check_workspace_pos, bool force = false) override;
void updateColorScheme() override;
void showOnScreenEdge() override;
void destroyClient() override;
void destroyClient();
void present(const QSharedPointer<QOpenGLFramebufferObject> fbo);
void present(const QImage &image, const QRegion &damage);
QWindow *internalWindow() const;

View file

@ -56,7 +56,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "unmanaged.h"
#include "useractions.h"
#include "virtualdesktops.h"
#include "xdgshellclient.h"
#include "was_user_interaction_x11_filter.h"
#include "wayland_server.h"
#include "xcbutils.h"
@ -473,12 +472,9 @@ Workspace::~Workspace()
X11Client::cleanupX11();
if (waylandServer()) {
// TODO: Introduce AbstractClient::destroy().
const QList<AbstractClient *> shellClients = waylandServer()->clients();
for (AbstractClient *client : shellClients) {
if (XdgShellClient *shellClient = qobject_cast<XdgShellClient *>(client)) {
shellClient->destroyClient();
}
client->destroyClient();
}
}

View file

@ -129,7 +129,7 @@ public:
bool manage(xcb_window_t w, bool isMapped);
void releaseWindow(bool on_shutdown = false);
void destroyClient();
void destroyClient() override;
QStringList activities() const override;
void setOnActivity(const QString &activity, bool enable);

View file

@ -121,6 +121,7 @@ public:
void killWindow() override;
bool isLocalhost() const override;
bool supportsWindowRules() const override;
void destroyClient() override;
void installPlasmaShellSurface(KWayland::Server::PlasmaShellSurfaceInterface *surface);
void installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *decoration);
@ -170,7 +171,6 @@ private:
*/
void finishInit();
void createDecoration(const QRect &oldgeom);
void destroyClient();
void createWindowId();
void updateIcon();
bool shouldExposeToWindowManagement();