From 65b4968c809fee02e933bd05dca06784b7dbb329 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 7 Jun 2024 21:10:44 +0200 Subject: [PATCH] remove the HideUtilityWindowsForInactive option It caused bugs and doesn't seem to work anymore, with no complaints about it not working or an obvious reason for it to exist, so it almost certainly isn't needed at all. --- src/activation.cpp | 1 - src/kcms/options/advanced.ui | 24 +---- src/kcms/options/kwinoptions_settings.kcfg | 4 - src/kwin.kcfg | 3 - src/options.cpp | 11 -- src/options.h | 15 --- src/workspace.cpp | 112 --------------------- src/workspace.h | 5 - src/x11window.cpp | 1 - 9 files changed, 2 insertions(+), 174 deletions(-) diff --git a/src/activation.cpp b/src/activation.cpp index 7085828a1e..b6ef9e1441 100644 --- a/src/activation.cpp +++ b/src/activation.cpp @@ -254,7 +254,6 @@ void Workspace::setActiveWindow(Window *window) } } - updateToolWindows(false); if (window) { disableGlobalShortcutsForClient(window->rules()->checkDisableGlobalShortcuts(false)); } else { diff --git a/src/kcms/options/advanced.ui b/src/kcms/options/advanced.ui index 9167397947..71d13e7dd1 100644 --- a/src/kcms/options/advanced.ui +++ b/src/kcms/options/advanced.ui @@ -118,26 +118,6 @@ - - - &Special windows: - - - kcfg_HideUtilityWindowsForInactive - - - - - - - When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be hidden and will be shown only when the application becomes active. Note that applications have to mark the windows with the proper window type for this feature to work. - - - Hide utility windows for inactive applications - - - - Virtual Desktop behavior: @@ -147,14 +127,14 @@ - + When activating a window on a different Virtual Desktop: - + <html><head/><body><p>This setting controls what happens when an open window located on a Virtual Desktop other than the current one is activated. </p><p><span style=" font-style:italic;">Switch to that Virtual Desktop</span> will switch to the Virtual Desktop where the window is currently located. </p><p><span style=" font-style:italic;">Bring window to current Virtual Desktop</span> will cause the window to jump to the active Virtual Desktop. </p></body></html> diff --git a/src/kcms/options/kwinoptions_settings.kcfg b/src/kcms/options/kwinoptions_settings.kcfg index 1ff796a759..48aacd84b8 100644 --- a/src/kcms/options/kwinoptions_settings.kcfg +++ b/src/kcms/options/kwinoptions_settings.kcfg @@ -49,10 +49,6 @@ Centered - - true - - diff --git a/src/kwin.kcfg b/src/kwin.kcfg index 0945be128e..949449bda9 100644 --- a/src/kwin.kcfg +++ b/src/kwin.kcfg @@ -205,9 +205,6 @@ 5000 - - true - false diff --git a/src/options.cpp b/src/options.cpp index d7a240f255..340733b2f6 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -52,7 +52,6 @@ Options::Options(QObject *parent) , m_rollOverDesktops(false) , m_focusStealingPreventionLevel(0) , m_killPingTimeout(0) - , m_hideUtilityWindowsForInactive(false) , m_xwaylandCrashPolicy(Options::defaultXwaylandCrashPolicy()) , m_xwaylandMaxCrashCount(Options::defaultXwaylandMaxCrashCount()) , m_xwaylandEavesdrops(Options::defaultXwaylandEavesdrops()) @@ -556,15 +555,6 @@ void Options::setKillPingTimeout(int killPingTimeout) Q_EMIT killPingTimeoutChanged(); } -void Options::setHideUtilityWindowsForInactive(bool hideUtilityWindowsForInactive) -{ - if (m_hideUtilityWindowsForInactive == hideUtilityWindowsForInactive) { - return; - } - m_hideUtilityWindowsForInactive = hideUtilityWindowsForInactive; - Q_EMIT hideUtilityWindowsForInactiveChanged(); -} - void Options::setCompositingMode(int compositingMode) { if (m_compositingMode == static_cast(compositingMode)) { @@ -849,7 +839,6 @@ void Options::syncFromKcfgc() setCornerBarrier(m_settings->cornerBarrier()); setSnapOnlyWhenOverlapping(m_settings->snapOnlyWhenOverlapping()); setKillPingTimeout(m_settings->killPingTimeout()); - setHideUtilityWindowsForInactive(m_settings->hideUtilityWindowsForInactive()); setBorderlessMaximizedWindows(m_settings->borderlessMaximizedWindows()); setElectricBorderMaximize(m_settings->electricBorderMaximize()); setElectricBorderTiling(m_settings->electricBorderTiling()); diff --git a/src/options.h b/src/options.h index eb101b7f86..251559f4bb 100644 --- a/src/options.h +++ b/src/options.h @@ -181,10 +181,6 @@ class KWIN_EXPORT Options : public QObject * timeout before non-responding application will be killed after attempt to close. */ Q_PROPERTY(int killPingTimeout READ killPingTimeout WRITE setKillPingTimeout NOTIFY killPingTimeoutChanged) - /** - * Whether to hide utility windows for inactive applications. - */ - Q_PROPERTY(bool hideUtilityWindowsForInactive READ isHideUtilityWindowsForInactive WRITE setHideUtilityWindowsForInactive NOTIFY hideUtilityWindowsForInactiveChanged) Q_PROPERTY(int compositingMode READ compositingMode WRITE setCompositingMode NOTIFY compositingModeChanged) Q_PROPERTY(bool useCompositing READ isUseCompositing WRITE setUseCompositing NOTIFY useCompositingChanged) Q_PROPERTY(int hiddenPreviews READ hiddenPreviews WRITE setHiddenPreviews NOTIFY hiddenPreviewsChanged) @@ -635,14 +631,6 @@ public: return m_killPingTimeout; } - /** - * Whether to hide utility windows for inactive applications. - */ - bool isHideUtilityWindowsForInactive() const - { - return m_hideUtilityWindowsForInactive; - } - /** * Returns the animation time factor for desktop effects. */ @@ -756,7 +744,6 @@ public: void setElectricBorderCornerRatio(float electricBorderCornerRatio); void setBorderlessMaximizedWindows(bool borderlessMaximizedWindows); void setKillPingTimeout(int killPingTimeout); - void setHideUtilityWindowsForInactive(bool hideUtilityWindowsForInactive); void setCompositingMode(int compositingMode); void setUseCompositing(bool useCompositing); void setHiddenPreviews(int hiddenPreviews); @@ -958,7 +945,6 @@ Q_SIGNALS: void electricBorderCornerRatioChanged(); void borderlessMaximizedWindowsChanged(); void killPingTimeoutChanged(); - void hideUtilityWindowsForInactiveChanged(); void compositingModeChanged(); void useCompositingChanged(); void hiddenPreviewsChanged(); @@ -998,7 +984,6 @@ private: bool m_rollOverDesktops; int m_focusStealingPreventionLevel; int m_killPingTimeout; - bool m_hideUtilityWindowsForInactive; XwaylandCrashPolicy m_xwaylandCrashPolicy; int m_xwaylandMaxCrashCount; XwaylandEavesdropsMode m_xwaylandEavesdrops; diff --git a/src/workspace.cpp b/src/workspace.cpp index 246ac9bb3a..034a66ac41 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -208,11 +208,9 @@ void Workspace::init() reconfigureTimer.setSingleShot(true); m_rearrangeTimer.setSingleShot(true); - updateToolWindowsTimer.setSingleShot(true); connect(&reconfigureTimer, &QTimer::timeout, this, &Workspace::slotReconfigure); connect(&m_rearrangeTimer, &QTimer::timeout, this, &Workspace::rearrange); - connect(&updateToolWindowsTimer, &QTimer::timeout, this, &Workspace::slotUpdateToolWindows); // TODO: do we really need to reconfigure everything when fonts change? // maybe just reconfigure the decorations? Move this into libkdecoration? @@ -739,9 +737,6 @@ void Workspace::addX11Window(X11Window *window) window->checkActiveModal(); checkTransients(window->window()); // SELI TODO: Does this really belong here? updateStackingOrder(true); // Propagatem new window - if (window->isUtility() || window->isMenu() || window->isToolbar()) { - updateToolWindows(true); - } updateTabbox(); } @@ -881,112 +876,6 @@ void Workspace::removeWindow(Window *window) updateTabbox(); } -void Workspace::updateToolWindows(bool also_hide) -{ - // TODO: What if Client's transiency/group changes? should this be called too? (I'm paranoid, am I not?) - if (!options->isHideUtilityWindowsForInactive()) { -#if KWIN_BUILD_X11 - for (auto it = m_windows.constBegin(); it != m_windows.constEnd(); ++it) { - X11Window *x11Window = qobject_cast(*it); - if (x11Window && x11Window->isUtility()) { - x11Window->setHidden(false); - } - } -#endif - return; - } - const Group *group = nullptr; - auto window = m_activeWindow; - // Go up in transiency hiearchy, if the top is found, only tool transients for the top mainwindow - // will be shown; if a group transient is group, all tools in the group will be shown - while (window != nullptr) { - if (!window->isTransient()) { - break; - } - if (window->groupTransient()) { - group = window->group(); - break; - } - window = window->transientFor(); - } - // Use stacking order only to reduce flicker, it doesn't matter if block_stacking_updates == 0, - // I.e. if it's not up to date - - // SELI TODO: But maybe it should - what if a new window has been added that's not in stacking order yet? - QList to_show, to_hide; - for (auto it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it) { - auto c = *it; - if (!c->isClient()) { - continue; - } - if (c->isUtility() || c->isMenu() || c->isToolbar()) { - bool show = true; - if (!c->isTransient()) { -#if KWIN_BUILD_X11 - if (!c->group() || c->group()->members().count() == 1) { // Has its own group, keep always visible - show = true; - } else if (window != nullptr && c->group() == window->group()) { - show = true; - } else -#endif - { - show = false; - } - } else { - if (group != nullptr && c->group() == group) { - show = true; - } else if (window != nullptr && window->hasTransient(c, true)) { - show = true; - } else { - show = false; - } - } - if (!show && also_hide) { - const auto mainwindows = c->mainWindows(); - // Don't hide utility windows which are standalone(?) or - // have e.g. kicker as mainwindow - if (mainwindows.isEmpty()) { - show = true; - } - for (auto it2 = mainwindows.constBegin(); it2 != mainwindows.constEnd(); ++it2) { - if ((*it2)->isSpecialWindow()) { - show = true; - } - } - if (!show) { - to_hide.append(c); - } - } - if (show) { - to_show.append(c); - } - } - } // First show new ones, then hide - for (int i = to_show.size() - 1; i >= 0; --i) { // From topmost - // TODO: Since this is in stacking order, the order of taskbar entries changes :( - to_show.at(i)->setHidden(false); - } - if (also_hide) { - for (auto it = to_hide.constBegin(); it != to_hide.constEnd(); ++it) { // From bottommost - (*it)->setHidden(true); - } - updateToolWindowsTimer.stop(); - } else { // setActiveWindow() is after called with NULL window, quickly followed - // by setting a new window, which would result in flickering - resetUpdateToolWindowsTimer(); - } -} - -void Workspace::resetUpdateToolWindowsTimer() -{ - updateToolWindowsTimer.start(200); -} - -void Workspace::slotUpdateToolWindows() -{ - updateToolWindows(true); -} - void Workspace::slotReloadConfig() { reconfigure(); @@ -1013,7 +902,6 @@ void Workspace::slotReconfigure() Q_EMIT configChanged(); m_userActionsMenu->discard(); - updateToolWindows(true); m_rulebook->load(); for (Window *window : std::as_const(m_windows)) { diff --git a/src/workspace.h b/src/workspace.h index 610f8ec99b..89fe9016e7 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -236,7 +236,6 @@ public: void restackWindowUnderActive(Window *window); void restack(Window *window, Window *under, bool force = false); void raiseOrLowerWindow(Window *window); - void resetUpdateToolWindowsTimer(); void updateStackingOrder(bool propagate_new_windows = false); void forceRestacking(); @@ -549,7 +548,6 @@ private Q_SLOTS: #if KWIN_BUILD_X11 void selectWmInputEventMask(); #endif - void slotUpdateToolWindows(); void delayFocus(); void slotReloadConfig(); void updateCurrentActivity(const QString &new_activity); @@ -610,7 +608,6 @@ private: void lowerWindowWithinApplication(Window *window); bool allowFullClientRaising(const Window *window, uint32_t timestamp); void blockStackingUpdates(bool block); - void updateToolWindows(bool also_hide); void saveOldScreenSizes(); void addToStack(Window *window); void removeFromStack(Window *window); @@ -720,8 +717,6 @@ private: // Timer to collect requests for 'reconfigure' QTimer reconfigureTimer; - QTimer updateToolWindowsTimer; - static Workspace *_self; #if KWIN_BUILD_X11 std::unique_ptr m_startup; diff --git a/src/x11window.cpp b/src/x11window.cpp index 769bed4b62..9a43c72fd5 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -3227,7 +3227,6 @@ void X11Window::setTransient(xcb_window_t new_transient_for_id) setTransientFor(transient_for); checkGroup(nullptr, true); // force, because transiency has changed updateLayer(); - workspace()->resetUpdateToolWindowsTimer(); Q_EMIT transientChanged(); } }