1
0
Fork 0

Change: [OSX] Compiling the Cocoa/Quartz video driver cannot be disabled anymore.

pull/8458/head
Michael Lutz 2020-12-26 16:07:51 +01:00
parent 9ccef816f9
commit a61a741683
3 changed files with 8 additions and 36 deletions

View File

@ -230,7 +230,6 @@ if(APPLE)
add_definitions( add_definitions(
-DWITH_COCOA -DWITH_COCOA
-DENABLE_COCOA_QUARTZ
) )
endif() endif()

View File

@ -191,9 +191,7 @@ public:
extern CocoaSubdriver *_cocoa_subdriver; extern CocoaSubdriver *_cocoa_subdriver;
#ifdef ENABLE_COCOA_QUARTZ
CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp); CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp);
#endif
void QZ_GameSizeChanged(); void QZ_GameSizeChanged();

View File

@ -162,23 +162,6 @@ void QZ_GameSizeChanged()
GameSizeChanged(); GameSizeChanged();
} }
/**
* Find a suitable cocoa window subdriver.
*
* @param width Width of display area.
* @param height Height of display area.
* @param bpp Colour depth of display area.
* @return Pointer to window subdriver.
*/
static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
{
#if defined(ENABLE_COCOA_QUARTZ)
return QZ_CreateWindowQuartzSubdriver(width, height, bpp);
#else
return nullptr;
#endif
}
/** /**
* Find a suitable cocoa subdriver. * Find a suitable cocoa subdriver.
* *
@ -191,7 +174,7 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
*/ */
static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool fullscreen, bool fallback) static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool fullscreen, bool fallback)
{ {
CocoaSubdriver *ret = QZ_CreateWindowSubdriver(width, height, bpp); CocoaSubdriver *ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
if (ret != nullptr && fullscreen) ret->ToggleFullscreen(); if (ret != nullptr && fullscreen) ret->ToggleFullscreen();
if (ret != nullptr) return ret; if (ret != nullptr) return ret;
@ -199,7 +182,7 @@ static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool f
/* Try again in 640x480 windowed */ /* Try again in 640x480 windowed */
DEBUG(driver, 0, "Setting video mode failed, falling back to 640x480 windowed mode."); DEBUG(driver, 0, "Setting video mode failed, falling back to 640x480 windowed mode.");
ret = QZ_CreateWindowSubdriver(640, 480, bpp); ret = QZ_CreateWindowQuartzSubdriver(640, 480, bpp);
if (ret != nullptr) return ret; if (ret != nullptr) return ret;
return nullptr; return nullptr;
@ -228,7 +211,7 @@ void VideoDriver_Cocoa::Stop()
*/ */
const char *VideoDriver_Cocoa::Start(const StringList &parm) const char *VideoDriver_Cocoa::Start(const StringList &parm)
{ {
if (!MacOSVersionIsAtLeast(10, 6, 0)) return "The Cocoa video driver requires Mac OS X 10.6 or later."; if (!MacOSVersionIsAtLeast(10, 7, 0)) return "The Cocoa video driver requires Mac OS X 10.7 or later.";
if (_cocoa_video_started) return "Already started"; if (_cocoa_video_started) return "Already started";
_cocoa_video_started = true; _cocoa_video_started = true;
@ -240,6 +223,11 @@ const char *VideoDriver_Cocoa::Start(const StringList &parm)
int height = _cur_resolution.height; int height = _cur_resolution.height;
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
if (bpp != 8 && bpp != 32) {
Stop();
return "The cocoa quartz subdriver only supports 8 and 32 bpp.";
}
_cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, _fullscreen, true); _cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, _fullscreen, true);
if (_cocoa_subdriver == NULL) { if (_cocoa_subdriver == NULL) {
Stop(); Stop();
@ -332,8 +320,6 @@ void VideoDriver_Cocoa::EditBoxLostFocus()
HandleTextInput(NULL, true); HandleTextInput(NULL, true);
} }
#ifdef ENABLE_COCOA_QUARTZ
class WindowQuartzSubdriver; class WindowQuartzSubdriver;
/* Subclass of OTTD_CocoaView to fix Quartz rendering */ /* Subclass of OTTD_CocoaView to fix Quartz rendering */
@ -850,16 +836,6 @@ bool WindowQuartzSubdriver::WindowResized()
CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp) CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp)
{ {
if (!MacOSVersionIsAtLeast(10, 7, 0)) {
DEBUG(driver, 0, "The cocoa quartz subdriver requires Mac OS X 10.7 or later.");
return NULL;
}
if (bpp != 8 && bpp != 32) {
DEBUG(driver, 0, "The cocoa quartz subdriver only supports 8 and 32 bpp.");
return NULL;
}
WindowQuartzSubdriver *ret = new WindowQuartzSubdriver(); WindowQuartzSubdriver *ret = new WindowQuartzSubdriver();
if (!ret->ChangeResolution(width, height, bpp)) { if (!ret->ChangeResolution(width, height, bpp)) {
@ -869,6 +845,5 @@ CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp)
return ret; return ret;
} }
#endif /* ENABLE_COCOA_QUARTZ */
#endif /* WITH_COCOA */ #endif /* WITH_COCOA */