Skip to content

Commit

Permalink
Redraw on SDL_WINDOWEVENT_EXPOSED and SDL_RENDER_TARGETS_RESET, rathe…
Browse files Browse the repository at this point in the history
…r than SDL_WINDOWEVENT_FOCUS_GAINED and SDL_WINDOWEVENT_RESTORED
  • Loading branch information
Qrox committed Feb 11, 2020
1 parent 00a14f2 commit 12ad380
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2866,17 +2866,16 @@ static void CheckMessages()
break;
#endif
case SDL_WINDOWEVENT_SHOWN:
case SDL_WINDOWEVENT_EXPOSED:
case SDL_WINDOWEVENT_MINIMIZED:
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
break;
case SDL_WINDOWEVENT_EXPOSED:
// Main menu redraw
reinitialize_framebuffer();
// TODO: redraw all game menus if they are open
ui_manager::redraw_all();
needupdate = true;
break;
case SDL_WINDOWEVENT_RESTORED:
needupdate = true;
#if defined(__ANDROID__)
needs_sdl_surface_visibility_refresh = true;
if( android_is_hardware_keyboard_available() ) {
Expand All @@ -2893,9 +2892,18 @@ static void CheckMessages()
}
break;
case SDL_RENDER_TARGETS_RESET:
// todo fix flicker when restoring window from sleep
// tood also redraw in wincurses port
// FIXME this event only seems to be fired after the first redraw
// when restoring the window after system sleep, rather than immediately
// on focus gain. This seems to mess up the first redraw and
// causes black screen that lasts ~0.5 seconds before the screen
// contents are redrawn in the following code.

// Main menu redraw
reinitialize_framebuffer();
// todo also redraw in wincurses port
// todo migrate main menu
ui_manager::redraw_all();
needupdate = true;
break;
case SDL_KEYDOWN: {
#if defined(__ANDROID__)
Expand Down

0 comments on commit 12ad380

Please sign in to comment.