| Summary: | SDL_SetWindowMinimumSize having no effect before creating renderer (same with SDL_SetWindowMaximumSize) | ||
|---|---|---|---|
| Product: | SDL | Reporter: | ny00 |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | NEW --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | galtgendo |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | Test cases | ||
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though! I think I see a related problem. This seems to be a case of unintended side-effects, that are beneficial here. SDL_WINDOW_OPENGL is the flag that has those side-effects. Another test would be to create a FULLSCREEN_DESKTOP window smaller than the desktop. If you unset fullscreen, the window will still have the size of the desktop. If SDL_WINDOW_OPENGL is set, once again, the window is restored to its expected size. |
Created attachment 1594 [details] Test cases A window can be resized to out-ot-bounds dimensions even if any of SDL_SetWindowMinimumSize and SDL_SetWindowMaximumSize is called, given the following steps are done in the given order: - First, the window is created without the SDL_WINDOW_OPENGL flag set. - Then SDL_SetWindowMinimumSize and/or SDL_SetWindowMaximumSize are/is called. - Afterwards a new renderer is created. Sample code is attached with a test case. By playing with a few definitions given at the top of the code you can generate a few more tests: - Manage a GL context directly (SDL_GL_CreateContext) or access an SDL 1.2 style window surface (SDL_GetWindowSurface), rather than using a renderer (SDL_CreateRenderer). - Set window bounds after calling any of these (say SDL_CreateRenderer) rather than before. - Optionally add SDL_WINDOW_OPENGL as a flag on window creation. A few gotchas that should be added for the various cases: - An OpenGL context cannot be created without SDL_WINDOW_OPENGL. I have added a compile-time error shown upon an attempt to do so. - If the window bounds are set *after* the call to SDL_GetWindowSurface, then the surface gets invalidated and a new surface should be retrieved again (I suppose that's the expected behavior). - As in the case of SDL_CreateRenderer, if the bounds are set before the (only) call to SDL_GetWindowSurface then the window can be resized to out-of-bounds dimensions. In addition: - If the hint SDL_HINT_RENDER_DRIVER is set to "software" *before* the call to SDL_Hint is done (say by setting the environment variable SDL_RENDER_DRIVER to the same value), then the bounds hold (with the same code as originally attached to this bug report). - The latter point applies if a window surface is used, too.