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;
|
QString m_composingText;
|
||||||
bool m_sendKeyEvent;
|
bool m_sendKeyEvent;
|
||||||
QStringList *currentCustomDragTypes;
|
QStringList *currentCustomDragTypes;
|
||||||
|
bool m_sendUpAsRightButton;
|
||||||
Qt::KeyboardModifiers currentWheelModifiers;
|
Qt::KeyboardModifiers currentWheelModifiers;
|
||||||
bool m_subscribesForGlobalFrameNotifications;
|
bool m_subscribesForGlobalFrameNotifications;
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
m_sendKeyEvent = false;
|
m_sendKeyEvent = false;
|
||||||
m_subscribesForGlobalFrameNotifications = false;
|
m_subscribesForGlobalFrameNotifications = false;
|
||||||
currentCustomDragTypes = 0;
|
currentCustomDragTypes = 0;
|
||||||
|
m_sendUpAsRightButton = false;
|
||||||
|
|
||||||
if (!touchDevice) {
|
if (!touchDevice) {
|
||||||
touchDevice = new QTouchDevice;
|
touchDevice = new QTouchDevice;
|
||||||
@ -427,6 +428,7 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
|
|
||||||
- (void)mouseDown:(NSEvent *)theEvent
|
- (void)mouseDown:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
|
m_sendUpAsRightButton = false;
|
||||||
if (m_platformWindow->m_activePopupWindow) {
|
if (m_platformWindow->m_activePopupWindow) {
|
||||||
QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow);
|
QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow);
|
||||||
QWindowSystemInterface::flushWindowSystemEvents();
|
QWindowSystemInterface::flushWindowSystemEvents();
|
||||||
@ -437,8 +439,13 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
if ([inputManager wantsToHandleMouseEvents]) {
|
if ([inputManager wantsToHandleMouseEvents]) {
|
||||||
[inputManager handleMouseEvent:theEvent];
|
[inputManager handleMouseEvent:theEvent];
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if ([self convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) {
|
||||||
|
m_buttons |= Qt::RightButton;
|
||||||
|
m_sendUpAsRightButton = true;
|
||||||
} else {
|
} else {
|
||||||
m_buttons |= Qt::LeftButton;
|
m_buttons |= Qt::LeftButton;
|
||||||
|
}
|
||||||
[self handleMouseEvent:theEvent];
|
[self handleMouseEvent:theEvent];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -452,7 +459,12 @@ static QTouchDevice *touchDevice = 0;
|
|||||||
|
|
||||||
- (void)mouseUp:(NSEvent *)theEvent
|
- (void)mouseUp:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
|
if (m_sendUpAsRightButton) {
|
||||||
|
m_buttons &= QFlag(~int(Qt::RightButton));
|
||||||
|
m_sendUpAsRightButton = false;
|
||||||
|
} else {
|
||||||
m_buttons &= QFlag(~int(Qt::LeftButton));
|
m_buttons &= QFlag(~int(Qt::LeftButton));
|
||||||
|
}
|
||||||
[self handleMouseEvent:theEvent];
|
[self handleMouseEvent:theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user