Feature request: ability to control window size while stretching

As far as I know, SDL3 doesn’t provide the ability to control the position and size of a window while resizing it. Many people need something like this and complain about the lack of such a feature — myself included. :wink:

The Win32 API has messages for this, delivered to the window procedure. The main ones are the WM_SIZING and WM_WINDOWPOSCHANGING messages, which provide information about which window edge is being resized, as well as a pointer to the window area structure, which can be modified on the application side to control the process of stretching or moving the window.

Random usage example: Maintain Aspect Ratio in Windows API.

Something like this could be implemented as a simple callback that would allow manipulation of the window area. SDL has long supported a hit test callback, SDL_HitTest, which can be registered with SDL_SetWindowHitTest. Why shouldn’t we have a callback to the window size control?

@slouken, @icculus: what do you think about it?

Edit: a long time ago I’ve checked this workaround and it works but still, this is harder to use and not portable. A dedicated callback would be much more friendly to the SDL users.

If you need precise control, the workaround you describe is still the best way to handle it. However, if you just want to maintain aspect ratio, check out the SDL_SetWindowAspectRatio() function in SDL3!

1 Like

That’s right, I mean precise control — not only the aspect ratio (window size) but also window position. It can be simplified to receive new window rect and just alter it before OS send it to the application (platform independent, at least for desktop platforms).

Nice try! :wink: