summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
Diffstat (limited to 'src/video')
-rw-r--r--src/video/cocoa/cocoa_v.mm29
-rw-r--r--src/video/cocoa/fullscreen.mm14
2 files changed, 21 insertions, 22 deletions
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index 434de5994..8f7767c8a 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -143,7 +143,7 @@ static void setupWindowMenu()
[ menuItem setSubmenu:windowMenu ];
[ [ NSApp mainMenu ] addItem:menuItem ];
- if(MacOSVersionIsAtLeast(10, 7, 0)) {
+ if (MacOSVersionIsAtLeast(10, 7, 0)) {
/* The OS will change the name of this menu item automatically */
[ windowMenu addItemWithTitle:@"Fullscreen" action:@selector(toggleFullScreen:) keyEquivalent:@"^f" ];
}
@@ -241,23 +241,20 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
CocoaSubdriver *ret;
#endif
-#ifdef ENABLE_COCOA_QUARTZ
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+#ifdef ENABLE_COCOA_QUARTZ && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
/* The reason for the version mismatch is due to the fact that the 10.4 binary needs to work on 10.5 as well. */
if (MacOSVersionIsAtLeast(10, 5, 0)) {
ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
if (ret != NULL) return ret;
}
#endif
-#endif
#ifdef ENABLE_COCOA_QUICKDRAW
ret = QZ_CreateWindowQuickdrawSubdriver(width, height, bpp);
if (ret != NULL) return ret;
#endif
-#ifdef ENABLE_COCOA_QUARTZ
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+#ifdef ENABLE_COCOA_QUARTZ && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
/*
* If we get here we are running 10.4 or earlier and either openttd was compiled without the QuickDraw driver
* or it failed to load for some reason. Fall back to Quartz if possible even though that driver is slower.
@@ -267,7 +264,6 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
if (ret != NULL) return ret;
}
#endif
-#endif
return NULL;
}
@@ -307,11 +303,14 @@ static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool f
ret = QZ_CreateWindowSubdriver(640, 480, bpp);
if (ret != NULL) return ret;
-#ifdef _DEBUG && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
- /* Try fullscreen too when in debug mode */
- DEBUG(driver, 0, "Setting video mode failed, falling back to 640x480 fullscreen mode.");
- ret = QZ_CreateFullscreenSubdriver(640, 480, bpp);
- if (ret != NULL) return ret;
+#ifdef _DEBUG
+ /* This Fullscreen mode crashes on OSX 10.7 */
+ if !(MacOSVersionIsAtLeast(10, 7, 0) {
+ /* Try fullscreen too when in debug mode */
+ DEBUG(driver, 0, "Setting video mode failed, falling back to 640x480 fullscreen mode.");
+ ret = QZ_CreateFullscreenSubdriver(640, 480, bpp);
+ if (ret != NULL) return ret;
+ }
#endif
return NULL;
@@ -681,8 +680,8 @@ void cocoaReleaseAutoreleasePool()
{
NSPoint loc = [ self convertPoint:[ [ self window ] mouseLocationOutsideOfEventStream ] fromView:nil ];
BOOL inside = ([ self hitTest:loc ]==self);
- if(inside) [ [ self window] makeFirstResponder:self ];
- trackingtag = [ self addTrackingRect:[self visibleRect] owner:self userData:nil assumeInside:inside ];
+ if (inside) [ [ self window ] makeFirstResponder:self ];
+ trackingtag = [ self addTrackingRect:[ self visibleRect ] owner:self userData:nil assumeInside:inside ];
}
/**
* Return responsibility for the application window to system
@@ -713,7 +712,7 @@ void cocoaReleaseAutoreleasePool()
*/
- (void)viewDidMoveToWindow
{
- if([ self window ]) [ self setTrackingRect ];
+ if ([ self window ]) [ self setTrackingRect ];
}
/**
* Make OpenTTD aware that it has control over the mouse
diff --git a/src/video/cocoa/fullscreen.mm b/src/video/cocoa/fullscreen.mm
index 56bcc580d..6eea3d64b 100644
--- a/src/video/cocoa/fullscreen.mm
+++ b/src/video/cocoa/fullscreen.mm
@@ -311,15 +311,15 @@ class FullscreenSubdriver: public CocoaSubdriver {
/* Since CGDisplayBaseAddress and CGDisplayBytesPerRow are no longer available on 10.7,
* disable until a replacement can be found. */
- if (MacOSVersionIsAtLeast(10, 7, 0)) {
- this->window_buffer = NULL;
- this->window_pitch = NULL;
- } else {
+ if (MacOSVersionIsAtLeast(10, 7, 0)) {
+ this->window_buffer = NULL;
+ this->window_pitch = NULL;
+ } else {
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7)
- this->window_buffer = CGDisplayBaseAddress(this->display_id);
- this->window_pitch = CGDisplayBytesPerRow(this->display_id);
+ this->window_buffer = CGDisplayBaseAddress(this->display_id);
+ this->window_pitch = CGDisplayBytesPerRow(this->display_id);
#endif
- }
+ }
this->device_width = CGDisplayPixelsWide(this->display_id);
this->device_height = CGDisplayPixelsHigh(this->display_id);