mirror of
https://github.com/glfw/glfw.git
synced 2024-11-30 05:47:10 +00:00
Made more consistent use of key code conversion.
This commit is contained in:
parent
8155f90bf3
commit
89eec8af09
@ -392,11 +392,11 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
|||||||
{
|
{
|
||||||
NSUInteger i, length;
|
NSUInteger i, length;
|
||||||
NSString* characters;
|
NSString* characters;
|
||||||
int code = convertMacKeyCode([event keyCode]);
|
int key = convertMacKeyCode([event keyCode]);
|
||||||
|
|
||||||
if (code != -1)
|
if (key != -1)
|
||||||
{
|
{
|
||||||
_glfwInputKey(window, code, GLFW_PRESS);
|
_glfwInputKey(window, key, GLFW_PRESS);
|
||||||
|
|
||||||
if ([event modifierFlags] & NSCommandKeyMask)
|
if ([event modifierFlags] & NSCommandKeyMask)
|
||||||
{
|
{
|
||||||
@ -416,7 +416,7 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
|||||||
|
|
||||||
- (void)flagsChanged:(NSEvent *)event
|
- (void)flagsChanged:(NSEvent *)event
|
||||||
{
|
{
|
||||||
int mode;
|
int mode, key;
|
||||||
unsigned int newModifierFlags =
|
unsigned int newModifierFlags =
|
||||||
[event modifierFlags] | NSDeviceIndependentModifierFlagsMask;
|
[event modifierFlags] | NSDeviceIndependentModifierFlagsMask;
|
||||||
|
|
||||||
@ -426,14 +426,17 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
|||||||
mode = GLFW_RELEASE;
|
mode = GLFW_RELEASE;
|
||||||
|
|
||||||
window->NS.modifierFlags = newModifierFlags;
|
window->NS.modifierFlags = newModifierFlags;
|
||||||
_glfwInputKey(window, MAC_TO_GLFW_KEYCODE_MAPPING[[event keyCode]], mode);
|
|
||||||
|
key = convertMacKeyCode([event keyCode]);
|
||||||
|
if (key != -1)
|
||||||
|
_glfwInputKey(window, key, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyUp:(NSEvent *)event
|
- (void)keyUp:(NSEvent *)event
|
||||||
{
|
{
|
||||||
int code = convertMacKeyCode([event keyCode]);
|
int key = convertMacKeyCode([event keyCode]);
|
||||||
if (code != -1)
|
if (key != -1)
|
||||||
_glfwInputKey(window, code, GLFW_RELEASE);
|
_glfwInputKey(window, key, GLFW_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)scrollWheel:(NSEvent *)event
|
- (void)scrollWheel:(NSEvent *)event
|
||||||
|
Loading…
Reference in New Issue
Block a user