Ensure ctrl + click sends a right mouse button press in Cocoa
Since Mac's typically just have one button for their mice then pressing Control then clicking the button should end it as a right mouse button event. Task-number: QTBUG-28350 Change-Id: Iabcac5b315c36cb8cd062c27d7b1506bc066f5bb Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
348c5bd19a
commit
f6cc1f3aea
@ -66,6 +66,7 @@ QT_END_NAMESPACE
|
||||
QString m_composingText;
|
||||
bool m_sendKeyEvent;
|
||||
QStringList *currentCustomDragTypes;
|
||||
bool m_sendUpAsRightButton;
|
||||
Qt::KeyboardModifiers currentWheelModifiers;
|
||||
bool m_subscribesForGlobalFrameNotifications;
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ static QTouchDevice *touchDevice = 0;
|
||||
m_sendKeyEvent = false;
|
||||
m_subscribesForGlobalFrameNotifications = false;
|
||||
currentCustomDragTypes = 0;
|
||||
m_sendUpAsRightButton = false;
|
||||
|
||||
if (!touchDevice) {
|
||||
touchDevice = new QTouchDevice;
|
||||
@ -427,6 +428,7 @@ static QTouchDevice *touchDevice = 0;
|
||||
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
m_sendUpAsRightButton = false;
|
||||
if (m_platformWindow->m_activePopupWindow) {
|
||||
QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow);
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
@ -438,7 +440,12 @@ static QTouchDevice *touchDevice = 0;
|
||||
[inputManager handleMouseEvent:theEvent];
|
||||
}
|
||||
} else {
|
||||
m_buttons |= Qt::LeftButton;
|
||||
if ([self convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) {
|
||||
m_buttons |= Qt::RightButton;
|
||||
m_sendUpAsRightButton = true;
|
||||
} else {
|
||||
m_buttons |= Qt::LeftButton;
|
||||
}
|
||||
[self handleMouseEvent:theEvent];
|
||||
}
|
||||
}
|
||||
@ -452,7 +459,12 @@ static QTouchDevice *touchDevice = 0;
|
||||
|
||||
- (void)mouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
m_buttons &= QFlag(~int(Qt::LeftButton));
|
||||
if (m_sendUpAsRightButton) {
|
||||
m_buttons &= QFlag(~int(Qt::RightButton));
|
||||
m_sendUpAsRightButton = false;
|
||||
} else {
|
||||
m_buttons &= QFlag(~int(Qt::LeftButton));
|
||||
}
|
||||
[self handleMouseEvent:theEvent];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user