al_apply_window_constraints(3alleg5)
β¨ al_apply_window_constraints β¨
okay bestie, welcome to the Allegro 5 API reference manual β yes, that's the manual name, and yes, this page is literally all about one tiny function that decides whether your window is allowed to vibe however it wants or has to stay inside its little box. π
πΈ NAME πΈ
al_apply_window_constraints β the Allegro 5 API function that flips your window constraints on and off π
π¦ SYNOPSIS π¦
#include <allegro5/allegro.h>
void al_apply_window_constraints(ALLEGRO_DISPLAY *display, bool onoff)
no cap, that's the whole signature. two args. she's simple, she's iconic. π
π DESCRIPTION π
So here's the tea: this function enables or disables constraints that you already set earlier with al_set_window_constraints(3alleg5). It doesn't set them, bestie β it just turns them on or off like a light switch. Don't get it twisted. π«Ά
If you enable them (aka pass onoff as true), the display you specified will automatically get resized to new sizes to conform to those constraints in the following cases:
- The specified display is resizable, is not maximized, and is not in fullscreen mode. β¨
- If the appropriate current display size (width or height) is less than the value of the constraint β this one applies to the minimum constraints. π
- If the appropriate current display size (width or height) is greater than the value of the constraint β and this one applies to the maximum constraints. π
Now, the important caveat, and I need you to hear me on this one: constraints are NOT applied when a display is toggled from windowed to maximized or fullscreen modes. Like, it just doesn't happen. Not the vibe.
But when a display gets toggled from maximized/fullscreen back to windowed mode? Then yeah, the display may be resized as described above. π And that later case is also possible when a user drags the maximized display around via mouse. π±οΈ main character energy from the user, honestly.
If you disable it instead, the specified display will stop using constraints. Periodt. That's it, she's free. π¦
π SEE ALSO π
and that's the whole page, bestie!! π this came to you from the Allegro reference manual, al_apply_window_constraints(3alleg5) β go forth and constrain responsibly. mwah. πβ¨πΈ
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms