diff options
| author | Pietro Gagliardi <[email protected]> | 2014-05-12 11:34:24 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-05-12 11:34:24 -0400 |
| commit | 29d892d2ffb5a0df1f7bdb170fa63b15230150d6 (patch) | |
| tree | 388dbe223e35313e7883e21f80cd163a2925164e | |
| parent | 496ad98216196e6386e5ce81585205345803d54f (diff) | |
Fixed Mac OS X Area mouse drags being reported outside the actual Area.
| -rw-r--r-- | area_darwin.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/area_darwin.go b/area_darwin.go index c5f0549..afb5b12 100644 --- a/area_darwin.go +++ b/area_darwin.go @@ -179,8 +179,11 @@ func areaMouseEvent(self C.id, e C.id, click bool, up bool) { s := getSysData(self) xp := C.getTranslatedEventPoint(self, e) me.Pos = image.Pt(int(xp.x), int(xp.y)) - // no need to check me.Pos; Cocoa won't send an event outside the Area - // TODO actually wrong; Cocoa will if we drag out of the window + // for the most part, Cocoa won't geenerate an event outside the Area... except when dragging outside the Area, so check for this + max := C.objc_msgSend_stret_rect_noargs(self, _frame) + if !me.Pos.In(image.Rect(0, 0, int(max.width), int(max.height))) { + return + } me.Modifiers = parseModifiers(e) which := uint(C.objc_msgSend_intret_noargs(e, _buttonNumber)) + 1 if which == 3 { // swap middle and right button numbers |
