From cc14dd1baf69c01aede38572a0843e03bfdea5e0 Mon Sep 17 00:00:00 2001 From: Skidam <67871298+Skidamek@users.noreply.github.com> Date: Thu, 26 Feb 2026 17:42:49 +0100 Subject: [PATCH] xwayland: validate size hints before floating (#13361) --- hyprtester/src/tests/main/window.cpp | 8 ++++---- src/managers/XWaylandManager.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hyprtester/src/tests/main/window.cpp b/hyprtester/src/tests/main/window.cpp index 9adb8120..38f8ec48 100644 --- a/hyprtester/src/tests/main/window.cpp +++ b/hyprtester/src/tests/main/window.cpp @@ -679,14 +679,14 @@ static bool test() { EXPECT(Tests::windowCount(), 3); NLog::log("{}Checking props of xeyes", Colors::YELLOW); - // check some window props of xeyes, try to tile them + // check some window props of xeyes, try to float it { auto str = getFromSocket("/clients"); - EXPECT_CONTAINS(str, "floating: 1"); - getFromSocket("/dispatch settiled class:XEyes"); + EXPECT_NOT_CONTAINS(str, "floating: 1"); + getFromSocket("/dispatch setfloating class:XEyes"); std::this_thread::sleep_for(std::chrono::milliseconds(200)); str = getFromSocket("/clients"); - EXPECT_NOT_CONTAINS(str, "floating: 1"); + EXPECT_CONTAINS(str, "floating: 1"); } // kill all diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 2b4c2fee..1fca293a 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -129,7 +129,8 @@ bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) { const auto SIZEHINTS = pWindow->m_xwaylandSurface->m_sizeHints.get(); if (pWindow->m_xwaylandSurface->m_transient || pWindow->m_xwaylandSurface->m_parent || - (SIZEHINTS && (SIZEHINTS->min_width == SIZEHINTS->max_width) && (SIZEHINTS->min_height == SIZEHINTS->max_height))) + (SIZEHINTS && SIZEHINTS->min_width > 0 && SIZEHINTS->min_height > 0 && SIZEHINTS->max_width > 0 && SIZEHINTS->max_height > 0 && + (SIZEHINTS->min_width == SIZEHINTS->max_width) && (SIZEHINTS->min_height == SIZEHINTS->max_height))) return true; } else { if (!pWindow->m_xdgSurface || !pWindow->m_xdgSurface->m_toplevel)