summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-14 09:05:42 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-14 09:06:31 +0200
commit5c23199d4e8ff21661dfa5aacc13149178e78cab (patch)
tree322aee61581d7c85f1ccb65e47d1e79eba1ba6c9 /src/plugins/platforms/cocoa
parent252bad7c589e03d3e12df02354b00a84d8e3159a (diff)
parentc8d9b17367cfdcb034d11f8a168ca4ae3993e7c3 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: configure mkspecs/macx-xcode/Info.plist.app mkspecs/macx-xcode/Info.plist.lib qmake/doc/qmake.qdocconf src/corelib/global/qglobal.h tests/auto/other/exceptionsafety/exceptionsafety.pro tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp Change-Id: I3c769a4a82dc2e99a12c69123fbf17613fd2ac2a
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm18
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm19
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm2
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm5
6 files changed, 29 insertions, 20 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 7224ee2ff8..59fda96dff 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -84,6 +84,8 @@ public:
inline NSMenuItem *nsMenuItem() const
{ return m_nativeItem; }
+ inline bool isVisible() const { return m_visible; }
+
virtual QPlatformMenuItem *menuItemAt(int position) const;
virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const;
@@ -100,6 +102,7 @@ private:
NSMenuItem *m_nativeItem;
NSObject *m_delegate;
bool m_enabled;
+ bool m_visible;
quintptr m_tag;
QCocoaMenuBar *m_menuBar;
};
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 8c4325a775..3ac48df09e 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -218,6 +218,7 @@ QT_BEGIN_NAMESPACE
QCocoaMenu::QCocoaMenu() :
m_enabled(true),
+ m_visible(true),
m_tag(0),
m_menuBar(0)
{
@@ -423,6 +424,7 @@ void QCocoaMenu::setEnabled(bool enabled)
void QCocoaMenu::setVisible(bool visible)
{
[m_nativeItem setSubmenu:(visible ? m_nativeMenu : nil)];
+ m_visible = visible;
}
void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item)
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index da2704f19c..0fea55ac68 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -149,15 +149,17 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
Q_FOREACH (QCocoaMenuItem *item, cocoaMenu->items())
cocoaMenu->syncMenuItem(item);
- // If the NSMenu has no visble items, or only separators, we should hide it
- // on the menubar. This can happen after syncing the menu items since they
- // can be moved to other menus.
BOOL shouldHide = YES;
- for (NSMenuItem *item in [cocoaMenu->nsMenu() itemArray])
- if (![item isSeparatorItem] && ![item isHidden]) {
- shouldHide = NO;
- break;
- }
+ if (cocoaMenu->isVisible()) {
+ // If the NSMenu has no visble items, or only separators, we should hide it
+ // on the menubar. This can happen after syncing the menu items since they
+ // can be moved to other menus.
+ for (NSMenuItem *item in [cocoaMenu->nsMenu() itemArray])
+ if (![item isSeparatorItem] && ![item isHidden]) {
+ shouldHide = NO;
+ break;
+ }
+ }
[cocoaMenu->nsMenuItem() setHidden:shouldHide];
}
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index cc72f050d2..fcebb7e0dc 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -270,7 +270,6 @@ void QCocoaWindow::setGeometry(const QRect &rect)
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
qDebug() << "QCocoaWindow::setGeometry" << this << rect;
#endif
- QPlatformWindow::setGeometry(rect);
setCocoaGeometry(rect);
}
@@ -278,8 +277,10 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
{
QCocoaAutoReleasePool pool;
- if (m_contentViewIsEmbedded)
+ if (m_contentViewIsEmbedded) {
+ QPlatformWindow::setGeometry(rect);
return;
+ }
if (m_nsWindow) {
NSRect bounds = qt_mac_flipRect(rect, window());
@@ -287,6 +288,8 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
} else {
[m_contentView setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
+
+ // will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
}
void QCocoaWindow::setVisible(bool visible)
@@ -423,11 +426,13 @@ NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags)
if (type == Qt::ToolTip)
windowLevel = NSScreenSaverWindowLevel;
- // A window should be in at least the same level as its parent.
- const QWindow * const transientParent = window()->transientParent();
- const QCocoaWindow * const transientParentWindow = transientParent ? static_cast<QCocoaWindow *>(transientParent->handle()) : 0;
- if (transientParentWindow)
- windowLevel = qMax([transientParentWindow->m_nsWindow level], windowLevel);
+ // Any "special" window should be in at least the same level as its parent.
+ if (type != Qt::Window) {
+ const QWindow * const transientParent = window()->transientParent();
+ const QCocoaWindow * const transientParentWindow = transientParent ? static_cast<QCocoaWindow *>(transientParent->handle()) : 0;
+ if (transientParentWindow)
+ windowLevel = qMax([transientParentWindow->m_nsWindow level], windowLevel);
+ }
return windowLevel;
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 285e4aeb9f..b8f0fc3cce 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1049,7 +1049,7 @@ static QTouchDevice *touchDevice = 0;
timestamp,
(lastKnownModifiers & mac_mask) ? QEvent::KeyRelease : QEvent::KeyPress,
modifier_key_symbols[i].qt_code,
- qmodifiers);
+ qmodifiers ^ [QNSView convertKeyModifiers:mac_mask]);
}
}
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index 2dedf99582..ee8d7ea157 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -187,10 +187,8 @@ void QMacPrintEnginePrivate::setPaperName(const QString &name)
if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) {
CFArrayRef array;
- if (PMPrinterGetPaperList(printer, &array) != noErr) {
- PMRelease(printer);
+ if (PMPrinterGetPaperList(printer, &array) != noErr)
return;
- }
int count = CFArrayGetCount(array);
for (int i = 0; i < count; ++i) {
PMPaper paper = static_cast<PMPaper>(const_cast<void *>(CFArrayGetValueAtIndex(array, i)));
@@ -208,7 +206,6 @@ void QMacPrintEnginePrivate::setPaperName(const QString &name)
}
}
}
- PMRelease(printer);
}
}