From 57aec197448b09026ae4ae9bd7bb842cb6d40b2a Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 24 Mar 2021 18:44:52 +0100 Subject: [PATCH] Remove cleanTabBox duplicated code --- src/abstract_client.cpp | 11 +++++++++++ src/abstract_client.h | 3 +++ src/waylandclient.cpp | 14 -------------- src/waylandclient.h | 1 - src/x11client.cpp | 17 ++--------------- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index 1a8e0217b6..cfe3c7b44d 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -3756,9 +3756,20 @@ QRect AbstractClient::fullscreenGeometryRestore() const { return m_fullscreenGeometryRestore; } + void AbstractClient::setFullscreenGeometryRestore(const QRect &geom) { m_fullscreenGeometryRestore = geom; } +void AbstractClient::cleanTabBox() +{ +#ifdef KWIN_BUILD_TABBOX + TabBox::TabBox *tabBox = TabBox::TabBox::self(); + if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { + tabBox->nextPrev(true); + } +#endif +} + } diff --git a/src/abstract_client.h b/src/abstract_client.h index 1e0095bed8..207810d14c 100644 --- a/src/abstract_client.h +++ b/src/abstract_client.h @@ -1243,6 +1243,9 @@ protected: QRect m_virtualKeyboardGeometry; void setFullscreenGeometryRestore(const QRect &geom); + + void cleanTabBox(); + private Q_SLOTS: void shadeHover(); void shadeUnhover(); diff --git a/src/waylandclient.cpp b/src/waylandclient.cpp index 44c652df53..f00303daa3 100644 --- a/src/waylandclient.cpp +++ b/src/waylandclient.cpp @@ -11,10 +11,6 @@ #include "wayland_server.h" #include "workspace.h" -#ifdef KWIN_BUILD_TABBOX -#include "tabbox.h" -#endif - #include #include #include @@ -256,16 +252,6 @@ void WaylandClient::cleanGrouping() } } -void WaylandClient::cleanTabBox() -{ -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox *tabBox = TabBox::TabBox::self(); - if (tabBox->isDisplayed() && tabBox->currentClient() == this) { - tabBox->nextPrev(true); - } -#endif -} - bool WaylandClient::isShown(bool shaded_is_shown) const { Q_UNUSED(shaded_is_shown) diff --git a/src/waylandclient.h b/src/waylandclient.h index 702da8715f..535e362316 100644 --- a/src/waylandclient.h +++ b/src/waylandclient.h @@ -62,7 +62,6 @@ protected: void setPositionSyncMode(SyncMode syncMode); void setSizeSyncMode(SyncMode syncMode); void cleanGrouping(); - void cleanTabBox(); virtual void requestGeometry(const QRect &rect); virtual void updateGeometry(const QRect &rect); diff --git a/src/x11client.cpp b/src/x11client.cpp index cc46887259..810ab4d2bd 100644 --- a/src/x11client.cpp +++ b/src/x11client.cpp @@ -25,9 +25,6 @@ #include "netinfo.h" #include "screens.h" #include "shadow.h" -#ifdef KWIN_BUILD_TABBOX -#include "tabbox.h" -#endif #include "workspace.h" #include "screenedge.h" #include "decorations/decorationbridge.h" @@ -200,12 +197,7 @@ void X11Client::deleteClient(X11Client *c) void X11Client::releaseWindow(bool on_shutdown) { markAsZombie(); -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox *tabBox = TabBox::TabBox::self(); - if (tabBox->isDisplayed() && tabBox->currentClient() == this) { - tabBox->nextPrev(true); - } -#endif + cleanTabBox(); Deleted* del = nullptr; if (!on_shutdown) { del = Deleted::create(this); @@ -272,12 +264,7 @@ void X11Client::releaseWindow(bool on_shutdown) void X11Client::destroyClient() { markAsZombie(); -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox *tabBox = TabBox::TabBox::self(); - if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { - tabBox->nextPrev(true); - } -#endif + cleanTabBox(); Deleted* del = Deleted::create(this); if (isMoveResize()) emit clientFinishUserMovedResized(this);