xwayland: respect window size set by configure requests (#9190)

This commit is contained in:
DDoSolitary
2025-01-28 18:04:57 +08:00
committed by Vaxry
parent 017f322532
commit 56540f5bd8
2 changed files with 5 additions and 25 deletions

View File

@@ -82,29 +82,9 @@ CBox CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow) {
CBox box;
if (pWindow->m_bIsX11) {
const auto SIZEHINTS = pWindow->m_pXWaylandSurface->sizeHints.get();
if (SIZEHINTS && !pWindow->isX11OverrideRedirect()) {
// WM_SIZE_HINTS' x,y,w,h is deprecated it seems.
// Source: https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#wm_normal_hints_property
box.x = pWindow->m_pXWaylandSurface->geometry.x;
box.y = pWindow->m_pXWaylandSurface->geometry.y;
constexpr int ICCCM_USSize = 0x2;
constexpr int ICCCM_PSize = 0x8;
if ((SIZEHINTS->flags & ICCCM_USSize) || (SIZEHINTS->flags & ICCCM_PSize)) {
box.w = SIZEHINTS->base_width;
box.h = SIZEHINTS->base_height;
} else {
box.w = pWindow->m_pXWaylandSurface->geometry.w;
box.h = pWindow->m_pXWaylandSurface->geometry.h;
}
} else
box = pWindow->m_pXWaylandSurface->geometry;
} else if (pWindow->m_pXDGSurface)
if (pWindow->m_bIsX11)
box = pWindow->m_pXWaylandSurface->geometry;
else if (pWindow->m_pXDGSurface)
box = pWindow->m_pXDGSurface->current.geometry;
return box;

View File

@@ -102,8 +102,8 @@ void CXWM::handleMapRequest(xcb_map_request_event_t* e) {
const bool HAS_HINTS = XSURF->sizeHints && Vector2D{XSURF->sizeHints->base_width, XSURF->sizeHints->base_height} > Vector2D{5, 5};
const auto DESIREDSIZE = HAS_HINTS ? Vector2D{XSURF->sizeHints->base_width, XSURF->sizeHints->base_height} : Vector2D{800, 800};
// if it's too small, or its base size is set, configure it.
if ((SMALL || HAS_HINTS) && !XSURF->overrideRedirect) // default to 800 x 800
// if it's too small, configure it.
if (SMALL && !XSURF->overrideRedirect) // default to 800 x 800
XSURF->configure({XSURF->geometry.pos(), DESIREDSIZE});
Debug::log(LOG, "[xwm] Mapping window {} in X (geometry {}x{} at {}x{}))", e->window, XSURF->geometry.width, XSURF->geometry.height, XSURF->geometry.x, XSURF->geometry.y);