qnsview_key/qnsview_mouse make Ctrl+left click work again

A result of typo/incorrect keyboard modifiers extracted +
wrong button sent via QWindowSystemInterface::handleMouseEvent.

Task-number: QTBUG-70512
Change-Id: I809168e363496884312412051e8d435f5794b3be
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Timur Pocheptsov 2018-09-20 13:22:09 +02:00
parent f30bf5fbd5
commit 2e94947c56
2 changed files with 8 additions and 4 deletions

View File

@ -47,7 +47,7 @@
Qt::KeyboardModifiers qtMods =Qt::NoModifier;
if (modifierFlags & NSEventModifierFlagShift)
qtMods |= Qt::ShiftModifier;
if (modifierFlags & NSEventModifierFlagShift)
if (modifierFlags & NSEventModifierFlagControl)
qtMods |= dontSwapCtrlAndMeta ? Qt::ControlModifier : Qt::MetaModifier;
if (modifierFlags & NSEventModifierFlagOption)
qtMods |= Qt::AltModifier;

View File

@ -198,7 +198,9 @@
const auto modifiers = [QNSView convertKeyModifiers:theEvent.modifierFlags];
const auto buttons = currentlyPressedMouseButtons();
const auto button = cocoaButton2QtButton(theEvent);
auto button = cocoaButton2QtButton(theEvent);
if (button == Qt::LeftButton && m_sendUpAsRightButton)
button = Qt::RightButton;
const auto eventType = cocoaEvent2QtMouseEvent(theEvent);
QWindowSystemInterface::handleMouseEvent(targetView->m_platformWindow->window(),
@ -266,12 +268,14 @@
if (m_sendUpAsRightButton && button == Qt::LeftButton)
button = Qt::RightButton;
if (button == Qt::RightButton)
m_sendUpAsRightButton = false;
m_buttons &= ~button;
[self handleMouseEvent:theEvent];
if (button == Qt::RightButton)
m_sendUpAsRightButton = false;
return true;
}