From cf1d66ef59f172dcfa36404b7b6dc206b3551529 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 25 Mar 2023 10:19:33 +0200 Subject: [PATCH] tabbox: Drop support for _KDE_FIRST_IN_WINDOWLIST LXR search shows that _KDE_FIRST_IN_WINDOWLIST is not used anywhere in KDE codebase besides KWin. --- autotests/tabbox/mock_tabboxclient.h | 4 ---- src/atoms.cpp | 1 - src/atoms.h | 1 - src/events.cpp | 2 -- src/tabbox/clientmodel.cpp | 27 +++++---------------------- src/tabbox/clientmodel.h | 6 ++---- src/tabbox/tabbox.cpp | 5 ----- src/tabbox/tabbox.h | 1 - src/tabbox/tabboxhandler.h | 1 - src/window.h | 9 --------- src/x11window.cpp | 20 -------------------- src/x11window.h | 3 --- 12 files changed, 7 insertions(+), 73 deletions(-) diff --git a/autotests/tabbox/mock_tabboxclient.h b/autotests/tabbox/mock_tabboxclient.h index 9c82905622..aa6c37a9ed 100644 --- a/autotests/tabbox/mock_tabboxclient.h +++ b/autotests/tabbox/mock_tabboxclient.h @@ -41,10 +41,6 @@ public: { return true; } - bool isFirstInTabBox() const override - { - return false; - } int width() const override { return 100; diff --git a/src/atoms.cpp b/src/atoms.cpp index 040614269d..2439f1a913 100644 --- a/src/atoms.cpp +++ b/src/atoms.cpp @@ -48,7 +48,6 @@ Atoms::Atoms() , net_wm_sync_request_counter(QByteArrayLiteral("_NET_WM_SYNC_REQUEST_COUNTER")) , net_wm_sync_request(QByteArrayLiteral("_NET_WM_SYNC_REQUEST")) , kde_net_wm_shadow(QByteArrayLiteral("_KDE_NET_WM_SHADOW")) - , kde_first_in_window_list(QByteArrayLiteral("_KDE_FIRST_IN_WINDOWLIST")) , kde_color_sheme(QByteArrayLiteral("_KDE_NET_WM_COLOR_SCHEME")) , kde_skip_close_animation(QByteArrayLiteral("_KDE_NET_WM_SKIP_CLOSE_ANIMATION")) , kde_screen_edge_show(QByteArrayLiteral("_KDE_NET_WM_SCREEN_EDGE_SHOW")) diff --git a/src/atoms.h b/src/atoms.h index dbb4412c7c..2f7e7bc59e 100644 --- a/src/atoms.h +++ b/src/atoms.h @@ -56,7 +56,6 @@ public: Xcb::Atom net_wm_sync_request_counter; Xcb::Atom net_wm_sync_request; Xcb::Atom kde_net_wm_shadow; - Xcb::Atom kde_first_in_window_list; Xcb::Atom kde_color_sheme; Xcb::Atom kde_skip_close_animation; Xcb::Atom kde_screen_edge_show; diff --git a/src/events.cpp b/src/events.cpp index 813c92c7e1..effef23707 100644 --- a/src/events.cpp +++ b/src/events.cpp @@ -674,8 +674,6 @@ void X11Window::propertyNotifyEvent(xcb_property_notify_event_t *e) getSyncCounter(); } else if (e->atom == atoms->activities) { checkActivities(); - } else if (e->atom == atoms->kde_first_in_window_list) { - updateFirstInTabBox(); } else if (e->atom == atoms->kde_color_sheme) { updateColorScheme(); } else if (e->atom == atoms->kde_screen_edge_show) { diff --git a/src/tabbox/clientmodel.cpp b/src/tabbox/clientmodel.cpp index 79241d9302..565d633ea4 100644 --- a/src/tabbox/clientmodel.cpp +++ b/src/tabbox/clientmodel.cpp @@ -70,8 +70,7 @@ QVariant ClientModel::data(const QModelIndex &index, int role) const case MinimizedRole: return client->isMinimized(); case CloseableRole: - // clients that claim to be first are not closeable - return client->isCloseable() && !client->isFirstInTabBox(); + return client->isCloseable(); case IconRole: return client->icon(); default: @@ -155,8 +154,7 @@ void ClientModel::createClientList(bool partialReset) createClientList(tabBox->currentDesktop(), partialReset); } -void ClientModel::createFocusChainClientList(int desktop, - const std::shared_ptr &start, TabBoxClientList &stickyClients) +void ClientModel::createFocusChainClientList(int desktop, const std::shared_ptr &start) { auto c = start; if (!tabBox->isInFocusChain(c.get())) { @@ -170,16 +168,12 @@ void ClientModel::createFocusChainClientList(int desktop, std::shared_ptr add = tabBox->clientToAddToList(c.get(), desktop).lock(); if (add) { m_mutableClientList += add; - if (add->isFirstInTabBox()) { - stickyClients << add; - } } c = tabBox->nextClientFocusChain(c.get()).lock(); } while (c && c != stop); } -void ClientModel::createStackingOrderClientList(int desktop, - const std::shared_ptr &start, TabBoxClientList &stickyClients) +void ClientModel::createStackingOrderClientList(int desktop, const std::shared_ptr &start) { // TODO: needs improvement const TabBoxClientList stacking = tabBox->stackingOrder(); @@ -198,9 +192,6 @@ void ClientModel::createStackingOrderClientList(int desktop, } else { m_mutableClientList += add; } - if (add->isFirstInTabBox()) { - stickyClients << add; - } } if (index >= stacking.size() - 1) { c = nullptr; @@ -226,15 +217,14 @@ void ClientModel::createClientList(int desktop, bool partialReset) } m_mutableClientList.clear(); - TabBoxClientList stickyClients; switch (tabBox->config().clientSwitchingMode()) { case TabBoxConfig::FocusChainSwitching: { - createFocusChainClientList(desktop, start, stickyClients); + createFocusChainClientList(desktop, start); break; } case TabBoxConfig::StackingOrderSwitching: { - createStackingOrderClientList(desktop, start, stickyClients); + createStackingOrderClientList(desktop, start); break; } } @@ -246,13 +236,6 @@ void ClientModel::createClientList(int desktop, bool partialReset) }); } - for (const std::weak_ptr &c : std::as_const(stickyClients)) { - m_mutableClientList.erase(std::remove_if(m_mutableClientList.begin(), m_mutableClientList.end(), [c = c.lock()](auto &client) { - return client.lock() == c; - }), - m_mutableClientList.end()); - m_mutableClientList.prepend(c); - } if (tabBox->config().clientApplicationsMode() != TabBoxConfig::AllWindowsCurrentApplication && (tabBox->config().showDesktopMode() == TabBoxConfig::ShowDesktopClient || m_mutableClientList.isEmpty())) { std::weak_ptr desktopClient = tabBox->desktopClient(); diff --git a/src/tabbox/clientmodel.h b/src/tabbox/clientmodel.h index 5f56f8b330..90d7f53ec8 100644 --- a/src/tabbox/clientmodel.h +++ b/src/tabbox/clientmodel.h @@ -93,10 +93,8 @@ public Q_SLOTS: void activate(int index); private: - void createFocusChainClientList(int desktop, const std::shared_ptr &start, - TabBoxClientList &stickyClients); - void createStackingOrderClientList(int desktop, const std::shared_ptr &start, - TabBoxClientList &stickyClients); + void createFocusChainClientList(int desktop, const std::shared_ptr &start); + void createStackingOrderClientList(int desktop, const std::shared_ptr &start); TabBoxClientList m_clientList; TabBoxClientList m_mutableClientList; diff --git a/src/tabbox/tabbox.cpp b/src/tabbox/tabbox.cpp index 093ea1e41c..cbbcb54691 100644 --- a/src/tabbox/tabbox.cpp +++ b/src/tabbox/tabbox.cpp @@ -390,11 +390,6 @@ void TabBoxClientImpl::close() m_client->closeWindow(); } -bool TabBoxClientImpl::isFirstInTabBox() const -{ - return m_client->isFirstInTabBox(); -} - QUuid TabBoxClientImpl::internalId() const { return m_client->internalId(); diff --git a/src/tabbox/tabbox.h b/src/tabbox/tabbox.h index fbd89c3e07..fc7699cd01 100644 --- a/src/tabbox/tabbox.h +++ b/src/tabbox/tabbox.h @@ -84,7 +84,6 @@ public: int height() const override; bool isCloseable() const override; void close() override; - bool isFirstInTabBox() const override; QUuid internalId() const override; Window *client() const diff --git a/src/tabbox/tabboxhandler.h b/src/tabbox/tabboxhandler.h index c492086fdd..ae38b74690 100644 --- a/src/tabbox/tabboxhandler.h +++ b/src/tabbox/tabboxhandler.h @@ -334,7 +334,6 @@ public: virtual int height() const = 0; virtual bool isCloseable() const = 0; virtual void close() = 0; - virtual bool isFirstInTabBox() const = 0; virtual QUuid internalId() const = 0; }; diff --git a/src/window.h b/src/window.h index 5b20829fad..f7b3a18fcf 100644 --- a/src/window.h +++ b/src/window.h @@ -825,10 +825,6 @@ public: { return m_tabBoxClient; } - bool isFirstInTabBox() const - { - return m_firstInTabBox; - } bool skipSwitcher() const { return m_skipSwitcher; @@ -1563,10 +1559,6 @@ protected: protected: Window(); - void setFirstInTabBox(bool enable) - { - m_firstInTabBox = enable; - } void setIcon(const QIcon &icon); void startAutoRaise(); void autoRaise(); @@ -1895,7 +1887,6 @@ private: QRectF ensureSpecialStateGeometry(const QRectF &geometry); std::shared_ptr m_tabBoxClient; - bool m_firstInTabBox = false; bool m_skipTaskbar = false; /** * Unaffected by KWin diff --git a/src/x11window.cpp b/src/x11window.cpp index ce1056482a..6504dae650 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -495,7 +495,6 @@ bool X11Window::manage(xcb_window_t w, bool isMapped) auto skipCloseAnimationCookie = fetchSkipCloseAnimation(); auto showOnScreenEdgeCookie = fetchShowOnScreenEdge(); auto colorSchemeCookie = fetchPreferredColorScheme(); - auto firstInTabBoxCookie = fetchFirstInTabBox(); auto transientCookie = fetchTransient(); auto activitiesCookie = fetchActivities(); auto applicationMenuServiceNameCookie = fetchApplicationMenuServiceName(); @@ -561,7 +560,6 @@ bool X11Window::manage(xcb_window_t w, bool isMapped) setOriginalSkipTaskbar((info->state() & NET::SkipTaskbar) != 0); setSkipPager((info->state() & NET::SkipPager) != 0); setSkipSwitcher((info->state() & NET::SkipSwitcher) != 0); - readFirstInTabBox(firstInTabBoxCookie); setupCompositing(); @@ -2569,24 +2567,6 @@ void X11Window::setSessionActivityOverride(bool needed) updateActivities(false); } -Xcb::Property X11Window::fetchFirstInTabBox() const -{ - return Xcb::Property(false, m_client, atoms->kde_first_in_window_list, - atoms->kde_first_in_window_list, 0, 1); -} - -void X11Window::readFirstInTabBox(Xcb::Property &property) -{ - setFirstInTabBox(property.toBool(32, atoms->kde_first_in_window_list)); -} - -void X11Window::updateFirstInTabBox() -{ - // TODO: move into KWindowInfo - Xcb::Property property = fetchFirstInTabBox(); - readFirstInTabBox(property); -} - Xcb::StringProperty X11Window::fetchPreferredColorScheme() const { return Xcb::StringProperty(m_client, atoms->kde_color_sheme); diff --git a/src/x11window.h b/src/x11window.h index 855db627c0..385ff61029 100644 --- a/src/x11window.h +++ b/src/x11window.h @@ -241,9 +241,6 @@ public: bool isClientSideDecorated() const; - Xcb::Property fetchFirstInTabBox() const; - void readFirstInTabBox(Xcb::Property &property); - void updateFirstInTabBox(); Xcb::StringProperty fetchPreferredColorScheme() const; QString readPreferredColorScheme(Xcb::StringProperty &property) const; QString preferredColorScheme() const override;