diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-10-18 16:02:00 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-10-20 06:50:56 (GMT) |
commit | 5b82db6e59aee775a5acc477d6e9dac9c453876d (patch) | |
tree | 70c10a6afeaf874bf574ce32d6ab5d20274236dd /src/gui/kernel/qwidget_mac.mm | |
parent | b6d86906b5f2a5fa779bb9b899a6a945a1c3ea27 (diff) | |
download | Qt-5b82db6e59aee775a5acc477d6e9dac9c453876d.zip Qt-5b82db6e59aee775a5acc477d6e9dac9c453876d.tar.gz Qt-5b82db6e59aee775a5acc477d6e9dac9c453876d.tar.bz2 |
Cocoa: modal window reappears on screen after reactivating app
If you close a modal window, then activate different app, then
activate app again, the window will pop non-modal in front.
This patch makes sure that when we hide a window, we point
to the next window to receive keyboard focus.
Rev-By: MortenS
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index c966aa3..05c6a5b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -305,6 +305,8 @@ bool qt_mac_insideKeyWindow(const QWidget *w) { #ifdef QT_MAC_USE_COCOA return [[reinterpret_cast<NSView *>(w->winId()) window] isKeyWindow]; +#else + Q_UNUSED(w); #endif return false; } @@ -3301,7 +3303,11 @@ void QWidgetPrivate::show_sys() [window miniaturize:window]; #endif } else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) { +#ifndef QT_MAC_USE_COCOA qt_event_request_activate(q); +#else + [qt_mac_window_for(q) makeKeyWindow]; +#endif } } else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) { #ifndef QT_MAC_USE_COCOA @@ -3404,8 +3410,13 @@ void QWidgetPrivate::hide_sys() } #endif } - if(w && w->isVisible() && !w->isMinimized()) - qt_event_request_activate(w); + if(w && w->isVisible() && !w->isMinimized()) { +#ifndef QT_MAC_USE_COCOA + qt_event_request_activate(w); +#else + [qt_mac_window_for(w) makeKeyWindow]; +#endif + } } } else { invalidateBuffer(q->rect()); |