From 58833eb1d79d7f03402cee0730c309b79f2e4501 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 7 May 2026 15:21:06 +0100 Subject: layout/scrolling: handle fullscreen manually (#14190) Makes scroll handle fullscreen by itself, allowing for fs scrolls. --- src/layout/target/Target.cpp | 8 ++++++++ src/layout/target/Target.hpp | 11 +++++++---- src/layout/target/WindowGroupTarget.cpp | 12 ++++++++++++ src/layout/target/WindowGroupTarget.hpp | 2 ++ src/layout/target/WindowTarget.cpp | 26 ++++++++++++++++++++++++-- 5 files changed, 53 insertions(+), 6 deletions(-) (limited to 'src/layout/target') diff --git a/src/layout/target/Target.cpp b/src/layout/target/Target.cpp index e8ce48bd..54fff792 100644 --- a/src/layout/target/Target.cpp +++ b/src/layout/target/Target.cpp @@ -50,6 +50,14 @@ void ITarget::setSpaceGhost(const SP& space) { m_ghostSpace = true; } +bool ITarget::layoutManagedFullscreen() const { + return m_layoutManagedFullscreen; +} + +void ITarget::setLayoutManagedFullscreen(bool enabled) { + m_layoutManagedFullscreen = enabled; +} + SP ITarget::space() const { return m_space; } diff --git a/src/layout/target/Target.hpp b/src/layout/target/Target.hpp index bae5eee5..b0f55f14 100644 --- a/src/layout/target/Target.hpp +++ b/src/layout/target/Target.hpp @@ -57,6 +57,8 @@ namespace Layout { virtual void setPseudoSize(const Vector2D& size); virtual Vector2D pseudoSize(); virtual void swap(SP b); + virtual bool layoutManagedFullscreen() const; + virtual void setLayoutManagedFullscreen(bool enabled); // virtual bool floating() = 0; @@ -77,9 +79,10 @@ namespace Layout { SP m_space; WP m_self; Vector2D m_floatingSize; - bool m_pseudo = false; - bool m_ghostSpace = false; // ghost space means a target belongs to a space, but isn't sent to the layout - Vector2D m_pseudoSize = {1280, 720}; - bool m_wasTiling = false; + bool m_pseudo = false; + bool m_ghostSpace = false; // ghost space means a target belongs to a space, but isn't sent to the layout + Vector2D m_pseudoSize = {1280, 720}; + bool m_wasTiling = false; + bool m_layoutManagedFullscreen = false; }; }; diff --git a/src/layout/target/WindowGroupTarget.cpp b/src/layout/target/WindowGroupTarget.cpp index 8f9260e2..a738362a 100644 --- a/src/layout/target/WindowGroupTarget.cpp +++ b/src/layout/target/WindowGroupTarget.cpp @@ -68,6 +68,18 @@ void CWindowGroupTarget::setFullscreenMode(eFullscreenMode mode) { m_group->current()->m_fullscreenState.internal = mode; } +bool CWindowGroupTarget::layoutManagedFullscreen() const { + return m_group->current()->m_target->layoutManagedFullscreen(); +} + +void CWindowGroupTarget::setLayoutManagedFullscreen(bool enabled) { + ITarget::setLayoutManagedFullscreen(enabled); + + for (const auto& w : m_group->windows()) { + w->m_target->setLayoutManagedFullscreen(enabled); + } +} + std::optional CWindowGroupTarget::minSize() { return m_group->current()->minSize(); } diff --git a/src/layout/target/WindowGroupTarget.hpp b/src/layout/target/WindowGroupTarget.hpp index b3e79749..f48bf9e9 100644 --- a/src/layout/target/WindowGroupTarget.hpp +++ b/src/layout/target/WindowGroupTarget.hpp @@ -28,6 +28,8 @@ namespace Layout { virtual void damageEntire(); virtual void warpPositionSize(); virtual void onUpdateSpace(); + virtual bool layoutManagedFullscreen() const; + virtual void setLayoutManagedFullscreen(bool enabled); private: CWindowGroupTarget(SP g); diff --git a/src/layout/target/WindowTarget.cpp b/src/layout/target/WindowTarget.cpp index 13984104..9258b4ae 100644 --- a/src/layout/target/WindowTarget.cpp +++ b/src/layout/target/WindowTarget.cpp @@ -43,7 +43,7 @@ void CWindowTarget::updatePos() { if (!m_space) return; - if (fullscreenMode() == FSMODE_FULLSCREEN) + if (fullscreenMode() == FSMODE_FULLSCREEN && !layoutManagedFullscreen()) return; if (floating() && fullscreenMode() != FSMODE_MAXIMIZED) { @@ -83,7 +83,24 @@ void CWindowTarget::updatePos() { return; } - if (fullscreenMode() == FSMODE_FULLSCREEN) + if (fullscreenMode() == FSMODE_FULLSCREEN && layoutManagedFullscreen()) { + CBox nodeBox = m_box.logicalBox; + CBox visualBox = m_box.visualBox.empty() ? nodeBox : m_box.visualBox; + nodeBox.round(); + visualBox.round(); + + m_window->m_size = nodeBox.size(); + m_window->m_position = nodeBox.pos(); + + *m_window->m_realSize = visualBox.size(); + *m_window->m_realPosition = visualBox.pos(); + + m_window->updateWindowDecos(); + m_window->sendWindowSize(); + return; + } + + if (fullscreenMode() == FSMODE_FULLSCREEN && !layoutManagedFullscreen()) return; g_pHyprRenderer->damageWindow(window()); @@ -206,6 +223,7 @@ void CWindowTarget::updatePos() { } m_window->updateWindowDecos(); + m_window->sendWindowSize(); } void CWindowTarget::assignToSpace(const SP& space, std::optional focalPoint) { @@ -214,6 +232,8 @@ void CWindowTarget::assignToSpace(const SP& space, std::optionalm_layoutFlags = {}; + // keep the ref here so that moveToWorkspace doesn't unref the workspace // and assignToSpace doesn't think this is a new target because space wp is dead const auto WSREF = space->workspace(); @@ -236,6 +256,8 @@ void CWindowTarget::setFloating(bool x) { if (x == m_window->m_isFloating) return; + m_window->m_layoutFlags = {}; + m_window->m_isFloating = x; m_window->m_pinned = false; -- cgit v1.2.3