diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-03 15:23:08 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-01-03 21:20:28 +0100 |
commit | 4ce53cb85113956be318c12801d5663a26e3fef9 (patch) | |
tree | e2136e9f73b0611f08a5c946a6288abdf5881868 /src/video/cocoa/event.mm | |
parent | c860a247d3e21628a0ac799d4d99ae178bb8a4a3 (diff) | |
download | openttd-4ce53cb85113956be318c12801d5663a26e3fef9.tar.xz |
Fix: [OSX] Quitting in fullscreen mode would loose the original window size.
This replicates the behaviour on e.g. Windows, which saves the original window size.
Diffstat (limited to 'src/video/cocoa/event.mm')
-rw-r--r-- | src/video/cocoa/event.mm | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm index cb3c753ac..642149858 100644 --- a/src/video/cocoa/event.mm +++ b/src/video/cocoa/event.mm @@ -617,7 +617,7 @@ static bool QZ_PollEvent() } -void QZ_GameLoop() +void VideoDriver_Cocoa::GameLoop() { uint32 cur_ticks = GetTick(); uint32 last_cur_ticks = cur_ticks; @@ -633,7 +633,7 @@ void QZ_GameLoop() _cocoa_subdriver->Draw(true); CSleep(1); - for (int i = 0; i < 2; i++) GameLoop(); + for (int i = 0; i < 2; i++) ::GameLoop(); UpdateWindows(); QZ_CheckPaletteAnim(); @@ -652,7 +652,17 @@ void QZ_GameLoop() while (QZ_PollEvent()) {} - if (_exit_game) break; + /* If we do that right after window creation, a grey bar will be left at the top. */ + if (this->fullscreen_on_mainloop) { + this->fullscreen_on_mainloop = false; + _cocoa_subdriver->ToggleFullscreen(true); + } + + if (_exit_game) { + /* Restore saved resolution if in fullscreen mode. */ + if (_cocoa_subdriver->IsFullscreen()) _cur_resolution = this->orig_res; + break; + } #if defined(_DEBUG) if (_current_mods & NSShiftKeyMask) @@ -678,7 +688,7 @@ void QZ_GameLoop() if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged(); - GameLoop(); + ::GameLoop(); UpdateWindows(); QZ_CheckPaletteAnim(); |