We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3198 - SDL_SetWindowSize oddness
Summary: SDL_SetWindowSize oddness
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.2
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-03 22:32 UTC by Solra Bizna
Modified: 2017-08-12 22:04 UTC (History)
0 users

See Also:


Attachments
Test program demonstrating the problem, written in C99 (3.81 KB, text/x-csrc)
2015-12-03 22:32 UTC, Solra Bizna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Solra Bizna 2015-12-03 22:32:46 UTC
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.
Comment 1 Solra Bizna 2016-01-03 14:36:05 UTC
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...