mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 14:45:46 +00:00
Fixed modifier key events being lost.
This commit is contained in:
+12
-5
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user