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 4821 - No restore event is emitted after unminimize
Summary: No restore event is emitted after unminimize
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.10
Hardware: x86_64 Linux
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.12
Depends on:
Blocks:
 
Reported: 2019-10-08 19:59 UTC by ryven
Modified: 2019-12-04 05:56 UTC (History)
2 users (show)

See Also:


Attachments
Patch to fix the issue. (1.17 KB, patch)
2019-12-02 15:47 UTC, Alex Smith
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ryven 2019-10-08 19:59:13 UTC
At least on X11, no SDL_WINDOWEVENT_RESTORED event is emitted after the window was unminimized.

This was caused by this commit:
https://github.com/SDL-mirror/SDL/commit/abcfcda0fcc3cdfac632077492b91041acd8890d

Reason:
In X11_DispathEvent on PropertyNotify on _NET_WM_STATE property change, if unminimized is happens, X11_DispatchMapNotify is called:
https://github.com/SDL-mirror/SDL/blob/master/src/video/x11/SDL_x11events.c#L1295 

X11_DispatchMapNotify tries to emit two events: 
* first SDL_SendWindowEvent(SDL_WINDOWEVENT_SHOWN) which resets the minimized flag (see commit),
* then SDL_SendWindowEvent(SDL_WINDOWEVENT_RESTORED) which expects minimized flag set, but it was reset by previous SHOWN event and hence it bails out not emitting RESTORED event:
https://github.com/SDL-mirror/SDL/blob/master/src/events/SDL_windowevents.c#L142
Comment 1 Alex Smith 2019-12-02 15:46:31 UTC
I ran into this issue today. The attached patch fixes it for me.
Comment 2 Alex Smith 2019-12-02 15:47:05 UTC
Created attachment 4085 [details]
Patch to fix the issue.
Comment 3 Sam Lantinga 2019-12-04 05:56:19 UTC
Looks good, thanks!
https://hg.libsdl.org/SDL/rev/81ca537d1287