Key modifiers (Ctrl, Alt, Meta and Shift) may be used as Input keys now on OSX
This commit is contained in:
parent
4d6d6fcbfc
commit
bb223869e0
|
@ -736,20 +736,48 @@ static int translateKey(unsigned int key)
|
||||||
|
|
||||||
- (void)flagsChanged:(NSEvent *)event
|
- (void)flagsChanged:(NSEvent *)event
|
||||||
{
|
{
|
||||||
/* int action;
|
InputEvent ev;
|
||||||
unsigned int newModifierFlags =
|
int key = [event keyCode];
|
||||||
[event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
|
int mod = [event modifierFlags];
|
||||||
|
|
||||||
if (newModifierFlags > window->ns.modifierFlags)
|
ev.type=InputEvent::KEY;
|
||||||
action = GLFW_PRESS;
|
|
||||||
else
|
|
||||||
action = GLFW_RELEASE;
|
|
||||||
|
|
||||||
window->ns.modifierFlags = newModifierFlags;
|
if (key == 0x36 || key == 0x37) {
|
||||||
|
if (mod & NSCommandKeyMask) {
|
||||||
|
mod&= ~NSCommandKeyMask;
|
||||||
|
ev.key.pressed = true;
|
||||||
|
} else {
|
||||||
|
ev.key.pressed = false;
|
||||||
|
}
|
||||||
|
} else if (key == 0x38 || key == 0x3c) {
|
||||||
|
if (mod & NSShiftKeyMask) {
|
||||||
|
mod&= ~NSShiftKeyMask;
|
||||||
|
ev.key.pressed = true;
|
||||||
|
} else {
|
||||||
|
ev.key.pressed = false;
|
||||||
|
}
|
||||||
|
} else if (key == 0x3a || key == 0x3d) {
|
||||||
|
if (mod & NSAlternateKeyMask) {
|
||||||
|
mod&= ~NSAlternateKeyMask;
|
||||||
|
ev.key.pressed = true;
|
||||||
|
} else {
|
||||||
|
ev.key.pressed = false;
|
||||||
|
}
|
||||||
|
} else if (key == 0x3b || key == 0x3e) {
|
||||||
|
if (mod & NSControlKeyMask) {
|
||||||
|
mod&= ~NSControlKeyMask;
|
||||||
|
ev.key.pressed = true;
|
||||||
|
} else {
|
||||||
|
ev.key.pressed = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const int key = translateKey([event keyCode]);
|
ev.key.mod=translateFlags(mod);
|
||||||
const int mods = translateFlags([event modifierFlags]);
|
ev.key.scancode = latin_keyboard_keycode_convert(translateKey(key));
|
||||||
_glfwInputKey(window, key, [event keyCode], action, mods);*/
|
|
||||||
|
OS_OSX::singleton->push_input(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyUp:(NSEvent *)event
|
- (void)keyUp:(NSEvent *)event
|
||||||
|
|
Loading…
Reference in New Issue