diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.mm | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 5676d8bd15..08024b7bc6 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -618,20 +618,17 @@ InvalidContext: Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum) { - switch (buttonNum) { - case 0: + if (buttonNum == 0) return Qt::LeftButton; - case 1: + if (buttonNum == 1) return Qt::RightButton; - case 2: - return Qt::MidButton; - case 3: - return Qt::XButton1; - case 4: - return Qt::XButton2; - default: - return Qt::NoButton; + if (buttonNum == 2) + return Qt::MiddleButton; + if (buttonNum >= 3 && buttonNum <= 31) { // handle XButton1 and higher via logical shift + return Qt::MouseButton(uint(Qt::MiddleButton) << (buttonNum - 3)); } + // else error: buttonNum too high, or negative + return Qt::NoButton; } bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret) { |