diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-03 10:06:14 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-03 10:06:14 +0200 |
commit | ec8b1b0d82d5703a513e3eba94ba1a2cc55ed760 (patch) | |
tree | e4a02e0d5db0fd38167e7e3e83d6d38f00ec8856 /src/ui | |
parent | 99ae8d71d5a302c2812e3b469953eaf71f5a6654 (diff) |
Window: Fixed invalid contents are restoring in fullscreen mode
When the window was put in the background in fullscreen mode and then
restored to foreground, buffered contents were lost.
IssueID #130
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/window.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 6d697e88..4b05d891 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -831,6 +831,11 @@ iBool isFullscreen_Window(const iWindow *d) { | |||
831 | return (SDL_GetWindowFlags(d->win) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0; | 831 | return (SDL_GetWindowFlags(d->win) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0; |
832 | } | 832 | } |
833 | 833 | ||
834 | static void invalidate_Window_(iWindow *d) { | ||
835 | resetFonts_Text(); | ||
836 | postCommand_App("theme.changed"); /* forces UI invalidation */ | ||
837 | } | ||
838 | |||
834 | static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | 839 | static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { |
835 | switch (ev->event) { | 840 | switch (ev->event) { |
836 | case SDL_WINDOWEVENT_EXPOSED: | 841 | case SDL_WINDOWEVENT_EXPOSED: |
@@ -865,6 +870,9 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
865 | } | 870 | } |
866 | updateRootSize_Window_(d, iTrue /* we were already redrawing during the resize */); | 871 | updateRootSize_Window_(d, iTrue /* we were already redrawing during the resize */); |
867 | return iTrue; | 872 | return iTrue; |
873 | case SDL_WINDOWEVENT_RESTORED: | ||
874 | invalidate_Window_(d); | ||
875 | return iTrue; | ||
868 | case SDL_WINDOWEVENT_LEAVE: | 876 | case SDL_WINDOWEVENT_LEAVE: |
869 | unhover_Widget(); | 877 | unhover_Widget(); |
870 | d->isMouseInside = iFalse; | 878 | d->isMouseInside = iFalse; |
@@ -904,8 +912,7 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { | |||
904 | } | 912 | } |
905 | case SDL_RENDER_TARGETS_RESET: | 913 | case SDL_RENDER_TARGETS_RESET: |
906 | case SDL_RENDER_DEVICE_RESET: { | 914 | case SDL_RENDER_DEVICE_RESET: { |
907 | resetFonts_Text(); | 915 | invalidate_Window_(d); |
908 | postCommand_App("theme.changed"); /* forces UI invalidation */ | ||
909 | break; | 916 | break; |
910 | } | 917 | } |
911 | default: { | 918 | default: { |