diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-10-05 21:56:58 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-10-10 16:06:41 +0000 |
commit | f835b5aa9cba2665423e6e96a45d97c3c80296a5 (patch) | |
tree | 32f35432d9046302b799cb55a067195059e40580 /src/plugins/platforms/cocoa/qnswindowdelegate.mm | |
parent | 1df4b2a3609d977cc8123f1f82e454d0333287d4 (diff) |
macOS: Get rid of m_qtView member in QCocoaWindow that aliased m_view
The member was mirroring m_view in all cases except for foreign windows.
Instead of a member we now check window()->type() != Qt::ForeignWindow,
which is more explicit, especially for people not normally working on
the macOS platform.
To call methods that are only implemented for our QNSView subclass,
a new qnsview_cast() function has been introduced.
Change-Id: I0a2cfe1a5e4502250c17e1c3ebdce19e9ee5e572
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnswindowdelegate.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindowdelegate.mm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index b96a9491e8..cbae4fc50f 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qnswindowdelegate.h" +#include "qcocoahelpers.h" #include <QDebug> #include <qpa/qwindowsysteminterface.h> @@ -60,7 +61,7 @@ if (m_cocoaWindow->m_windowUnderMouse) { QPointF windowPoint; QPointF screenPoint; - [m_cocoaWindow->m_qtView convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [qnsview_cast(m_cocoaWindow->view()) convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; QWindowSystemInterface::handleEnterEvent(m_cocoaWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint); } } @@ -110,8 +111,8 @@ - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame { Q_UNUSED(newFrame); - if (m_cocoaWindow && m_cocoaWindow->m_qtView) - [m_cocoaWindow->m_qtView notifyWindowWillZoom:![window isZoomed]]; + if (m_cocoaWindow && m_cocoaWindow->window()->type() != Qt::ForeignWindow) + [qnsview_cast(m_cocoaWindow->view()) notifyWindowWillZoom:![window isZoomed]]; return YES; } |