summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-02-04 11:21:24 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-02-04 11:25:37 (GMT)
commit818ef4e93f40f2c3c6cf9d2a0a1fc42150f0d0cd (patch)
treea663338a14cb947ec0013348bda9e37936482aa6 /src/gui/kernel
parentc111ccb7ff961c76e424bfab3a3bf6a1b43865dc (diff)
downloadQt-818ef4e93f40f2c3c6cf9d2a0a1fc42150f0d0cd.zip
Qt-818ef4e93f40f2c3c6cf9d2a0a1fc42150f0d0cd.tar.gz
Qt-818ef4e93f40f2c3c6cf9d2a0a1fc42150f0d0cd.tar.bz2
Cocoa: Tool Windows steal focus from the main window
The example that shows this off is tools/inputpanel. This example is strangely written, and calls activateWindow on the main window in an activate callback to another window. So a bit recursion will happend, and this caused troubble for the cocoa port. In addition, in Qt several windows can be active at the same time, expecially tool windows. This means that we need to be careful when returning early from the becomeKeyWindow methods for NSWindow. This patch fixes up on this stuff. Task-number: QTBUG-6002 Reviewed-by: msorvig
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h3
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm7
-rw-r--r--src/gui/kernel/qwidget_mac.mm2
3 files changed, 3 insertions, 9 deletions
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index 2117551..d8bbcd4 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -95,7 +95,8 @@ QT_END_NAMESPACE
bool isToolTip = (widget->windowType() == Qt::ToolTip);
bool isPopup = (widget->windowType() == Qt::Popup);
- return !(isPopup || isToolTip);
+ bool isTool = (widget->windowType() == Qt::Tool);
+ return !(isPopup || isToolTip || isTool);
}
- (void)orderWindow:(NSWindowOrderingMode)orderingMode relativeTo:(NSInteger)otherWindowNumber
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index db87491..24498f8 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -269,9 +269,6 @@ static void cleanupCocoaWindowDelegate()
{
QWidget *qwidget = m_windowHash->value([notification object]);
Q_ASSERT(qwidget);
- if (qwidget->isActiveWindow())
- return; // Widget is already active, no need to go through re-activation.
-
onApplicationWindowChangedActivation(qwidget, true);
}
@@ -288,10 +285,6 @@ static void cleanupCocoaWindowDelegate()
{
QWidget *qwidget = m_windowHash->value([notification object]);
Q_ASSERT(qwidget);
- if (qwidget->isActiveWindow())
- return; // Widget is already active, no need to go through re-activation
-
-
onApplicationWindowChangedActivation(qwidget, true);
}
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 43b945e..878b776 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3233,10 +3233,10 @@ void QWidget::activateWindow()
|| windowActive) {
#ifndef QT_MAC_USE_COCOA
ActivateWindow(win, true);
+ qApp->setActiveWindow(tlw);
#else
[win makeKeyWindow];
#endif
- qApp->setActiveWindow(tlw);
} else if(!isMinimized()) {
#ifndef QT_MAC_USE_COCOA
SelectWindow(win);