Index: src/video/cocoa/wnd_quartz.mm =================================================================== --- src/video/cocoa/wnd_quartz.mm (revision 19753) +++ src/video/cocoa/wnd_quartz.mm (working copy) @@ -72,11 +72,15 @@ - (BOOL)windowShouldClose:(id)sender; @end -/* Subclass of NSView to fix Quartz rendering */ +/* Subclass of NSView to fix Quartz rendering and mouse feedback */ @interface OTTD_QuartzView : NSView { WindowQuartzSubdriver *driver; } +- (id)initWithFrame:(NSRect)frameRect; +- (void)mouseEntered:(NSEvent *)anEvent; +- (void)mouseExited:(NSEvent *)anEvent; + - (void)setDriver:(WindowQuartzSubdriver*)drv; - (void)drawRect:(NSRect)rect; @@ -308,6 +312,26 @@ @implementation OTTD_QuartzView +- (id)initWithFrame:(NSRect)frameRect +{ + self = [super initWithFrame:frameRect]; + if (self) { + [self addTrackingRect:frameRect owner:self userData:nil assumeInside:NO]; + } + return self; +} + +- (void)mouseEntered:(NSEvent *)anEvent +{ + QZ_HideMouse(); +} + +- (void)mouseExited:(NSEvent *)anEvent +{ + QZ_ShowMouse(); +} + + - (void)setDriver:(WindowQuartzSubdriver*)drv { driver = drv; Index: src/video/cocoa/event.mm =================================================================== --- src/video/cocoa/event.mm (revision 19753) +++ src/video/cocoa/event.mm (working copy) @@ -77,7 +77,7 @@ void QZ_ShowMouse() { if (!_show_mouse) { - [ NSCursor unhide ]; + CGDisplayShowCursor(kCGDirectMainDisplay); _show_mouse = true; /* Hide the openttd cursor when leaving the window */ @@ -92,7 +92,13 @@ /* Don't hide the cursor when compiling in debug mode. * Note: Not hiding the cursor will cause artefacts around it in 8bpp fullscreen mode. */ #ifndef _DEBUG - [ NSCursor hide ]; + CGDisplayHideCursor(kCGDirectMainDisplay); + if (CGCursorIsVisible()) { + // The cursor wasn't actually hidden + // because the dock or some similar + // window had control of it + return; + } #endif _show_mouse = false; Index: src/video/cocoa/wnd_quickdraw.mm =================================================================== --- src/video/cocoa/wnd_quickdraw.mm (revision 19753) +++ src/video/cocoa/wnd_quickdraw.mm (working copy) @@ -72,6 +72,17 @@ - (BOOL)windowShouldClose:(id)sender; @end +/* Subclass of NSQuickDrawView to fix mouse feedback */ +@interface OTTD_QuickDrawView : NSQuickDrawView { +} + +- (id)initWithFrame:(NSRect)frameRect; +- (void)mouseEntered:(NSEvent *)anEvent; +- (void)mouseExited:(NSEvent *)anEvent; + +- (BOOL)isOpaque; +@end + class WindowQuickdrawSubdriver: public CocoaSubdriver { int device_width; int device_height; @@ -302,7 +313,34 @@ @end +@implementation OTTD_QuickDrawView +- (id)initWithFrame:(NSRect)frameRect +{ + self = [super initWithFrame:frameRect]; + if (self) { + [self addTrackingRect:frameRect owner:self userData:nil assumeInside:NO]; + } + return self; +} + +- (void)mouseEntered:(NSEvent *)anEvent +{ + QZ_HideMouse(); +} + +- (void)mouseExited:(NSEvent *)anEvent +{ + QZ_ShowMouse(); +} + +- (BOOL)isOpaque +{ + return YES; +} + +@end + static const int _resize_icon_width = 16; static const int _resize_icon_height = 16; @@ -409,7 +447,7 @@ /* Only recreate the view if it doesn't already exist */ if (this->qdview == nil) { - this->qdview = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ]; + this->qdview = [ [ OTTD_QuickDrawView alloc ] initWithFrame:contentRect ]; if (this->qdview == nil) { DEBUG(driver, 0, "Could not create the Quickdraw view."); this->setup = false;