mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-26 08:29:33 +00:00
Completes the wiring necessary for capture of the command key.
At least when coupled with mouse capture.
This commit is contained in:
parent
077c7d767f
commit
114f81941e
@ -209,8 +209,10 @@ class MachineDocument:
|
|||||||
openGLView.delegate = self
|
openGLView.delegate = self
|
||||||
openGLView.responderDelegate = self
|
openGLView.responderDelegate = self
|
||||||
|
|
||||||
// If this machine has a mouse, enable mouse capture.
|
// If this machine has a mouse, enable mouse capture; also indicate whether usurption
|
||||||
|
// of the command key is desired.
|
||||||
openGLView.shouldCaptureMouse = machine.hasMouse
|
openGLView.shouldCaptureMouse = machine.hasMouse
|
||||||
|
openGLView.shouldUsurpCommand = machine.shouldUsurpCommand
|
||||||
|
|
||||||
setupAudioQueueClockRate()
|
setupAudioQueueClockRate()
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
|
|||||||
|
|
||||||
// Input control.
|
// Input control.
|
||||||
@property (nonatomic, readonly) BOOL hasExclusiveKeyboard;
|
@property (nonatomic, readonly) BOOL hasExclusiveKeyboard;
|
||||||
|
@property (nonatomic, readonly) BOOL shouldUsurpCommand;
|
||||||
@property (nonatomic, readonly) BOOL hasJoystick;
|
@property (nonatomic, readonly) BOOL hasJoystick;
|
||||||
@property (nonatomic, readonly) BOOL hasMouse;
|
@property (nonatomic, readonly) BOOL hasMouse;
|
||||||
@property (nonatomic, assign) CSMachineKeyboardInputMode inputMode;
|
@property (nonatomic, assign) CSMachineKeyboardInputMode inputMode;
|
||||||
|
@ -671,6 +671,14 @@ struct ActivityObserver: public Activity::Observer {
|
|||||||
return !!_machine->keyboard_machine() && _machine->keyboard_machine()->get_keyboard().is_exclusive();
|
return !!_machine->keyboard_machine() && _machine->keyboard_machine()->get_keyboard().is_exclusive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)shouldUsurpCommand {
|
||||||
|
if(!_machine->keyboard_machine()) return NO;
|
||||||
|
|
||||||
|
const auto essential_modifiers = _machine->keyboard_machine()->get_keyboard().get_essential_modifiers();
|
||||||
|
return essential_modifiers.find(Inputs::Keyboard::Key::LeftMeta) != essential_modifiers.end() ||
|
||||||
|
essential_modifiers.find(Inputs::Keyboard::Key::RightMeta) != essential_modifiers.end();
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Activity observation
|
#pragma mark - Activity observation
|
||||||
|
|
||||||
- (void)addLED:(NSString *)led {
|
- (void)addLED:(NSString *)led {
|
||||||
|
@ -245,6 +245,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
CGAssociateMouseAndMouseCursorPosition(true);
|
CGAssociateMouseAndMouseCursorPosition(true);
|
||||||
[NSCursor unhide];
|
[NSCursor unhide];
|
||||||
[self.delegate openGLViewDidReleaseMouse:self];
|
[self.delegate openGLViewDidReleaseMouse:self];
|
||||||
|
((CSApplication *)[NSApplication sharedApplication]).keyboardEventDelegate = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,6 +305,9 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
[NSCursor hide];
|
[NSCursor hide];
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
[self.delegate openGLViewDidCaptureMouse:self];
|
[self.delegate openGLViewDidCaptureMouse:self];
|
||||||
|
if(self.shouldUsurpCommand) {
|
||||||
|
((CSApplication *)[NSApplication sharedApplication]).keyboardEventDelegate = self;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't report the first click to the delegate; treat that as merely
|
// Don't report the first click to the delegate; treat that as merely
|
||||||
// an invitation to capture the cursor.
|
// an invitation to capture the cursor.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user