1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-29 16:29:08 +00:00

Avoids multiple calls to -[NSCursor hide] and -unhide.

Those are reference counted.
This commit is contained in:
Thomas Harte 2019-06-13 13:39:35 -04:00
parent 5630141ad7
commit 39aae34323

View File

@ -219,9 +219,11 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
} }
- (void)releaseMouse { - (void)releaseMouse {
if(_mouseIsCaptured) {
_mouseIsCaptured = NO; _mouseIsCaptured = NO;
CGAssociateMouseAndMouseCursorPosition(true); CGAssociateMouseAndMouseCursorPosition(true);
[NSCursor unhide]; [NSCursor unhide];
}
} }
#pragma mark - Mouse motion #pragma mark - Mouse motion
@ -274,7 +276,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
#pragma mark - Mouse buttons #pragma mark - Mouse buttons
- (void)applyButtonDown:(NSEvent *)event { - (void)applyButtonDown:(NSEvent *)event {
if(self.shouldCaptureMouse) { if(self.shouldCaptureMouse && !_mouseIsCaptured) {
_mouseIsCaptured = YES; _mouseIsCaptured = YES;
[NSCursor hide]; [NSCursor hide];
CGAssociateMouseAndMouseCursorPosition(false); CGAssociateMouseAndMouseCursorPosition(false);