1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Fixed modifier key events being lost.

This commit is contained in:
Camilla Berglund 2014-06-17 11:29:34 +02:00
parent 20b7ac0518
commit 7123bcfc3e
2 changed files with 14 additions and 5 deletions

View File

@ -73,6 +73,8 @@ The following dependencies are needed by the examples and test programs:
- [Cocoa] Bugfix: One copy of each display name string was leaked
- [Cocoa] Bugfix: Monitor enumeration caused a segfault if no `NSScreen` was
found for a given `CGDisplay`
- [Cocoa] Bugfix: Modifier key events were lost if the corresponding modifier
bit field was unchanged
- [Win32] Enabled generation of pkg-config file for MinGW
- [Win32] Bugfix: Failure to load winmm or its functions was not reported to
the error callback

View File

@ -617,18 +617,25 @@ static int translateKey(unsigned int key)
- (void)flagsChanged:(NSEvent *)event
{
int action;
unsigned int newModifierFlags =
const unsigned int modifierFlags =
[event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
const int key = translateKey([event keyCode]);
const int mods = translateFlags(modifierFlags);
if (newModifierFlags > window->ns.modifierFlags)
if (modifierFlags == window->ns.modifierFlags)
{
if (window->key[key] == GLFW_PRESS)
action = GLFW_RELEASE;
else
action = GLFW_PRESS;
}
else if (modifierFlags > window->ns.modifierFlags)
action = GLFW_PRESS;
else
action = GLFW_RELEASE;
window->ns.modifierFlags = newModifierFlags;
window->ns.modifierFlags = modifierFlags;
const int key = translateKey([event keyCode]);
const int mods = translateFlags([event modifierFlags]);
_glfwInputKey(window, key, [event keyCode], action, mods);
}