Ignore events from unknown buttons in wxOSX

In particular, don't map them to left mouse clicks because this is
really wrong.

Ideal would be to handle them in some way, but for now just throwing
them away is better than generating wrong events.

Closes #18967.
This commit is contained in:
Andy Robinson
2020-12-05 23:44:57 +01:00
committed by Vadim Zeitlin
parent 8bf53a7782
commit 2b51c14609

View File

@@ -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