From 2d3d6d47162fc68a54dfb89f2bbc330c3a42a906 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 28 Mar 2026 06:49:58 +0100 Subject: [PATCH] =?UTF-8?q?wayland:=20Phase=2047=20=E2=80=94=20prop=5Fget?= =?UTF-8?q?=5Fnormal=5Fhints=20from=20XDG=20toplevel=20constraints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement wl_prop_get_normal_hints: look up the wl_toplevel_view, read wlr_xdg_toplevel::current.{min,max}_{width,height} for WNH_P_MIN/MAX_SIZE flags, and report the current committed surface size as WNH_P_SIZE so wManageWindow/wClientGetNormalHints sees real constraints. Returns 1 if any flags were set, 0 if the view has no constraints. Co-Authored-By: Claude Sonnet 4.6 --- src/backend/wayland/wl_backend.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index c0a75fd..a69e845 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -30,6 +30,7 @@ * Phase 46: client_close vtable slot (wlr_xdg_toplevel_send_close); * title_listener updates wwin->wm_instance/wm_class on set_title signal; * wClientSendProtocol/wClientKill guarded for Wayland. + * Phase 47: prop_get_normal_hints returns XDG toplevel min/max/current size. */ #ifdef HAVE_CONFIG_H @@ -726,10 +727,34 @@ static void wl_event_randr_update(void *event) { (void)event; } static int wl_prop_get_normal_hints(WNativeWindow win, WNormalHints *out, int *pre_icccm) { - (void)win; + /* Phase 47: populate size constraints from XDG toplevel. */ + struct wl_toplevel_view *v = wl_find_view_by_id(win); memset(out, 0, sizeof(*out)); *pre_icccm = 0; - return 0; + if (!v || !v->xdg_surface || !v->xdg_surface->toplevel) + return 0; + struct wlr_xdg_toplevel *tl = v->xdg_surface->toplevel; + if (tl->current.min_width > 0 || tl->current.min_height > 0) { + out->flags |= WNH_P_MIN_SIZE; + out->min_width = (int)tl->current.min_width; + out->min_height = (int)tl->current.min_height; + } + if (tl->current.max_width > 0 || tl->current.max_height > 0) { + out->flags |= WNH_P_MAX_SIZE; + out->max_width = (int)tl->current.max_width; + out->max_height = (int)tl->current.max_height; + } + /* Report the current size as the base/initial size. */ + if (v->xdg_surface->surface) { + int w = v->xdg_surface->surface->current.width; + int h = v->xdg_surface->surface->current.height; + if (w > 0 && h > 0) { + out->flags |= WNH_P_SIZE; + out->width = w; + out->height = h; + } + } + return (out->flags != 0) ? 1 : 0; } static WWMHints *