| Summary: | SDL_SetWindowSize oddness | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Solra Bizna <solrabizna> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.2 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | Test program demonstrating the problem, written in C99 | ||
Upon testing with different renderers, I have found that SDL_WINDOWEVENT_EXPOSED is not always generated on calling SDL_SetWindowSize. My more universal workaround now also involves explicitly pushing an SDL_WINDOWEVENT_EXPOSED event after calling SDL_SetWindowSize. Blech... |
Created attachment 2326 [details] Test program demonstrating the problem, written in C99 When I change a window's size with SDL_SetWindowSize, and subsequently make SDL_Render* calls without processing events, the renderer gives incorrect output. It continues to give incorrect output until the SDL_WINDOWEVENT_EXPOSED event generated by the call is _received_. I have attached a program that demonstrates the problem. I'm running on Linux, under X11, using Sawfish (a non-compositing window manager). The test program reports that the OpenGL renderer is being used. The test program doesn't reflect this, but I tried combinations of SDL_RenderSetLogicalSize / SDL_RenderSetViewport and every similar function I could find with no effect. If you change the "#if 0" on line 27 to "#if 1", it repeats Clear+Copy+Present every time a SDL_WINDOWEVENT_EXPOSED event is received, and the glitches effectively disappear. It also, however, hits a much less serious bug, in that an excessive number of SDL_WINDOWEVENT_EXPOSED events are generated. (A "good" event loop will defer actually rendering until SDL_PollEvent returns 0, which makes that bug unimportant to me.) It is possible that this is not a bug, in which case the actual bug is in the documentation for SDL_SetWindowSize. It can be worked around completely by not rendering between calling SDL_SetWindowSize and receiving the corresponding SDL_WINDOWEVENT_EXPOSED event.