From a49fd23243d2a56db813f7bde4c773b5c9223667 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 5 Nov 2023 02:40:38 +0200 Subject: [PATCH] kwin: remove fullscreen hack there never was a way to enable it (not via gui anyway) meaning the bits are doing nothing (other than slow down kwin that is) Signed-off-by: Ivailo Monev --- kwin/client.h | 13 +++++------- kwin/geometry.cpp | 53 +++++------------------------------------------ kwin/kwin.kcfg | 3 --- kwin/manage.cpp | 18 ++-------------- kwin/options.cpp | 11 ---------- kwin/options.h | 14 ------------- 6 files changed, 12 insertions(+), 100 deletions(-) diff --git a/kwin/client.h b/kwin/client.h index 5b7de014..85c7b347 100644 --- a/kwin/client.h +++ b/kwin/client.h @@ -82,9 +82,8 @@ class Client **/ Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops WRITE setOnAllDesktops NOTIFY desktopChanged) /** - * Whether this Client is fullScreen. A Client might either be fullScreen due to the _NET_WM property - * or through a legacy support hack. The fullScreen state can only be changed if the Client does not - * use the legacy hack. To be sure whether the state changed, connect to the notify signal. + * Whether this Client is fullScreen. A Client might either be fullScreen due to the _NET_WM property. + * To be sure whether the state changed, connect to the notify signal. **/ Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged) /** @@ -366,7 +365,7 @@ public: void setFullScreen(bool set, bool user = true); bool isFullScreen() const; - bool isFullScreenable(bool fullscreen_hack = false) const; + bool isFullScreenable() const; bool isActiveFullScreen() const; bool userCanSetFullScreen() const; QRect geometryFSRestore() const { @@ -719,8 +718,7 @@ private: void updateAllowedActions(bool force = false); QRect fullscreenMonitorsArea(NETFullscreenMonitors topology) const; void changeMaximize(bool horizontal, bool vertical, bool adjust); - int checkFullScreenHack(const QRect& geom) const; // 0 - None, 1 - One xinerama screen, 2 - Full area - void updateFullScreenHack(const QRect& geom); + void updateFullScreen(); void getWmNormalHints(); void getMotifHints(); void getIcons(); @@ -868,8 +866,7 @@ private: // DON'T reorder - Saved to config files !!! enum FullScreenMode { FullScreenNone, - FullScreenNormal, - FullScreenHack ///< Non-NETWM fullscreen (noborder and size of desktop) + FullScreenNormal }; FullScreenMode fullscreen_mode; MaximizeMode max_mode; diff --git a/kwin/geometry.cpp b/kwin/geometry.cpp index 31497e54..0e931f3b 100644 --- a/kwin/geometry.cpp +++ b/kwin/geometry.cpp @@ -1655,7 +1655,7 @@ void Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, in move(new_pos); plainResize(ns); setGeometry(QRect(calculateGravitation(false, gravity), size())); - updateFullScreenHack(QRect(new_pos, QSize(nw, nh))); + updateFullScreen(); QRect area = workspace()->clientArea(WorkArea, this); if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen() && area.contains(origClientGeometry)) @@ -1682,11 +1682,8 @@ void Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, in if (ns != size()) { // don't restore if some app sets its own size again QRect origClientGeometry(pos() + clientPos(), clientSize()); GeometryUpdatesBlocker blocker(this); - int save_gravity = xSizeHint.win_gravity; - xSizeHint.win_gravity = gravity; resizeWithChecks(ns); - xSizeHint.win_gravity = save_gravity; - updateFullScreenHack(QRect(calculateGravitation(true, xSizeHint.win_gravity), QSize(nw, nh))); + updateFullScreen(); if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen()) { // try to keep the window in its xinerama screen if possible, // if that fails at least keep it visible somewhere @@ -2348,12 +2345,10 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust) updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); } -bool Client::isFullScreenable(bool fullscreen_hack) const +bool Client::isFullScreenable() const { if (!rules()->checkFullScreen(true)) return false; - if (fullscreen_hack) - return isNormalWindow(); if (rules()->checkStrictGeometry(true)) { // allow rule to ignore geometry constraints QRect fsarea = workspace()->clientArea(FullScreenArea, this); if (sizeForClientSize(fsarea.size(), SizemodeAny, true) != fsarea.size()) @@ -2365,9 +2360,7 @@ bool Client::isFullScreenable(bool fullscreen_hack) const bool Client::userCanSetFullScreen() const { - if (fullscreen_mode == FullScreenHack) - return false; - if (!isFullScreenable(false)) + if (!isFullScreenable()) return false; return isNormalWindow() || isDialog(); } @@ -2376,8 +2369,6 @@ void Client::setFullScreen(bool set, bool user) { if (!isFullScreen() && !set) return; - if (fullscreen_mode == FullScreenHack) - return; if (user && !userCanSetFullScreen()) return; set = rules()->checkFullScreen(set && !isSpecialWindow()); @@ -2468,42 +2459,8 @@ QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) co return total; } - -int Client::checkFullScreenHack(const QRect& geom) const +void Client::updateFullScreen() { - if (!options->isLegacyFullscreenSupport()) - return 0; - // if it's noborder window, and has size of one screen or the whole desktop geometry, it's fullscreen hack - if (noBorder() && app_noborder && isFullScreenable(true)) { - if (geom.size() == workspace()->clientArea(FullArea, geom.center(), desktop()).size()) - return 2; // full area fullscreen hack - if (geom.size() == workspace()->clientArea(ScreenArea, geom.center(), desktop()).size()) - return 1; // xinerama-aware fullscreen hack - } - return 0; -} - -void Client::updateFullScreenHack(const QRect& geom) -{ - int type = checkFullScreenHack(geom); - if (fullscreen_mode == FullScreenNone && type != 0) { - fullscreen_mode = FullScreenHack; - updateDecoration(false, false); - QRect geom; - if (rules()->checkStrictGeometry(false)) { - geom = type == 2 // 1 - it's xinerama-aware fullscreen hack, 2 - it's full area - ? workspace()->clientArea(FullArea, geom.center(), desktop()) - : workspace()->clientArea(ScreenArea, geom.center(), desktop()); - } else - geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop()); - setGeometry(geom); - emit fullScreenChanged(); - } else if (fullscreen_mode == FullScreenHack && type == 0) { - fullscreen_mode = FullScreenNone; - updateDecoration(false, false); - // whoever called this must setup correct geometry - emit fullScreenChanged(); - } StackingUpdatesBlocker blocker(workspace()); workspace()->updateClientLayer(this); // active fullscreens get different layer } diff --git a/kwin/kwin.kcfg b/kwin/kwin.kcfg index 31f89b4f..b222917e 100644 --- a/kwin/kwin.kcfg +++ b/kwin/kwin.kcfg @@ -108,9 +108,6 @@ true - - false - 1 0 diff --git a/kwin/manage.cpp b/kwin/manage.cpp index 46cb2337..7a533252 100644 --- a/kwin/manage.cpp +++ b/kwin/manage.cpp @@ -220,17 +220,6 @@ bool Client::manage(xcb_window_t w, bool isMapped) area = workspace()->clientArea(PlacementArea, screens()->geometry(screen).center(), desktop()); } - if (int type = checkFullScreenHack(geom)) { - fullscreen_mode = FullScreenHack; - if (rules()->checkStrictGeometry(false)) { - geom = type == 2 // 1 = It's xinerama-aware fullscreen hack, 2 = It's full area - ? workspace()->clientArea(FullArea, geom.center(), desktop()) - : workspace()->clientArea(ScreenArea, geom.center(), desktop()); - } else - geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop()); - placementDone = true; - } - if (isDesktop()) // KWin doesn't manage desktop windows placementDone = true; @@ -467,9 +456,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) if (session->maximized != MaximizeRestore) { maximize(MaximizeMode(session->maximized)); } - if (session->fullscreen == FullScreenHack) - ; // Nothing, this should be already set again above - else if (session->fullscreen != FullScreenNone) { + if (session->fullscreen != FullScreenNone) { setFullScreen(true, false); geom_fs_restore = session->fsrestore; } @@ -499,8 +486,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) demandAttention(); if (info->state() & NET::Modal) setModal(true); - if (fullscreen_mode != FullScreenHack) - setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false); + setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false); } updateAllowedActions(true); diff --git a/kwin/options.cpp b/kwin/options.cpp index 1c55b4c6..540ebec1 100644 --- a/kwin/options.cpp +++ b/kwin/options.cpp @@ -88,7 +88,6 @@ Options::Options(QObject *parent) , m_showDesktopIsMinimizeAll(false) , m_rollOverDesktops(false) , m_focusStealingPreventionLevel(0) - , m_legacyFullscreenSupport(false) , m_killPingTimeout(0) , m_hideUtilityWindowsForInactive(false) , m_inactiveTabsSkipTaskbar(false) @@ -314,15 +313,6 @@ void Options::setFocusStealingPreventionLevel(int focusStealingPreventionLevel) emit focusStealingPreventionLevelChanged(); } -void Options::setLegacyFullscreenSupport(bool legacyFullscreenSupport) -{ - if (m_legacyFullscreenSupport == legacyFullscreenSupport) { - return; - } - m_legacyFullscreenSupport = legacyFullscreenSupport; - emit legacyFullscreenSupportChanged(); -} - void Options::setOperationTitlebarDblClick(WindowOperation operationTitlebarDblClick) { if (OpTitlebarDblClick == operationTitlebarDblClick) { @@ -709,7 +699,6 @@ void Options::syncFromKcfgc() setNextFocusPrefersMouse(m_settings->nextFocusPrefersMouse()); setSeparateScreenFocus(m_settings->separateScreenFocus()); setRollOverDesktops(m_settings->rollOverDesktops()); - setLegacyFullscreenSupport(m_settings->legacyFullscreenSupport()); setFocusStealingPreventionLevel(m_settings->focusStealingPreventionLevel()); setPlacement(m_settings->placement()); setAutoRaise(m_settings->autoRaise()); diff --git a/kwin/options.h b/kwin/options.h index 0fbd29a5..49492315 100644 --- a/kwin/options.h +++ b/kwin/options.h @@ -101,10 +101,6 @@ class Options : public QObject, public KDecorationOptions * 0 - 4 , see Workspace::allowClientActivation() **/ Q_PROPERTY(int focusStealingPreventionLevel READ focusStealingPreventionLevel WRITE setFocusStealingPreventionLevel NOTIFY focusStealingPreventionLevelChanged) - /** - * support legacy fullscreen windows hack: borderless non-netwm windows with screen geometry - */ - Q_PROPERTY(bool legacyFullscreenSupport READ isLegacyFullscreenSupport WRITE setLegacyFullscreenSupport NOTIFY legacyFullscreenSupportChanged) Q_PROPERTY(WindowOperation operationTitlebarDblClick READ operationTitlebarDblClick WRITE setOperationTitlebarDblClick NOTIFY operationTitlebarDblClickChanged) Q_PROPERTY(MouseCommand commandActiveTitlebar1 READ commandActiveTitlebar1 WRITE setCommandActiveTitlebar1 NOTIFY commandActiveTitlebar1Changed) Q_PROPERTY(MouseCommand commandActiveTitlebar2 READ commandActiveTitlebar2 WRITE setCommandActiveTitlebar2 NOTIFY commandActiveTitlebar2Changed) @@ -313,13 +309,6 @@ public: return m_focusStealingPreventionLevel; } - /** - * support legacy fullscreen windows hack: borderless non-netwm windows with screen geometry - */ - bool isLegacyFullscreenSupport() const { - return m_legacyFullscreenSupport; - } - WindowOperation operationTitlebarDblClick() const { return OpTitlebarDblClick; } @@ -517,7 +506,6 @@ public: void setShowDesktopIsMinimizeAll(bool showDesktopIsMinimizeAll); void setRollOverDesktops(bool rollOverDesktops); void setFocusStealingPreventionLevel(int focusStealingPreventionLevel); - void setLegacyFullscreenSupport(bool legacyFullscreenSupport); void setOperationTitlebarDblClick(WindowOperation operationTitlebarDblClick); void setCommandActiveTitlebar1(MouseCommand commandActiveTitlebar1); void setCommandActiveTitlebar2(MouseCommand commandActiveTitlebar2); @@ -675,7 +663,6 @@ Q_SIGNALS: void showDesktopIsMinimizeAllChanged(); void rollOverDesktopsChanged(bool enabled); void focusStealingPreventionLevelChanged(); - void legacyFullscreenSupportChanged(); void operationTitlebarDblClickChanged(); void commandActiveTitlebar1Changed(); void commandActiveTitlebar2Changed(); @@ -733,7 +720,6 @@ private: bool m_showDesktopIsMinimizeAll; bool m_rollOverDesktops; int m_focusStealingPreventionLevel; - bool m_legacyFullscreenSupport; int m_killPingTimeout; bool m_hideUtilityWindowsForInactive; bool m_inactiveTabsSkipTaskbar;