Escape key exits full-screen
This commit is contained in:
parent
d7ec106875
commit
d80056a233
|
@ -458,12 +458,20 @@ void curve(t_effect *current_effect)
|
|||
current_effect->x_curve = k;
|
||||
}
|
||||
|
||||
static gboolean is_in_fullscreen(void) {
|
||||
return (gboolean) SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN;
|
||||
}
|
||||
|
||||
void display_toggle_fullscreen(void)
|
||||
{
|
||||
Uint32 is_fullscreen = SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN;
|
||||
if (SDL_SetWindowFullscreen(window, is_fullscreen ? 0 : SDL_WINDOW_FULLSCREEN) < 0)
|
||||
if (SDL_SetWindowFullscreen(window, is_in_fullscreen() ? 0 : SDL_WINDOW_FULLSCREEN) < 0)
|
||||
g_warning("Infinity cannot change fullscreen mode: %s", SDL_GetError());
|
||||
SDL_ShowCursor(is_fullscreen);
|
||||
SDL_ShowCursor(is_in_fullscreen());
|
||||
}
|
||||
|
||||
void display_exit_fullscreen_if_needed(void) {
|
||||
if (is_in_fullscreen())
|
||||
display_toggle_fullscreen();
|
||||
}
|
||||
|
||||
inline void display_save_effect(t_effect *effect)
|
||||
|
|
|
@ -83,6 +83,8 @@ void curve(t_effect *current_effect);
|
|||
*/
|
||||
void display_toggle_fullscreen(void);
|
||||
|
||||
void display_exit_fullscreen_if_needed(void);
|
||||
|
||||
void display_save_effect(t_effect *effect);
|
||||
void display_load_random_effect(t_effect *effect);
|
||||
|
||||
|
|
|
@ -266,7 +266,9 @@ static void check_events()
|
|||
case SDLK_b:
|
||||
player->next(); break;
|
||||
case SDLK_F11:
|
||||
display_toggle_fullscreen(); break;
|
||||
display_toggle_fullscreen(); break;
|
||||
case SDLK_ESCAPE:
|
||||
display_exit_fullscreen_if_needed(); break;
|
||||
case SDLK_F12:
|
||||
if (t_last_color > 32) {
|
||||
t_last_color = 0;
|
||||
|
|
Loading…
Reference in New Issue