# SetWindowMaximumSize bug?

**URL:** <https://discourse.libsdl.org/t/setwindowmaximumsize-bug/28267>\
**Category:** SDL Development\
**Created:** [October 19, 2020, 12:24pm UTC](https://discourse.libsdl.org/t/setwindowmaximumsize-bug/28267 "2020-10-19T12:24:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![batyastudios](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@batyastudios](https://discourse.libsdl.org/u/batyastudios)\
**Post date:** [October 19, 2020, 12:24pm UTC](https://discourse.libsdl.org/t/setwindowmaximumsize-bug/28267/1 "2020-10-19T12:24:42Z")

</div>

I’am writing some terminal program of sorts. The thing is i want window to be resisizable only by Y direction. So I went ahead and did:  
SDL\_SetWindowMinimumSize(wnd, 100, 100);  
SDL\_SetWindowMaximumSize(wnd, 100, 200);  
But this applies only minimum size. I can still resize window as big as i want.  
But if I do this:  
SDL\_SetWindowMinimumSize(wnd, 100, 100);  
SDL\_SetWindowMaximumSize(wnd, 101, 200);  
It kinda works, but looks a bit off. Is this normal behavior? Is this a known bug?  
I’am using Windows and SDL 2.0.9.  
Cheers

---

<div class="post-metadata">

**Author:** ![batyastudios](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@batyastudios](https://discourse.libsdl.org/u/batyastudios)\
**Post date:** [October 20, 2020, 4:25pm UTC](https://discourse.libsdl.org/t/setwindowmaximumsize-bug/28267/2 "2020-10-20T16:25:27Z")

</div>

Looks like it is indeed bug for me:

> SDL\_SetWindowMaximumSize(SDL\_Window \* window, int max\_w, int max\_h)  
> . . .  
> if (max\_w \<= window-\>min\_w || max\_h \<= window-\>min\_h) {  
> SDL\_SetError(“SDL\_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size”);  
> return;  
> }  
> . . .  
> }

There is no need in equals signs in this condition. Anyway i did some workaround based on SDL\_Window definition:

> SDL\_SetWindowMinimumSize(wnd, 100, 100);  
> //SDL\_SetWindowMaximumSize(wnd, 100, 200);  
> int hack = (int \*)wnd;
> 
> hack[10] = 100; // w  
> hack[11] = 200; // h

I know that this is very dangerous(not portable, version and compiler dependant) but I need the fix. I’am going to file this one as a bug to bugtracker.  
Cheers
