Merge branch 'master' into jgrpp
# Conflicts: # src/aircraft_cmd.cpp # src/company_gui.cpp # src/lang/arabic_egypt.txt # src/lang/czech.txt # src/lang/esperanto.txt # src/lang/faroese.txt # src/lang/finnish.txt # src/lang/german.txt # src/lang/korean.txt # src/lang/latvian.txt # src/lang/malay.txt # src/lang/polish.txt # src/lang/spanish.txt # src/lang/spanish_MX.txt # src/lang/unfinished/urdu.txt # src/main_gui.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/road_cmd.cpp # src/settings_type.h # src/station_cmd.cpp # src/table/settings.ini
This commit is contained in:
@@ -18,7 +18,6 @@ extern bool _cocoa_video_started;
|
||||
|
||||
class VideoDriver_Cocoa : public VideoDriver {
|
||||
private:
|
||||
bool fullscreen_on_mainloop; ///< Switch to fullscreen once the main loop is running?
|
||||
Dimension orig_res; ///< Saved window size for non-fullscreen mode.
|
||||
|
||||
public:
|
||||
|
||||
@@ -156,6 +156,7 @@ static void QZ_UpdateVideoModes()
|
||||
static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool fullscreen, bool fallback)
|
||||
{
|
||||
CocoaSubdriver *ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
|
||||
if (ret != nullptr && fullscreen) ret->ToggleFullscreen(fullscreen);
|
||||
|
||||
if (ret != nullptr) return ret;
|
||||
if (!fallback) return nullptr;
|
||||
@@ -209,9 +210,6 @@ const char *VideoDriver_Cocoa::Start(const StringList &parm)
|
||||
return "The cocoa quartz subdriver only supports 8 and 32 bpp.";
|
||||
}
|
||||
|
||||
/* Defer fullscreen toggle until the main loop is running,
|
||||
* as otherwise a grey bar will be stuck on top of the window. */
|
||||
this->fullscreen_on_mainloop = _fullscreen;
|
||||
_cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, _fullscreen, true);
|
||||
if (_cocoa_subdriver == NULL) {
|
||||
Stop();
|
||||
@@ -569,7 +567,8 @@ bool WindowQuartzSubdriver::SetVideoMode(int width, int height, int bpp)
|
||||
[ this->window setContentSize:contentRect.size ];
|
||||
|
||||
/* Ensure frame height - title bar height >= view height */
|
||||
contentRect.size.height = Clamp(height, 0, (int)[ this->window frame ].size.height - 22 /* 22 is the height of title bar of window*/);
|
||||
float content_height = [ this->window contentRectForFrameRect:[ this->window frame ] ].size.height;
|
||||
contentRect.size.height = Clamp(height, 0, (int)content_height);
|
||||
|
||||
if (this->cocoaview != nil) {
|
||||
height = (int)contentRect.size.height;
|
||||
|
||||
@@ -655,12 +655,6 @@ void VideoDriver_Cocoa::GameLoop()
|
||||
|
||||
while (QZ_PollEvent()) {}
|
||||
|
||||
/* 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;
|
||||
|
||||
Reference in New Issue
Block a user