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 3307 - Shrinking the window does not send EXPOSE events
Summary: Shrinking the window does not send EXPOSE events
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All Windows (All)
: P2 minor
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-12 14:47 UTC by Ethan Lee
Modified: 2016-10-01 19:45 UTC (History)
0 users

See Also:


Attachments
Patch to add EXPOSE events to Windows RESIZED events (813 bytes, patch)
2016-04-12 14:47 UTC, Ethan Lee
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ethan Lee 2016-04-12 14:47:57 UTC
Created attachment 2409 [details]
Patch to add EXPOSE events to Windows RESIZED events

When expanding a window on Windows, along with RESIZED events you'll get an EXPOSED event, or a WM_PAINT event in Windows terms:

https://hg.libsdl.org/SDL/file/default/src/video/windows/SDL_windowsevents.c#l804

However, for whatever reason this only occurs with _expanding_ windows. Shrinking windows will not send such an event, or if it is, it's being occluded by the GetUpdateRect check.

This is in contrast to other backends like X11, where EXPOSE events are sent on any window resize.

For FNA's purposes we create our own WM_PAINT event by invalidating the whole window rect when a resize event is sent via the WndProc:

https://github.com/FNA-XNA/FNA/blob/master/src/SDL2/SDL2_FNAPlatform.cs#L1497

An event filter is used only because we need the event right away; on Windows events don't get pumped until the user has completely finished the resize action for whatever reason, so the filter lets us get the event right as they get sent to the queue and will consequently give us our EXPOSE event immediately after.

Attached is a patch to SDL that does what FNA does now, though I'd be interested in knowing if there's a "proper" way to get WM_PAINT events for shrinking windows.
Comment 1 Sam Lantinga 2016-10-01 19:45:21 UTC
Patch accepted, thanks!
https://hg.libsdl.org/SDL/rev/b307b3ebce7d