This *should* put an end to our modifier key woes.
parent
09b07e3619
commit
da90fe3528
|
|
@ -200,9 +200,25 @@ static BOOL translateKeyMac(const U16 key, const U32 mask, KEY &outKey, U32 &out
|
|||
|
||||
MASK LLKeyboardMacOSX::updateModifiers(const U32 mask)
|
||||
{
|
||||
// This is handled for us in LLNSWindow on OS X.
|
||||
|
||||
return mask;
|
||||
// translate the mask
|
||||
MASK out_mask = 0;
|
||||
|
||||
if(mask & MAC_SHIFT_KEY)
|
||||
{
|
||||
out_mask |= MASK_SHIFT;
|
||||
}
|
||||
|
||||
if(mask & MAC_CTRL_KEY || mask & MAC_CMD_KEY)
|
||||
{
|
||||
out_mask |= MASK_CONTROL;
|
||||
}
|
||||
|
||||
if(mask & MAC_ALT_KEY)
|
||||
{
|
||||
out_mask |= MASK_ALT;
|
||||
}
|
||||
|
||||
return out_mask;
|
||||
}
|
||||
|
||||
BOOL LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask)
|
||||
|
|
@ -232,6 +248,7 @@ BOOL LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask)
|
|||
|
||||
if(translateNumpadKey(key, &translated_key))
|
||||
{
|
||||
LL_INFOS("Keyboard") << "Handled key!" << LL_ENDL;
|
||||
handled = handleTranslatedKeyUp(translated_key, translated_mask);
|
||||
}
|
||||
|
||||
|
|
@ -252,8 +269,8 @@ MASK LLKeyboardMacOSX::currentMask(BOOL for_mouse_event)
|
|||
{
|
||||
if (mask & MAC_CMD_KEY) result |= MASK_CONTROL;
|
||||
}
|
||||
|
||||
return mask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void LLKeyboardMacOSX::scanKeyboard()
|
||||
|
|
|
|||
|
|
@ -190,6 +190,11 @@
|
|||
[_window flagsChanged:theEvent];
|
||||
}
|
||||
|
||||
- (void) mouseExited:(NSEvent *)theEvent
|
||||
{
|
||||
[_window mouseExited:theEvent];
|
||||
}
|
||||
|
||||
- (BOOL) becomeFirstResponder
|
||||
{
|
||||
return [_window becomeFirstResponder];
|
||||
|
|
@ -217,6 +222,7 @@
|
|||
- (void) keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
callKeyDown([theEvent keyCode], mModifiers);
|
||||
NSLog(@"Keycode: %hu", [theEvent keyCode]);
|
||||
NSString *chars = [theEvent characters];
|
||||
for (uint i = 0; i < [chars length]; i++)
|
||||
{
|
||||
|
|
@ -254,30 +260,7 @@
|
|||
}
|
||||
|
||||
- (void)flagsChanged:(NSEvent *)theEvent {
|
||||
uint modifiers = [theEvent modifierFlags];
|
||||
|
||||
// Filter through our modifier keys, and only pick out the ones we care about.
|
||||
|
||||
mModifiers = 0;
|
||||
if (modifiers & NSCommandKeyMask)
|
||||
{
|
||||
mModifiers |= 0x0001;
|
||||
}
|
||||
|
||||
if (modifiers & NSAlternateKeyMask)
|
||||
{
|
||||
mModifiers |= 0x0002;
|
||||
}
|
||||
|
||||
if (modifiers & NSShiftKeyMask)
|
||||
{
|
||||
mModifiers |= 0x0004;
|
||||
}
|
||||
|
||||
if (modifiers & NSControlKeyMask)
|
||||
{
|
||||
mModifiers |= 0x0001;
|
||||
}
|
||||
mModifiers = [theEvent modifierFlags];
|
||||
}
|
||||
|
||||
- (void) mouseDown:(NSEvent *)theEvent
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue