diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-03-27 18:41:39 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-03-28 12:30:24 +0000 |
commit | 22a414ab3d988b8819f5738e740caa775ad34697 (patch) | |
tree | df05a4c7dfe4ce5da42fe5450640dc9331af4b6b /src/plugins | |
parent | dd385741605df2dd0cd977ebd8cd49cbf5d90271 (diff) |
macOS: Remove workaround for default-sized NSViews
The workaround introduced in 38a55c7 to explicitly call viewDidChangeFrame()
was not ideal for a multitude of reasons. Instead we can just initialize the
NSView with a NSZeroRect frame, which will ensure that whatever geometry
we set from the Qt side will result in geometry change and expose events.
The only case where we will not receive an expose event is if the QWindow
is requested to be 0x0 sized, but that wouldn't warrant an expose event
anyways. Also, it's not possible to initialize a QWindow to 0x0 from the
Qt side, as that will trigger QPlatformWindow::initialGeometry() to pick
the default size (160x160 in the case of macOS).
Task-number: QTBUG-58963
Change-Id: Ia84de7edcfdf26b90e4e93186fabe8b5c7382caa
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 7 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 8 |
3 files changed, 1 insertions, 15 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index d531003abe..e9bcaa8f41 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1645,13 +1645,6 @@ void QCocoaWindow::recreateWindowIfNeeded() [m_nsWindow setContentView:m_view]; [m_view release]; [m_view setPostsFrameChangedNotifications:YES]; - // QTBUG-58963 - // viewDidChangeFrame() should be called for each window automatically at this point because it is - // registered with Q_NOTIFICATION_HANDLER(NSViewFrameDidChangeNotification); - // The corner case when it's not called and we need to make a manual geometry update is when window's - // size is not specified explicitly but minimumSize is set and matches to the size NSView was created with. - if (QSizeF::fromCGSize(m_view.frame.size) == [QNSView defaultViewSize]) - viewDidChangeFrame(); } } diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index a05bd66890..75a508370f 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -88,7 +88,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); QSet<quint32> m_acceptedKeyDowns; } -+ (QSizeF)defaultViewSize; - (id)init; - (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow; #ifndef QT_NO_OPENGL diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 967271be9c..296b6a28cc 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -140,8 +140,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (id) init { - self = [super initWithFrame : NSMakeRect(0, 0, [[self class] defaultViewSize].width(), [[self class] defaultViewSize].height())]; - if (self) { + if (self = [super initWithFrame:NSZeroRect]) { m_backingStore = 0; m_maskImage = 0; m_shouldInvalidateWindowShadow = false; @@ -189,11 +188,6 @@ static bool _q_dontOverrideCtrlLMB = false; [super dealloc]; } -+ (QSizeF)defaultViewSize -{ - return QSizeF(300.0, 300.0); -} - - (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow { self = [self init]; |