From 3c69751ef237f4ee45623e6d28ddf5b8a19d2b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@digia.com> Date: Wed, 8 May 2013 14:34:43 +0200 Subject: [PATCH] Prevent windows from jumping when changing geometry on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were setting the frame origin and content size as two separate steps. The frame origin was asynchronous, while the content size was synchronous. This resulted in the window visually jumping/moving, instead of applying the new geometry in one single step. We now set both in one go using setFrame, by manually calculating the frameRectForContentRect. This makes the whole process asynchronous. Task-number: QTBUG-31039 Change-Id: Iaba46106b9f200c707507f330fa801c99e2e7d89 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> --- src/plugins/platforms/cocoa/qcocoawindow.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ac30338c39d..d4aa32b821d 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -272,8 +272,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) if (m_nsWindow) { NSRect bounds = qt_mac_flipRect(rect, window()); - [m_nsWindow setContentSize : bounds.size]; - [m_nsWindow setFrameOrigin : bounds.origin]; + [m_nsWindow setFrame:[m_nsWindow frameRectForContentRect:bounds] display:YES animate:NO]; } else { [m_contentView setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } -- GitLab