diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 12:33:10 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 15:01:13 +0300 |
commit | 58b4bbc5e92d4eb64da507d44fe5bbc9f535eee5 (patch) | |
tree | 299660bced2fb0b174e2d4f4c16c7d3aa8dcb8d9 /src/ui | |
parent | 538f0fe2433344184f8c6c9435334a0e475fdcc6 (diff) |
App: Attempt to fix app restore issue
Cached content like font glyphs are (were?) not being restored when returning to foreground.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/window.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 5bf2aa53..252b3bdb 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -566,14 +566,18 @@ iRoot *otherRoot_Window(const iWindow *d, iRoot *root) { | |||
566 | return root == d->roots[0] && d->roots[1] ? d->roots[1] : d->roots[0]; | 566 | return root == d->roots[0] && d->roots[1] ? d->roots[1] : d->roots[0]; |
567 | } | 567 | } |
568 | 568 | ||
569 | void invalidate_Window(iWindow *d) { | 569 | static void invalidate_Window_(iWindow *d, iBool forced) { |
570 | if (d && !d->isInvalidated) { | 570 | if (d && (!d->isInvalidated || forced)) { |
571 | d->isInvalidated = iTrue; | 571 | d->isInvalidated = iTrue; |
572 | resetFonts_Text(); | 572 | resetFonts_Text(); |
573 | postCommand_App("theme.changed auto:1"); /* forces UI invalidation */ | 573 | postCommand_App("theme.changed auto:1"); /* forces UI invalidation */ |
574 | } | 574 | } |
575 | } | 575 | } |
576 | 576 | ||
577 | void invalidate_Window(iWindow *d) { | ||
578 | invalidate_Window_(d, iFalse); | ||
579 | } | ||
580 | |||
577 | static iBool isNormalPlacement_Window_(const iWindow *d) { | 581 | static iBool isNormalPlacement_Window_(const iWindow *d) { |
578 | if (d->isDrawFrozen) return iFalse; | 582 | if (d->isDrawFrozen) return iFalse; |
579 | #if defined (iPlatformApple) | 583 | #if defined (iPlatformApple) |
@@ -741,14 +745,14 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
741 | return iTrue; | 745 | return iTrue; |
742 | case SDL_WINDOWEVENT_RESTORED: | 746 | case SDL_WINDOWEVENT_RESTORED: |
743 | updateSize_Window_(d, iTrue); | 747 | updateSize_Window_(d, iTrue); |
744 | invalidate_Window(d); | 748 | invalidate_Window_(d, iTrue); |
745 | d->isMinimized = iFalse; | 749 | d->isMinimized = iFalse; |
746 | postRefresh_App(); | 750 | postRefresh_App(); |
747 | return iTrue; | 751 | return iTrue; |
748 | case SDL_WINDOWEVENT_MINIMIZED: | 752 | case SDL_WINDOWEVENT_MINIMIZED: |
749 | d->isMinimized = iTrue; | 753 | d->isMinimized = iTrue; |
750 | return iTrue; | 754 | return iTrue; |
751 | #endif | 755 | #endif /* defined (iPlatformDesktop) */ |
752 | case SDL_WINDOWEVENT_LEAVE: | 756 | case SDL_WINDOWEVENT_LEAVE: |
753 | unhover_Widget(); | 757 | unhover_Widget(); |
754 | d->isMouseInside = iFalse; | 758 | d->isMouseInside = iFalse; |
@@ -772,7 +776,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
772 | d->isExposed = iTrue; | 776 | d->isExposed = iTrue; |
773 | #if defined (iPlatformMobile) | 777 | #if defined (iPlatformMobile) |
774 | /* Returned to foreground, may have lost buffered content. */ | 778 | /* Returned to foreground, may have lost buffered content. */ |
775 | invalidate_Window(d); | 779 | invalidate_Window_(d, iTrue); |
776 | postCommand_App("window.unfreeze"); | 780 | postCommand_App("window.unfreeze"); |
777 | #endif | 781 | #endif |
778 | return iFalse; | 782 | return iFalse; |