From 3337bc110bb4047c678e069af65d4e41d3e5a5b8 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sun, 24 May 2026 17:22:53 +0200 Subject: [PATCH] WINGs: implement XDG toplevel min/max size to prevent resize WMSetWindowMinSize/MaxSize were no-ops on Wayland. Implement wl_window_set_geometry to call xdg_toplevel_set_min_size/max_size. WPrefs sets min=max=520x390, making it non-resizable. --- WINGs/wclient_wl.c | 16 ++++++++++++++++ WINGs/wview_wl.c | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/WINGs/wclient_wl.c b/WINGs/wclient_wl.c index 96aebb9..e3af02b 100644 --- a/WINGs/wclient_wl.c +++ b/WINGs/wclient_wl.c @@ -33,6 +33,8 @@ #include +#include "wwindow_p.h" + #include #include "xdg-shell-client-protocol.h" @@ -494,6 +496,20 @@ wl_client_toplevel_destroy(struct W_View *view) wl_client_view_destroy_backing((unsigned long)view->window); } +void +W_WLClientSetMinMaxSize(W_View *view) +{ + WLClientToplevel *top = wlc_top_find((WNativeWindow)view->window); + if (!top || !top->xdg_toplevel) return; + struct W_Window *win = (struct W_Window *)view->self; + if (!win) return; + xdg_toplevel_set_min_size(top->xdg_toplevel, + win->minSize.width, win->minSize.height); + xdg_toplevel_set_max_size(top->xdg_toplevel, + win->maxSize.width, win->maxSize.height); + wl_surface_commit(top->surface); +} + /* ------------------------------------------------------------------ */ /* Input: wl_pointer / wl_keyboard listeners */ /* ------------------------------------------------------------------ */ diff --git a/WINGs/wview_wl.c b/WINGs/wview_wl.c index 2bf7984..dbf04a1 100644 --- a/WINGs/wview_wl.c +++ b/WINGs/wview_wl.c @@ -687,7 +687,10 @@ static void wl_window_realize(void *vctx, W_View *view, const char *name, static void wl_window_set_geometry(void *vctx, W_View *view) { - (void)vctx; (void)view; + (void)vctx; + if (!view || !view->flags.topLevel) return; + extern void W_WLClientSetMinMaxSize(W_View *view); + W_WLClientSetMinMaxSize(view); } static void wl_window_withdraw(void *vctx, W_View *view)