summaryrefslogtreecommitdiff
path: root/src/desktop/view/Window.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2025-12-11 19:54:43 +0100
committerGitHub <noreply@github.com>2025-12-11 18:54:43 +0000
commit75f6435f70dee8f8b685a02c52db7ba16f5db39c (patch)
treea70cac3821923d8eae827c82fb6d83629a036d3f /src/desktop/view/Window.cpp
parent5dd224805deb437f6fa83359ee66a4d0f52262d2 (diff)
window: only damage floating on clamped size change (#12633)
currently it damage the entire window if its floating and not x11 nor fullscreen meaning damage isnt working at all for floating. im tracing this back to a364df4 where the logic changed from damaging window only if size was being forced to now unconditonally doing it. change clampWindowSize to return as a bool if size changed and only damage window if it got clamped.
Diffstat (limited to 'src/desktop/view/Window.cpp')
-rw-r--r--src/desktop/view/Window.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp
index f8323540..b01dcabc 100644
--- a/src/desktop/view/Window.cpp
+++ b/src/desktop/view/Window.cpp
@@ -1197,14 +1197,19 @@ int CWindow::surfacesCount() {
return no;
}
-void CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize) {
+bool CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize) {
const Vector2D REALSIZE = m_realSize->goal();
const Vector2D MAX = isFullscreen() ? Vector2D{INFINITY, INFINITY} : maxSize.value_or(Vector2D{INFINITY, INFINITY});
const Vector2D NEWSIZE = REALSIZE.clamp(minSize.value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), MAX);
- const Vector2D DELTA = REALSIZE - NEWSIZE;
+ const bool changed = !(NEWSIZE == REALSIZE);
- *m_realPosition = m_realPosition->goal() + DELTA / 2.0;
- *m_realSize = NEWSIZE;
+ if (changed) {
+ const Vector2D DELTA = REALSIZE - NEWSIZE;
+ *m_realPosition = m_realPosition->goal() + DELTA / 2.0;
+ *m_realSize = NEWSIZE;
+ }
+
+ return changed;
}
bool CWindow::isFullscreen() {
@@ -2554,8 +2559,8 @@ void CWindow::commitWindow() {
const auto MINSIZE = m_xdgSurface->m_toplevel->layoutMinSize();
const auto MAXSIZE = m_xdgSurface->m_toplevel->layoutMaxSize();
- clampWindowSize(MINSIZE, MAXSIZE > Vector2D{1, 1} ? std::optional<Vector2D>{MAXSIZE} : std::nullopt);
- g_pHyprRenderer->damageWindow(m_self.lock());
+ if (clampWindowSize(MINSIZE, MAXSIZE > Vector2D{1, 1} ? std::optional<Vector2D>{MAXSIZE} : std::nullopt))
+ g_pHyprRenderer->damageWindow(m_self.lock());
}
if (!m_workspace->m_visible)