Ok, I tested my hypothesis and yes, the method I described works great.
To be able to control the window proportions while stretching and at the same time avoid the window flickering problem, you need to watch system events and handle the WM_SIZING event. The win.lParam field of the event structure contains a pointer to the RECT structure, so to affect the size of the window that SDL will receive and that will be passed in the SDL_WINDOWEVENT_RESIZED event, you must modify the data of the structure pointed to by win.lParam.
There are a few things to keep in mind:
- system events are disabled by default and are not queued by SDL, so to unlock them, use the SDL_EventState function.
- queuing system events adds processing time overhead (by SDL and the application), so performance will suffer somewhat.
- the above applies to the Windows platform, so a separate handler must be programmed for other platforms.
So, if you want to deliver a high-quality solution, you have to work a little harder.