summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-28 11:07:32 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-28 11:10:29 +0100
commit02ba93dd3dc640421c79c655064f0b2c4f1465cd (patch)
tree156ccba392968d3d2ba3bcb5bb098a1ff0b7e8ce /src/plugins/platforms/cocoa
parentbf5f2a9e3e3bf70c373b65bf95a332f4e1c514f9 (diff)
parent0b68fc019bbeedb8b6b59bbbdf31f66596b6d5ac (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm19
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.h2
-rw-r--r--src/plugins/platforms/cocoa/qmacmime.mm11
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm113
6 files changed, 32 insertions, 117 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index b99b7e07bb..bb907674dc 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -881,7 +881,7 @@ void QCocoaEventDispatcherPrivate::cleanupModalSessions()
void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
{
// We need to start spinning the modal session. Usually this is done with
- // QDialog::exec() for QtWidgets based applications, but for others that
+ // QDialog::exec() for Qt Widgets based applications, but for others that
// just call show(), we need to interrupt(). We call this here, before
// setting currentModalSessionCached to zero, so that interrupt() calls
// [NSApp abortModal] if another modal session is currently running
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) {
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index 60bcd82aae..2a9dcec64b 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -88,7 +88,7 @@ QString qt_mac_applicationmenu_string(int type)
The reason for having the nib file is that those can not be created
programmatically. To ease deployment the nib files are stored in Qt resources
and written to QDir::temp() before loading. (Earlier Qt versions used
- to require having the nib file in the QtGui framework.)
+ to require having the nib file in the Qt GUI framework.)
*/
void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader)
{
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
index 825f88a269..34e8fb61e2 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
@@ -82,7 +82,7 @@ private:
Q_INVOKABLE QPlatformPrinterSupport *createPlatformPrinterSupport();
/*
Function to return the NSPrintInfo * from QMacPaintEnginePrivate.
- Needed by the native print dialog in the QtPrintSupport library.
+ Needed by the native print dialog in the Qt Print Support module.
*/
Q_INVOKABLE void *NSPrintInfoForPrintEngine(QPrintEngine *printEngine);
diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/plugins/platforms/cocoa/qmacmime.mm
index 339559b6a6..89539de331 100644
--- a/src/plugins/platforms/cocoa/qmacmime.mm
+++ b/src/plugins/platforms/cocoa/qmacmime.mm
@@ -68,7 +68,10 @@ Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList)
void qt_mac_addToGlobalMimeList(QMacPasteboardMime *macMime)
{
- globalMimeList()->append(macMime);
+ // globalMimeList is in decreasing priority order. Recently added
+ // converters take prioity over previously added converters: prepend
+ // to the list.
+ globalMimeList()->prepend(macMime);
}
void qt_mac_removeFromGlobalMimeList(QMacPasteboardMime *macMime)
@@ -810,6 +813,10 @@ QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime,
void QMacPasteboardMime::initializeMimeTypes()
{
if (globalMimeList()->isEmpty()) {
+ // Create QMacPasteboardMimeAny first to put it at the end of globalMimeList
+ // with lowest priority. (the constructor prepends to the list)
+ new QMacPasteboardMimeAny;
+
//standard types that we wrap
new QMacPasteboardMimeTiff;
new QMacPasteboardMimeUnicodeText;
@@ -819,8 +826,6 @@ void QMacPasteboardMime::initializeMimeTypes()
new QMacPasteboardMimeUrl;
new QMacPasteboardMimeTypeName;
new QMacPasteboardMimeVCard;
- //make sure our "non-standard" types are always last! --Sam
- new QMacPasteboardMimeAny;
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 61ddfe9498..5d39dd2d9c 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -420,14 +420,19 @@ static QTouchDevice *touchDevice = 0;
m_buttons |= Qt::LeftButton;
break;
case NSLeftMouseUp:
- m_buttons &= QFlag(~int(Qt::LeftButton));
+ m_buttons &= ~Qt::LeftButton;
break;
case NSRightMouseDown:
m_buttons |= Qt::RightButton;
break;
case NSRightMouseUp:
- m_buttons &= QFlag(~int(Qt::RightButton));
+ m_buttons &= ~Qt::RightButton;
break;
+ case NSOtherMouseDown:
+ m_buttons |= cocoaButton2QtButton([theEvent buttonNumber]);
+ break;
+ case NSOtherMouseUp:
+ m_buttons &= ~cocoaButton2QtButton([theEvent buttonNumber]);
default:
break;
}
@@ -482,10 +487,10 @@ static QTouchDevice *touchDevice = 0;
- (void)mouseUp:(NSEvent *)theEvent
{
if (m_sendUpAsRightButton) {
- m_buttons &= QFlag(~int(Qt::RightButton));
+ m_buttons &= ~Qt::RightButton;
m_sendUpAsRightButton = false;
} else {
- m_buttons &= QFlag(~int(Qt::LeftButton));
+ m_buttons &= ~Qt::LeftButton;
}
[self handleMouseEvent:theEvent];
}
@@ -556,59 +561,13 @@ static QTouchDevice *touchDevice = 0;
- (void)rightMouseUp:(NSEvent *)theEvent
{
- m_buttons &= QFlag(~int(Qt::RightButton));
+ m_buttons &= ~Qt::RightButton;
[self handleMouseEvent:theEvent];
}
- (void)otherMouseDown:(NSEvent *)theEvent
{
- switch ([theEvent buttonNumber]) {
- case 3:
- m_buttons |= Qt::MiddleButton;
- break;
- case 4:
- m_buttons |= Qt::ExtraButton1; // AKA Qt::BackButton
- break;
- case 5:
- m_buttons |= Qt::ExtraButton2; // AKA Qt::ForwardButton
- break;
- case 6:
- m_buttons |= Qt::ExtraButton3;
- break;
- case 7:
- m_buttons |= Qt::ExtraButton4;
- break;
- case 8:
- m_buttons |= Qt::ExtraButton5;
- break;
- case 9:
- m_buttons |= Qt::ExtraButton6;
- break;
- case 10:
- m_buttons |= Qt::ExtraButton7;
- break;
- case 11:
- m_buttons |= Qt::ExtraButton8;
- break;
- case 12:
- m_buttons |= Qt::ExtraButton9;
- break;
- case 13:
- m_buttons |= Qt::ExtraButton10;
- break;
- case 14:
- m_buttons |= Qt::ExtraButton11;
- break;
- case 15:
- m_buttons |= Qt::ExtraButton12;
- break;
- case 16:
- m_buttons |= Qt::ExtraButton13;
- break;
- default:
- m_buttons |= Qt::MiddleButton;
- break;
- }
+ m_buttons |= cocoaButton2QtButton([theEvent buttonNumber]);
[self handleMouseEvent:theEvent];
}
@@ -621,53 +580,7 @@ static QTouchDevice *touchDevice = 0;
- (void)otherMouseUp:(NSEvent *)theEvent
{
- switch ([theEvent buttonNumber]) {
- case 3:
- m_buttons &= QFlag(~int(Qt::MiddleButton));
- break;
- case 4:
- m_buttons &= QFlag(~int(Qt::ExtraButton1)); // AKA Qt::BackButton
- break;
- case 5:
- m_buttons &= QFlag(~int(Qt::ExtraButton2)); // AKA Qt::ForwardButton
- break;
- case 6:
- m_buttons &= QFlag(~int(Qt::ExtraButton3));
- break;
- case 7:
- m_buttons &= QFlag(~int(Qt::ExtraButton4));
- break;
- case 8:
- m_buttons &= QFlag(~int(Qt::ExtraButton5));
- break;
- case 9:
- m_buttons &= QFlag(~int(Qt::ExtraButton6));
- break;
- case 10:
- m_buttons &= QFlag(~int(Qt::ExtraButton7));
- break;
- case 11:
- m_buttons &= QFlag(~int(Qt::ExtraButton8));
- break;
- case 12:
- m_buttons &= QFlag(~int(Qt::ExtraButton9));
- break;
- case 13:
- m_buttons &= QFlag(~int(Qt::ExtraButton10));
- break;
- case 14:
- m_buttons &= QFlag(~int(Qt::ExtraButton11));
- break;
- case 15:
- m_buttons &= QFlag(~int(Qt::ExtraButton12));
- break;
- case 16:
- m_buttons &= QFlag(~int(Qt::ExtraButton13));
- break;
- default:
- m_buttons &= QFlag(~int(Qt::MiddleButton));
- break;
- }
+ m_buttons &= ~cocoaButton2QtButton([theEvent buttonNumber]);
[self handleMouseEvent:theEvent];
}
@@ -1259,7 +1172,7 @@ static QTouchDevice *touchDevice = 0;
// keep our state, and QGuiApplication state (buttons member) in-sync,
// or future mouse events will be processed incorrectly
- m_buttons &= QFlag(~int(Qt::LeftButton));
+ m_buttons &= ~Qt::LeftButton;
NSPoint windowPoint = [self convertPoint: point fromView: nil];
QPoint qtWindowPoint(windowPoint.x, windowPoint.y);