diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-03 23:52:26 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-03 23:52:26 -0400 |
| commit | 2884d45f0f05fd19442aa2396c55fc97182d3afc (patch) | |
| tree | d6b9b4f30e311e34ff999cb01f5eb595eb5081ca | |
| parent | 2e617611c5c1214f1bf9eb9460d0282a5885a9a7 (diff) | |
Fixed mouse move events on Mac OS X not returning buttons right, I think: turns out I was sending the wrong message in. Now I have to figure out how to filter out mouse move messages; then I can really make sure this works right...
| -rw-r--r-- | area_darwin.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/area_darwin.go b/area_darwin.go index 2f93614..a0223e5 100644 --- a/area_darwin.go +++ b/area_darwin.go @@ -118,9 +118,12 @@ func areaView_isFlipped_acceptsFirstResponder(self C.id, sel C.SEL) C.BOOL { } var ( + _NSEvent = objc_getClass("NSEvent") + _modifierFlags = sel_getUid("modifierFlags") _buttonNumber = sel_getUid("buttonNumber") _clickCount = sel_getUid("clickCount") + _pressedMouseButtons = sel_getUid("pressedMouseButtons") ) func parseModifiers(e C.id) (m Modifiers) { @@ -168,7 +171,8 @@ func areaMouseEvent(self C.id, e C.id, click bool, up bool) { } else { which = 0 // reset for Held processing below } - held := C.objc_msgSend_uintret_noargs(e, _clickCount) + // pressedMouseButtons is a class method; calling objc_msgSend() directly with e as an argument on these will panic (in real Objective-C the compiler can detect [e pressedMouseButtons]) + held := C.objc_msgSend_uintret_noargs(_NSEvent, _pressedMouseButtons) if which != 1 && (held & 1) != 0 { // button 1 me.Held = append(me.Held, 1) } |
