diff --git a/area_darwin.go b/area_darwin.go index 921b223..c380995 100644 --- a/area_darwin.go +++ b/area_darwin.go @@ -171,7 +171,7 @@ func areaView_flagsChanged(self C.id, e C.id) C.BOOL { var ke KeyEvent // Mac OS X sends this event on both key up and key down. - // Fortunately -[e keyCode] IS valid here, so we can simply map from key code to Modifiers, get the value of [e modifierFlags], the respective bit is set or not — that will give us the up/down state + // Fortunately -[e keyCode] IS valid here, so we can simply map from key code to Modifiers, get the value of [e modifierFlags], and check if the respective bit is set or not — that will give us the up/down state keyCode := uintptr(C.keyCode(e)) mod, ok := keycodeModifiers[keyCode] // comma-ok form to avoid adding entries if !ok { // unknown modifier; ignore @@ -179,5 +179,8 @@ func areaView_flagsChanged(self C.id, e C.id) C.BOOL { } ke.Modifiers = parseModifiers(e) ke.Up = (ke.Modifiers & mod) == 0 + ke.Modifier = mod + // don't include the modifier in ke.Modifiers + ke.Modifiers &^= mod return toBOOL(sendKeyEvent(self, e, ke)) } diff --git a/todo.md b/todo.md index 10f4f7b..6a279bc 100644 --- a/todo.md +++ b/todo.md @@ -5,6 +5,7 @@ important things: super ultra important things: - 10.6 also spits a bunch of NSNoAutoreleasePool() debug log messages even though I thoguht I had everything in an NSAutoreleasePool... - windows: windows key handling is just wrong; figure out how to avoid (especially since Windows intercepts that key by default) +- OS X: key up with a modifier held and our new modifiers code doesn't seem to happen? - OS X: handle Insert/Help key change in a sane and deterministic way - will need old and new Mac keyboards... - make sure MouseEvent's documentation has dragging described correctly (both Windows and GTK+ do)