diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-09 12:54:28 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-10 06:29:31 +0300 |
commit | c2b767db9385db0aedb1311f4212e7f4aa9441ec (patch) | |
tree | 2be7367af6568890b27719ff02adedf0b6365266 | |
parent | 033050c5077ebcb02dd9f03ee2747284e1a0c5cf (diff) |
Mobile: Freeze UI draws when app hidden
Maybe a workaround for the squished view issue?
-rw-r--r-- | src/app.c | 1 | ||||
-rw-r--r-- | src/ui/window.c | 5 |
2 files changed, 5 insertions, 1 deletions
@@ -936,6 +936,7 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
936 | break; | 936 | break; |
937 | case SDL_APP_WILLENTERBACKGROUND: | 937 | case SDL_APP_WILLENTERBACKGROUND: |
938 | case SDL_APP_TERMINATING: | 938 | case SDL_APP_TERMINATING: |
939 | setFreezeDraw_Window(d->window, iTrue); | ||
939 | savePrefs_App_(d); | 940 | savePrefs_App_(d); |
940 | saveState_App_(d); | 941 | saveState_App_(d); |
941 | break; | 942 | break; |
diff --git a/src/ui/window.c b/src/ui/window.c index 032d68d1..aa854c72 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -1755,11 +1755,14 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
1755 | d->isExposed = iTrue; /* no expose event is sent, so now we know it's visible */ | 1755 | d->isExposed = iTrue; /* no expose event is sent, so now we know it's visible */ |
1756 | /* Returned to foreground, may have lost buffered content. */ | 1756 | /* Returned to foreground, may have lost buffered content. */ |
1757 | invalidate_Window_(d); | 1757 | invalidate_Window_(d); |
1758 | postRefresh_App(); | 1758 | postCommand_App("window.unfreeze"); |
1759 | #endif | 1759 | #endif |
1760 | return iFalse; | 1760 | return iFalse; |
1761 | case SDL_WINDOWEVENT_FOCUS_LOST: | 1761 | case SDL_WINDOWEVENT_FOCUS_LOST: |
1762 | postCommand_App("window.focus.lost"); | 1762 | postCommand_App("window.focus.lost"); |
1763 | #if defined (iPlatformMobile) | ||
1764 | setFreezeDraw_Window(d, iTrue); | ||
1765 | #endif | ||
1763 | return iFalse; | 1766 | return iFalse; |
1764 | case SDL_WINDOWEVENT_TAKE_FOCUS: | 1767 | case SDL_WINDOWEVENT_TAKE_FOCUS: |
1765 | SDL_SetWindowInputFocus(d->win); | 1768 | SDL_SetWindowInputFocus(d->win); |