macOS: Don't try to cast foreign windows to QNSView

Change-Id: I08a4d76310a689c3c855d4c8306f9d7aa5cecadc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-01-30 20:26:58 +01:00 committed by Timur Pocheptsov
parent 0b18d51b89
commit b5068a2831
2 changed files with 4 additions and 3 deletions

View File

@ -255,7 +255,8 @@ void QCocoaGLContext::setActiveWindow(QWindow *window)
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
cocoaWindow->setCurrentContext(this);
[(QNSView *) cocoaWindow->view() setQCocoaGLContext:this];
Q_ASSERT(!cocoaWindow->isForeignWindow());
[qnsview_cast(cocoaWindow->view()) setQCocoaGLContext:this];
}
void QCocoaGLContext::updateSurfaceFormat()

View File

@ -581,8 +581,8 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
// The calls above block, and also swallow any mouse release event,
// so we need to clear any mouse button that triggered the menu popup.
if ([view isKindOfClass:[QNSView class]])
[(QNSView *)view resetMouseButtons];
if (!cocoaWindow->isForeignWindow())
[qnsview_cast(view) resetMouseButtons];
}
void QCocoaMenu::dismiss()