Skip to content

Commit ee8f286

Browse files
committed
cocoa: Don't re-enter a fullscreen space if leaving to enter an exclusive mode
Doing so can leave the window in a weird, offset state.
1 parent 293b8b9 commit ee8f286

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/video/SDL_video.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,11 +1927,15 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
19271927
goto done;
19281928
}
19291929
if (commit) {
1930+
bool skip_spaces_switch = false;
19301931
// If we're switching between a fullscreen Space and exclusive fullscreen, we need to get back to normal first.
19311932
if (fullscreen && Cocoa_IsWindowInFullscreenSpace(window) && !window->last_fullscreen_exclusive_display && window->fullscreen_exclusive) {
19321933
if (!Cocoa_SetWindowFullscreenSpace(window, false, true)) {
19331934
goto error;
19341935
}
1936+
1937+
// We just left spaces to go to an exclusive mode, so don't try to re-enter.
1938+
skip_spaces_switch = true;
19351939
} else if (fullscreen && window->last_fullscreen_exclusive_display && !window->fullscreen_exclusive) {
19361940
for (i = 0; i < _this->num_displays; ++i) {
19371941
SDL_VideoDisplay *last_display = _this->displays[i];
@@ -1945,8 +1949,10 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
19451949
}
19461950
}
19471951

1948-
if (Cocoa_SetWindowFullscreenSpace(window, !!fullscreen, syncHint)) {
1949-
goto done;
1952+
if (!skip_spaces_switch) {
1953+
if (Cocoa_SetWindowFullscreenSpace(window, !!fullscreen, syncHint)) {
1954+
goto done;
1955+
}
19501956
}
19511957
}
19521958
}

0 commit comments

Comments
 (0)