diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 467998f485..619915b4d9 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -1470,6 +1470,26 @@ void wxWidgetCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd) return; } + // The Infinity IN-USB-2 V15 foot pedal on OS 11 produces spurious mouse + // button events with button number = 10. + // We cannot do anything useful with button numbers > 2, so throw them away. + switch ( [event type] ) + { + case NSLeftMouseDown: + case NSRightMouseDown: + case NSOtherMouseDown: + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: + if ( [event buttonNumber] > 2 ) + return; + break; + + default: + // Just to avoid -Wswitch. + break; + } + if ( !DoHandleMouseEvent(event) ) { // for plain NSView mouse events would propagate to parents otherwise