macOS: Ctrl LMB override can be set on a per window basis
QNSView instances check the _q_platform_MacDontOverrideCtrlLMB window property along with the QT_MAC_DONT_OVERRIDE_CTRL_LMB environment variable during creation. Change-Id: Id6457fccdce2dff1fa83448dd2bc4d2757a87e9d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
This commit is contained in:
parent
6b17d995b7
commit
f78ef9753c
@ -72,6 +72,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
|||||||
QString m_composingText;
|
QString m_composingText;
|
||||||
bool m_sendKeyEvent;
|
bool m_sendKeyEvent;
|
||||||
QStringList *currentCustomDragTypes;
|
QStringList *currentCustomDragTypes;
|
||||||
|
bool m_dontOverrideCtrlLMB;
|
||||||
bool m_sendUpAsRightButton;
|
bool m_sendUpAsRightButton;
|
||||||
Qt::KeyboardModifiers currentWheelModifiers;
|
Qt::KeyboardModifiers currentWheelModifiers;
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
|
@ -71,8 +71,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
|||||||
|
|
||||||
static QTouchDevice *touchDevice = 0;
|
static QTouchDevice *touchDevice = 0;
|
||||||
|
|
||||||
static bool _q_dontOverrideCtrlLMB = false;
|
|
||||||
|
|
||||||
@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
|
@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
|
||||||
- (CGFloat)deviceDeltaX;
|
- (CGFloat)deviceDeltaX;
|
||||||
- (CGFloat)deviceDeltaY;
|
- (CGFloat)deviceDeltaY;
|
||||||
@ -133,11 +131,6 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView)
|
@implementation QT_MANGLE_NAMESPACE(QNSView)
|
||||||
|
|
||||||
+ (void)initialize
|
|
||||||
{
|
|
||||||
_q_dontOverrideCtrlLMB = qt_mac_resolveOption(false, "QT_MAC_DONT_OVERRIDE_CTRL_LMB");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
if (self = [super initWithFrame:NSZeroRect]) {
|
if (self = [super initWithFrame:NSZeroRect]) {
|
||||||
@ -153,6 +146,7 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
m_shouldSetGLContextinDrawRect = false;
|
m_shouldSetGLContextinDrawRect = false;
|
||||||
#endif
|
#endif
|
||||||
currentCustomDragTypes = 0;
|
currentCustomDragTypes = 0;
|
||||||
|
m_dontOverrideCtrlLMB = false;
|
||||||
m_sendUpAsRightButton = false;
|
m_sendUpAsRightButton = false;
|
||||||
m_inputSource = 0;
|
m_inputSource = 0;
|
||||||
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
|
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
|
||||||
@ -196,6 +190,7 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
|
|
||||||
m_platformWindow = platformWindow;
|
m_platformWindow = platformWindow;
|
||||||
m_sendKeyEvent = false;
|
m_sendKeyEvent = false;
|
||||||
|
m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, platformWindow->window(), "_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB");
|
||||||
m_trackingArea = nil;
|
m_trackingArea = nil;
|
||||||
|
|
||||||
#ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR
|
#ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR
|
||||||
@ -855,7 +850,7 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
if ([self hasMarkedText]) {
|
if ([self hasMarkedText]) {
|
||||||
[[NSTextInputContext currentInputContext] handleEvent:theEvent];
|
[[NSTextInputContext currentInputContext] handleEvent:theEvent];
|
||||||
} else {
|
} else {
|
||||||
if (!_q_dontOverrideCtrlLMB && [QNSView convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) {
|
if (!m_dontOverrideCtrlLMB && [QNSView convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) {
|
||||||
m_buttons |= Qt::RightButton;
|
m_buttons |= Qt::RightButton;
|
||||||
m_sendUpAsRightButton = true;
|
m_sendUpAsRightButton = true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user