wayland: Phase 47 — prop_get_normal_hints from XDG toplevel constraints

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 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-28 06:49:58 +01:00
parent fc0e233865
commit 2d3d6d4716
1 changed files with 27 additions and 2 deletions

View File

@ -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 *