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.
This commit is contained in:
parent
b4dbf15817
commit
3337bc110b
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include <wraster.h>
|
||||
|
||||
#include "wwindow_p.h"
|
||||
|
||||
#include <wayland-client.h>
|
||||
#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 */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue