From 4055d5b3012d6e0cbee965f2d1aa53caf991fd4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Tue, 18 May 2021 12:33:10 +0300
Subject: [PATCH 1/1] App: Attempt to fix app restore issue
Cached content like font glyphs are (were?) not being restored when returning to foreground.
src/app.c | 3 +++
src/ui/window.c | 25 ++++++++++++++++---------
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/app.c b/src/app.c
index 3b6752de..555206a9 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1000,6 +1000,9 @@ void processEvents_App(enum iAppEventMode eventMode) {
case SDL_APP_LOWMEMORY:
clearCache_App_();
break;
case SDL_APP_WILLENTERFOREGROUND:
invalidate_Window(d->window);
break;
case SDL_APP_DIDENTERFOREGROUND:
gotEvents = iTrue;
d->warmupFrames = 5;
diff --git a/src/ui/window.c b/src/ui/window.c
index 22cf1fb0..cd8f2e12 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -515,15 +515,15 @@ void init_Window(iWindow *d, iRect rect) {
void deinit_Window(iWindow *d) {
iRecycle();
theWindow_ = NULL;
iForIndices(i, d->roots) {
if (d->roots[i]) {
setCurrent_Root(d->roots[i]);
deinit_Root(d->roots[i]);
}
}
theWindow_ = NULL;
setCurrent_Root(NULL);
delete_String(d->pendingSplitUrl);
deinit_Text();
@@ -566,14 +566,18 @@ iRoot *otherRoot_Window(const iWindow *d, iRoot *root) {
return root == d->roots[0] && d->roots[1] ? d->roots[1] : d->roots[0];
}
-void invalidate_Window(iWindow *d) {
+static void invalidate_Window_(iWindow *d, iBool forced) {
d->isInvalidated = iTrue;
resetFonts_Text();
postCommand_App("theme.changed auto:1"); /* forces UI invalidation */
}
}
+void invalidate_Window(iWindow *d) {
+}
static iBool isNormalPlacement_Window_(const iWindow *d) {
if (d->isDrawFrozen) return iFalse;
#if defined (iPlatformApple)
@@ -741,14 +745,14 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
return iTrue;
case SDL_WINDOWEVENT_RESTORED:
updateSize_Window_(d, iTrue);
invalidate_Window(d);
invalidate_Window_(d, iTrue);
d->isMinimized = iFalse;
postRefresh_App();
return iTrue;
case SDL_WINDOWEVENT_MINIMIZED:
d->isMinimized = iTrue;
return iTrue;
-#endif
+#endif /* defined (iPlatformDesktop) */
case SDL_WINDOWEVENT_LEAVE:
unhover_Widget();
d->isMouseInside = iFalse;
@@ -772,7 +776,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
d->isExposed = iTrue;
#if defined (iPlatformMobile)
/* Returned to foreground, may have lost buffered content. */
invalidate_Window_(d);
invalidate_Window_(d, iTrue);
postCommand_App("window.unfreeze");
#endif
return iFalse;
@@ -1023,7 +1027,10 @@ void draw_Window(iWindow *d) {
/* Clear the window. The clear color is visible as a border around the window
when the custom frame is being used. */ {
#if defined (iPlatformAppleMobile)
const iColor back = get_Color(tmBackground_ColorId);
iColor back = get_Color(uiBackground_ColorId);
if (deviceType_App() == phone_AppDeviceType) {
/* Page background extends to safe area, so fill it completely. */
back = get_Color(tmBackground_ColorId);
#else
const iColor back = get_Color(gotFocus && d->place.snap != maximized_WindowSnap &&
~winFlags & SDL_WINDOW_FULLSCREEN_DESKTOP
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).