diff options
author | culler <culler> | 2020-04-15 17:24:51 (GMT) |
---|---|---|
committer | culler <culler> | 2020-04-15 17:24:51 (GMT) |
commit | ef67d7e478dcdd96b095c80fbf1d95330ee35117 (patch) | |
tree | fc8f026a7f5ad5bdbe8b27f50f3d07c3195c0c4b /macosx/tkMacOSXMouseEvent.c | |
parent | f098336486ba362a5b694d93a949fe6e8b23891a (diff) | |
download | tk-ef67d7e478dcdd96b095c80fbf1d95330ee35117.zip tk-ef67d7e478dcdd96b095c80fbf1d95330ee35117.tar.gz tk-ef67d7e478dcdd96b095c80fbf1d95330ee35117.tar.bz2 |
Apply a patch from Christopher Chavez which correctly deals with the fact that Apple uses the middle mouse button for Button 3.
Diffstat (limited to 'macosx/tkMacOSXMouseEvent.c')
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index f4156fe..dd50d0a 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -55,6 +55,7 @@ enum { TkWindow *winPtr = NULL, *grabWinPtr; Tk_Window tkwin; NSPoint local, global; + NSInteger button = -1; #if 0 NSTrackingArea *trackingArea = nil; NSInteger eventNumber, clickCount, buttonNumber; @@ -65,18 +66,19 @@ enum { TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif switch (eventType) { - case NSMouseEntered: - case NSMouseExited: - case NSCursorUpdate: case NSLeftMouseDown: - case NSLeftMouseUp: case NSRightMouseDown: - case NSRightMouseUp: case NSOtherMouseDown: - case NSOtherMouseUp: case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: + button = [theEvent buttonNumber] + Button1; + case NSMouseEntered: + case NSMouseExited: + case NSCursorUpdate: + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: case NSMouseMoved: case NSTabletPoint: case NSTabletProximity: @@ -226,26 +228,8 @@ enum { */ unsigned int state = 0; - int button = [theEvent buttonNumber] + Button1; - EventRef eventRef = (EventRef)[theEvent eventRef]; - UInt32 buttons; - OSStatus err = GetEventParameter(eventRef, kEventParamMouseChord, - typeUInt32, NULL, sizeof(UInt32), NULL, &buttons); - - if (err == noErr) { - state |= (buttons & 0x1F) * Button1Mask; - } else if (button <= Button5) { - switch (eventType) { - case NSLeftMouseDown: - case NSRightMouseDown: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDown: - state |= TkGetButtonMask(button); - break; - default: - break; - } + if (button > 0) { + state |= TkGetButtonMask(button); } NSUInteger modifiers = [theEvent modifierFlags]; |