| Summary: | SDL_RestoreWindow() does not restore the window after SDL_MinimizeWindow() | ||
|---|---|---|---|
| Product: | SDL | Reporter: | nikolay.p |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | patch for SDL_RestoreWindow() | ||
|
Description
nikolay.p
2017-01-19 00:15:03 UTC
Under Linux, what's supposed to happen is that SDL_MinimizeWindow() calls XIconifyWindow(), and then we get an UnmapNotify event, which sends an SDL_WINDOWEVENT_MINIMIZED event. What's happening in your case? Could you please point out a place in code where: 1) XIconifyWindow() is being called by SDL_MinimizeWindow() 2) SDL receives UnmapNotify and generates SDL_WINDOWEVENT_MINIMIZED event Then I will be able to add some debug code and run few tests in order to see what is (not) occurring. SDL_MinimizeWindow() calls X11_MinimizeWindow() in SDL_x11window.c UnmapNotify is handled in SDL_x11events.c You may want to define DEBUG_XEVENTS at the top of SDL_x11events.c to show what's happening. This is what I get after creating a window, rendering picture on it and calling:
SDL_MinimizeWindow(window); (Window disappears)
SDL_RestoreWindow(window); (Window does not appear)
SDL_MinimizeWindow(window);
SDL_RestoreWindow(window);
window 0x1444eb0: PropertyNotify: XdndAware changed time=1039088932
{ BITMAP }
window 0x1444eb0: PropertyNotify: WM_NAME changed time=1039088932
{ "SDL_Window" }
window 0x1444eb0: PropertyNotify: _NET_WM_NAME changed time=1039088932
{ "SDL_Window" }
window 0x1444eb0: PropertyNotify: _KDE_NET_WM_USER_CREATION_TIME changed time=1039088933
{ 1039088932 }
window 0x1444eb0: PropertyNotify: WM_NORMAL_HINTS changed time=1039101789
Unknown type: 41 (WM_SIZE_HINTS)
window 0x1444eb0: ConfigureNotify! (position: 0,0, size: 160x90)
window 0x1444eb0: ConfigureNotify! (position: 1760,990, size: 160x90)
window 0x1444eb0: Unhandled event 21
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101791
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101791
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101791
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: PropertyNotify: _NET_WM_DESKTOP changed time=1039101792
{ 0 }
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101792
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: Expose (count = 0)
window 0x1444eb0: PropertyNotify: WM_STATE changed time=1039101795
Unknown type: 296 (WM_STATE)
window 0x1444eb0: PropertyNotify: _NET_WM_DESKTOP changed time=1039101795
{ 0 }
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101795
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: PropertyNotify: _NET_WM_ALLOWED_ACTIONS changed time=1039101795
{ _NET_WM_ACTION_MOVE _NET_WM_ACTION_MINIMIZE _NET_WM_ACTION_CHANGE_DESKTOP _NET_WM_ACTION_CLOSE }
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101797
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101797
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: ConfigureNotify! (position: 1760,950, size: 160x90)
window 0x1444eb0: PropertyNotify: _KDE_NET_WM_ACTIVITIES changed time=1039101801
{ "00000000-0000-0000-0000-000000000000" }
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039101801
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: Expose (count = 0)
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039102793
{ _NET_WM_STATE_HIDDEN _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: UnmapNotify!
window 0x1444eb0: PropertyNotify: WM_STATE changed time=1039102796
Unknown type: 296 (WM_STATE)
window 0x1444eb0: ConfigureNotify! (position: 1760,950, size: 160x90)
window 0x1444eb0: ConfigureNotify! (position: 1760,950, size: 160x90)
window 0x1444eb0: ConfigureNotify! (position: 1760,950, size: 160x90)
window 0x1444eb0: PropertyNotify: _NET_WM_STATE changed time=1039103795
{ _NET_WM_STATE_DEMANDS_ATTENTION _NET_WM_STATE_ABOVE _NET_WM_STATE_STAYS_ON_TOP _NET_WM_STATE_SKIP_TASKBAR _NET_WM_STATE_SKIP_PAGER }
window 0x1444eb0: Expose (count = 0)
window 0x1444eb0: PropertyNotify: WM_STATE changed time=1039103799
Unknown type: 296 (WM_STATE)
window 0x1444eb0: EnterNotify! (155,44,2)
Mode: NotifyUngrab
window 0x1444eb0: Expose (count = 0)
window 0x1444eb0: LeaveNotify! (-12,51,0)
Oh, out of curiosity, does it work if you add a call to SDL_PumpEvents() between the call to minimize and then restore? It works now. The errors were in my code. There are two things I got wrong: Was not calling any functions that handle events until you mentioned events. After I fixed that it still did not work because I did not properly render the window, therefore it was not visible to me. Now it is resolved. Thank you for help! You're welcome! :) |