mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-16 11:30:22 +00:00
Ensures volume controls appear for mouse-capture machines when not capturing.
This commit is contained in:
parent
5edb0c0ee7
commit
e6bae261c4
@ -288,7 +288,6 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
|
|
||||||
- (void)scheduleMouseHide {
|
- (void)scheduleMouseHide {
|
||||||
if(!self.shouldCaptureMouse) {
|
if(!self.shouldCaptureMouse) {
|
||||||
[self.delegate openGLViewDidShowOSMouseCursor:self];
|
|
||||||
[_mouseHideTimer invalidate];
|
[_mouseHideTimer invalidate];
|
||||||
|
|
||||||
_mouseHideTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 repeats:NO block:^(NSTimer * _Nonnull timer) {
|
_mouseHideTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 repeats:NO block:^(NSTimer * _Nonnull timer) {
|
||||||
@ -299,6 +298,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseEntered:(NSEvent *)event {
|
- (void)mouseEntered:(NSEvent *)event {
|
||||||
|
[self.delegate openGLViewDidShowOSMouseCursor:self];
|
||||||
[super mouseEntered:event];
|
[super mouseEntered:event];
|
||||||
[self scheduleMouseHide];
|
[self scheduleMouseHide];
|
||||||
}
|
}
|
||||||
@ -316,6 +316,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
CGAssociateMouseAndMouseCursorPosition(true);
|
CGAssociateMouseAndMouseCursorPosition(true);
|
||||||
[NSCursor unhide];
|
[NSCursor unhide];
|
||||||
[self.delegate openGLViewDidReleaseMouse:self];
|
[self.delegate openGLViewDidReleaseMouse:self];
|
||||||
|
[self.delegate openGLViewDidShowOSMouseCursor:self];
|
||||||
((CSApplication *)[NSApplication sharedApplication]).eventDelegate = nil;
|
((CSApplication *)[NSApplication sharedApplication]).eventDelegate = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,6 +328,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
// Mouse capture is off, so don't play games with the cursor, just schedule it to
|
// Mouse capture is off, so don't play games with the cursor, just schedule it to
|
||||||
// hide in the near future.
|
// hide in the near future.
|
||||||
[self scheduleMouseHide];
|
[self scheduleMouseHide];
|
||||||
|
[self.delegate openGLViewDidShowOSMouseCursor:self];
|
||||||
} else {
|
} else {
|
||||||
if(_mouseIsCaptured) {
|
if(_mouseIsCaptured) {
|
||||||
// Mouse capture is on, so move the cursor back to the middle of the window, and
|
// Mouse capture is on, so move the cursor back to the middle of the window, and
|
||||||
@ -343,6 +345,8 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
));
|
));
|
||||||
|
|
||||||
[self.responderDelegate mouseMoved:event];
|
[self.responderDelegate mouseMoved:event];
|
||||||
|
} else {
|
||||||
|
[self.delegate openGLViewDidShowOSMouseCursor:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,6 +379,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
_mouseIsCaptured = YES;
|
_mouseIsCaptured = YES;
|
||||||
[NSCursor hide];
|
[NSCursor hide];
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
|
[self.delegate openGLViewWillHideOSMouseCursor:self];
|
||||||
[self.delegate openGLViewDidCaptureMouse:self];
|
[self.delegate openGLViewDidCaptureMouse:self];
|
||||||
if(self.shouldUsurpCommand) {
|
if(self.shouldUsurpCommand) {
|
||||||
((CSApplication *)[NSApplication sharedApplication]).eventDelegate = self;
|
((CSApplication *)[NSApplication sharedApplication]).eventDelegate = self;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user