Home /Modules/ui/WINDOW-SIZE-LIMITS.md

WINDOW-SIZE-LIMITS.md

ui/WINDOW-SIZE-LIMITS.md · 46 line(s) · markdown

Native window minimum and maximum size

The SLeeLa native UI toolkit exposes pixel-based window size limits in the C ABI, SLVM built-ins, and the SLWindow standard-library wrapper.

Native C/C++ API

slui_window_set_min_size(window, width, height);
slui_window_set_max_size(window, width, height);
slui_window_set_size_limits(window, min_width, min_height, max_width, max_height);
slui_window_get_min_size(window, &size);
slui_window_get_max_size(window, &size);

Setters return SLUI_OK (0) on success or a negative SLUIStatus on error. Updates are validated atomically. Negative dimensions are rejected, and a maximum below the effective minimum is rejected. The automatic minimum includes the measured root content plus 10 px padding on every edge. A maximum width or height of 0 means that dimension is unbounded; setting all four values to zero restores automatic minimum sizing and an unbounded maximum.

SLeeLa built-ins

Built-inArgumentsResult
uiWindowSetMinSize(window, width, height)3 integersstatus
uiWindowSetMaxSize(window, width, height)3 integersstatus
uiWindowSetSizeLimits(window, minWidth, minHeight, maxWidth, maxHeight)5 integersstatus
uiWindowMinWidth(window) / uiWindowMinHeight(window)window handlepixels, or -1 on error
uiWindowMaxWidth(window) / uiWindowMaxHeight(window)window handlepixels; 0 means unbounded, -1 on error

SLWindow

SLWindow provides matching methods: setMinSize, setMaxSize, setSizeLimits, minWidth, minHeight, maxWidth, and maxHeight. The setters return the native status code; getter errors return -1.

Example and verification

Run demo/gui-window-size-limits.sleela on a desktop session to see the actual minimum and maximum read back and enforced during interactive resizing. In a headless environment it exits cleanly after confirming the built-ins are available at compile time. The native C API regression cases live in user-interface/tests/smoke.c.