summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarlos Manuel Duclos Vergara <carlos.duclos@nokia.com>2010-05-04 09:57:18 (GMT)
committerCarlos Manuel Duclos Vergara <carlos.duclos@nokia.com>2010-05-04 10:34:34 (GMT)
commit923110602c653ae9df9d562e19ef92666a6f8867 (patch)
tree080aff42f24b58cf342446f9a70ebe5b22d4604c /src
parente9f9887cfb6f3eace17640cb951f847d2e4a8c53 (diff)
downloadQt-923110602c653ae9df9d562e19ef92666a6f8867.zip
Qt-923110602c653ae9df9d562e19ef92666a6f8867.tar.gz
Qt-923110602c653ae9df9d562e19ef92666a6f8867.tar.bz2
Suggestions' widget on another space
The problem here arises from the fact that when a window is raisen we didn't check the current space. This patch fixes that and adds a simple logic so the window is raisen in the right space. Task-number: QTCREATORBUG-827 Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwidget_mac.mm23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index e29b755..81dd746 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3824,9 +3824,28 @@ void QWidgetPrivate::raise_sys()
#if QT_MAC_USE_COCOA
QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
- // Calling orderFront shows the window on Cocoa too.
+ // With the introduction of spaces it is not as simple as just raising the window.
+ // First we need to check if we are in the right space. If we are, then we just continue
+ // as usual. The problem comes when we are not in the active space. There are two main cases:
+ // 1. Our parent was moved to a new space. In this case we want the window to be raised
+ // in the same space as its parent.
+ // 2. We don't have a parent. For this case we will just raise the window and let Cocoa
+ // switch to the corresponding space.
+ // NOTICE: There are a lot of corner cases here. We are keeping this simple for now, if
+ // required we will introduce special handling for some of them.
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
- [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)];
+ OSWindowRef window = qt_mac_window_for(q);
+ if(![window isOnActiveSpace]) {
+ QWidget *parentWidget = q->parentWidget();
+ if(parentWidget) {
+ OSWindowRef parentWindow = qt_mac_window_for(parentWidget);
+ if(parentWindow && [parentWindow isOnActiveSpace]) {
+ recreateMacWindow();
+ window = qt_mac_window_for(q);
+ }
+ }
+ }
+ [window orderFront:window];
}
if (qt_mac_raise_process) { //we get to be the active process now
ProcessSerialNumber psn;