From fcba9ea8c646f1f3ed7e8b8c75bb841f9116ee7d Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 21 Apr 2010 12:47:29 +0200 Subject: Cocoa: cocoa sometimes show a hidden window If we tell the only window in an app to hide, deactivate the app, and then activate it again, the window will show on screen (and be unresponsive). The reason is that cocoa still sees the window as the main window (and I cannot find a way to tell cocoa otherwise). This patch works around the problem by hiding the window again if it becomes main while being hidden. Reviewed-by: msorvig --- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index ec00915..e94d247 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -101,6 +101,17 @@ QT_END_NAMESPACE return !(isPopup || isToolTip || isTool); } +- (void)becomeMainWindow +{ + [super becomeMainWindow]; + // Cocoa sometimes tell a hidden window to become the + // main window (and as such, show it). This can e.g + // happend when the application gets activated. If + // this is the case, we tell it to hide again: + if (![self isVisible]) + [self orderOut:self]; +} + - (void)toggleToolbarShown:(id)sender { macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]); -- cgit v0.12