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 *