From af1b64cec8ed74602fafadade936b1768daa9ff2 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 31 May 2010 11:03:24 +0200 Subject: Revert the change in applicationShouldTerminate(). It used to fix an issue during logout but it seems to be fine now. Related issue: QTBUG-6296 Task-number: QTBUG-10993 Reviewed-by: Morten Sorvig --- src/gui/kernel/qcocoaapplicationdelegate_mac.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 5dcf613..7a9dc70 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -196,7 +196,6 @@ static void cleanupCocoaApplicationDelegate() qAppInstance()->quit(); startedQuit = false; } - return NSTerminateNow; } if (qtPrivate->threadData->eventLoops.size() == 0) { -- cgit v0.12 From 5cdafc956f6f2e18012b31d68851150d89d7e577 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 28 May 2010 12:45:30 +0200 Subject: Cocoa: remove 'double' content view from window Up til now, we always used to create a new NSView for a top level widget, and make it a child of the windows content view. This is/should be unnecessary, as NSWindow has a method for setting the content view directly, thereby allowing for reducing the stacking level with one view. Not the biggest gain if the year, but it seems effortless to implement. And I do it as a part of Alien preparation. Rev-By: msorvig --- src/gui/kernel/qwidget_mac.mm | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index f12c956..40c5dad 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -237,6 +237,8 @@ static NSDrawer *qt_mac_drawer_for(const QWidget *widget) static void qt_mac_destructView(OSViewRef view) { #ifdef QT_MAC_USE_COCOA + if ([[view window] contentView] == view) + [[view window] setContentView:0]; [view removeFromSuperview]; [view release]; #else @@ -2285,28 +2287,23 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin Q_UNUSED(dialog); data.fstrut_dirty = true; // when we create a toplevel widget, the frame strut should be dirty + OSViewRef nsview = (OSViewRef)data.winid; - OSViewRef window_contentview = qt_mac_get_contentview_for(windowRef); if (!nsview) { - nsview = qt_mac_create_widget(q, this, window_contentview); + nsview = qt_mac_create_widget(q, this, 0); setWinId(WId(nsview)); - } else { - [window_contentview addSubview:nsview]; - } - if (nsview) { - NSRect bounds = [window_contentview bounds]; - [nsview setFrame:bounds]; - [nsview setHidden:NO]; - if (q->testAttribute(Qt::WA_DropSiteRegistered)) - registerDropSite(true); - transferChildren(); - - // Tell Cocoa explicit that we wan't the view to receive key events - // (regardless of focus policy) because this is how it works on other - // platforms (and in the carbon port): - if (!qApp->focusWidget()) - [windowRef makeFirstResponder:nsview]; } + [windowRef setContentView:nsview]; + [nsview setHidden:NO]; + if (q->testAttribute(Qt::WA_DropSiteRegistered)) + registerDropSite(true); + transferChildren(); + + // Tell Cocoa explicit that we wan't the view to receive key events + // (regardless of focus policy) because this is how it works on other + // platforms (and in the carbon port): + if (!qApp->focusWidget()) + [windowRef makeFirstResponder:nsview]; if (topExtra->posFromMove) { updateFrameStrut(); -- cgit v0.12 From ba9f3e4a232e2199115710a630906fd3da50552a Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 31 May 2010 14:39:03 +0200 Subject: Cocoa: fix broken drawers after content view structure change After setting top level widget views as content views in windows directly, the function this patch fixes, broke. --- src/gui/kernel/qwidget_mac.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 40c5dad..3e0ad40 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -223,6 +223,8 @@ static NSDrawer *qt_mac_drawer_for(const QWidget *widget) for (NSWindow *window in windows) { NSArray *drawers = [window drawers]; for (NSDrawer *drawer in drawers) { + if ([drawer contentView] == widgetView) + return drawer; NSArray *views = [[drawer contentView] subviews]; for (NSView *view in views) { if (view == widgetView) -- cgit v0.12 From 4d66a933837ffc51fdef01f9485be58d5788b787 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 31 May 2010 15:02:54 +0200 Subject: Revert "Cocoa: remove 'double' content view from window" This reverts commit 5cdafc956f6f2e18012b31d68851150d89d7e577. Reason: Broke some autotests (qgl, qglversioncheck). It needs some more investigation. --- src/gui/kernel/qwidget_mac.mm | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 3e0ad40..5bb3f1c 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -239,8 +239,6 @@ static NSDrawer *qt_mac_drawer_for(const QWidget *widget) static void qt_mac_destructView(OSViewRef view) { #ifdef QT_MAC_USE_COCOA - if ([[view window] contentView] == view) - [[view window] setContentView:0]; [view removeFromSuperview]; [view release]; #else @@ -2289,23 +2287,28 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin Q_UNUSED(dialog); data.fstrut_dirty = true; // when we create a toplevel widget, the frame strut should be dirty - OSViewRef nsview = (OSViewRef)data.winid; + OSViewRef window_contentview = qt_mac_get_contentview_for(windowRef); if (!nsview) { - nsview = qt_mac_create_widget(q, this, 0); + nsview = qt_mac_create_widget(q, this, window_contentview); setWinId(WId(nsview)); + } else { + [window_contentview addSubview:nsview]; + } + if (nsview) { + NSRect bounds = [window_contentview bounds]; + [nsview setFrame:bounds]; + [nsview setHidden:NO]; + if (q->testAttribute(Qt::WA_DropSiteRegistered)) + registerDropSite(true); + transferChildren(); + + // Tell Cocoa explicit that we wan't the view to receive key events + // (regardless of focus policy) because this is how it works on other + // platforms (and in the carbon port): + if (!qApp->focusWidget()) + [windowRef makeFirstResponder:nsview]; } - [windowRef setContentView:nsview]; - [nsview setHidden:NO]; - if (q->testAttribute(Qt::WA_DropSiteRegistered)) - registerDropSite(true); - transferChildren(); - - // Tell Cocoa explicit that we wan't the view to receive key events - // (regardless of focus policy) because this is how it works on other - // platforms (and in the carbon port): - if (!qApp->focusWidget()) - [windowRef makeFirstResponder:nsview]; if (topExtra->posFromMove) { updateFrameStrut(); -- cgit v0.12