Skip to content

Commit 7900a35

Browse files
committed
Wait for fullscreen exit
1 parent ccb7534 commit 7900a35

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

Descent3/config.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,9 @@ static void config_gamma() {
762762
//////////////////////////////////////////////////////////////////
763763
// VIDEO MENU
764764
//
765+
766+
#include <SDL3/SDL_events.h>
767+
#include <iostream>
765768
struct video_menu {
766769
newuiSheet *sheet;
767770

renderer/HardwareBaseGPU.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ int rend_SetPreferredState(renderer_preferred_state *pref_state, bool reinit) {
347347
if (gpu_state.initted) {
348348
LOG_DEBUG << "Inside pref state!";
349349

350+
if (old_state.fullscreen != pref_state->fullscreen) {
351+
rend_SetFullScreen(pref_state->fullscreen);
352+
}
353+
350354
if (pref_state->width != gpu_state.screen_width || pref_state->height != gpu_state.screen_height ||
351355
old_state.bit_depth != pref_state->bit_depth || reinit) {
352356
rend_ReInit();
@@ -355,9 +359,6 @@ int rend_SetPreferredState(renderer_preferred_state *pref_state, bool reinit) {
355359
if (old_state.gamma != pref_state->gamma) {
356360
rend_SetGammaValue(pref_state->gamma);
357361
}
358-
if (old_state.fullscreen != pref_state->fullscreen) {
359-
rend_SetFullScreen(pref_state->fullscreen);
360-
}
361362
} else {
362363
gpu_preferred_state = *pref_state;
363364
}

renderer/HardwareOpenGL.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,14 @@ void rend_SetFullScreen(bool fullscreen) {
11461146
LOG_DEBUG.printf("Entering fullscreen mode");
11471147
} else {
11481148
LOG_DEBUG.printf("Exiting fullscreen mode");
1149+
SDL_Event event;
1150+
while (1)
1151+
{
1152+
SDL_WaitEvent(&event);
1153+
if (event.type == SDL_EVENT_WINDOW_LEAVE_FULLSCREEN) {
1154+
break;
1155+
}
1156+
}
11491157
}
11501158
}
11511159

0 commit comments

Comments
 (0)