macOS: Fix reported mouse event buttons

Use m_buttons instead of currentlyPressedMouseButtons. The latter returns
the state of devices combined with synthesized events at the moment,
independent of which events have been delivered via the event stream,
so this method is not suitable for tracking.

Task-number: QTBUG-74057
Task-number: QTBUG-74121
Change-Id: Iabf99ada6c3d25a995c9ddf895059b70833a9051
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
Mikhail Svetkin 2019-05-27 14:27:49 +02:00
parent 4da47d0fba
commit 9a47768b46

View File

@ -277,20 +277,19 @@
nativeDrag->setLastMouseEvent(theEvent, self);
const auto modifiers = [QNSView convertKeyModifiers:theEvent.modifierFlags];
const auto buttons = currentlyPressedMouseButtons();
auto button = cocoaButton2QtButton(theEvent);
if (button == Qt::LeftButton && m_sendUpAsRightButton)
button = Qt::RightButton;
const auto eventType = cocoaEvent2QtMouseEvent(theEvent);
if (eventType == QEvent::MouseMove)
qCDebug(lcQpaMouse) << eventType << "at" << qtWindowPoint << "with" << buttons;
qCDebug(lcQpaMouse) << eventType << "at" << qtWindowPoint << "with" << m_buttons;
else
qCInfo(lcQpaMouse) << eventType << "of" << button << "at" << qtWindowPoint << "with" << buttons;
qCInfo(lcQpaMouse) << eventType << "of" << button << "at" << qtWindowPoint << "with" << m_buttons;
QWindowSystemInterface::handleMouseEvent(targetView->m_platformWindow->window(),
timestamp, qtWindowPoint, qtScreenPoint,
buttons, button, eventType, modifiers);
m_buttons, button, eventType, modifiers);
}
- (bool)handleMouseDownEvent:(NSEvent *)theEvent