Added new Modifiers code for Mac OS X. Also fixed some comment typos and added more TODOs.

This commit is contained in:
Pietro Gagliardi 2014-05-29 14:26:20 -04:00
parent 4bb028b976
commit b648af160b
2 changed files with 5 additions and 1 deletions

View File

@ -171,7 +171,7 @@ func areaView_flagsChanged(self C.id, e C.id) C.BOOL {
var ke KeyEvent var ke KeyEvent
// Mac OS X sends this event on both key up and key down. // 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)) keyCode := uintptr(C.keyCode(e))
mod, ok := keycodeModifiers[keyCode] // comma-ok form to avoid adding entries mod, ok := keycodeModifiers[keyCode] // comma-ok form to avoid adding entries
if !ok { // unknown modifier; ignore 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.Modifiers = parseModifiers(e)
ke.Up = (ke.Modifiers & mod) == 0 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)) return toBOOL(sendKeyEvent(self, e, ke))
} }

View File

@ -5,6 +5,7 @@ important things:
super ultra 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... - 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) - 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 - OS X: handle Insert/Help key change in a sane and deterministic way
- will need old and new Mac keyboards... - will need old and new Mac keyboards...
- make sure MouseEvent's documentation has dragging described correctly (both Windows and GTK+ do) - make sure MouseEvent's documentation has dragging described correctly (both Windows and GTK+ do)