Cocoa plugin - fix obscured/mapped/unmapped logic

NSWindow setStyleMask can call viewDidMoveToWindow,
while setting the mask, view can have window == nil and we call 'obscure'
on this view's platform window/QWindow == 'unmapping' it.
As a result, it can happen that a child view (for example, QGLWidget's view)
never gets mapped back. This patch tries to limit this special
obscure/expose logic by the exact views it was introduced for
(c7bd85e97d, QTBUG-19840).

Change-Id: I4cc7a6b1bd3e34741ad50c2e0d2a2add242b28e4
Task-number: QTBUG-41701
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
This commit is contained in:
Timur Pocheptsov 2015-01-22 14:27:34 +01:00
parent a40d390a3b
commit d50eb5e8ac
2 changed files with 7 additions and 3 deletions

View File

@ -75,6 +75,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper;
bool m_resendKeyEvent;
bool m_scrolling;
bool m_exposedOnMoveToWindow;
}
- (id)init;

View File

@ -272,10 +272,13 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
if (self.window) {
// This is the case of QWidgetAction's generated QWidget inserted in an NSMenu.
// 10.9 and newer get the NSWindowDidChangeOcclusionStateNotification
if (!_q_NSWindowDidChangeOcclusionStateNotification
&& [self.window.className isEqualToString:@"NSCarbonMenuWindow"])
if ((!_q_NSWindowDidChangeOcclusionStateNotification
&& [self.window.className isEqualToString:@"NSCarbonMenuWindow"])) {
m_exposedOnMoveToWindow = true;
m_platformWindow->exposeWindow();
} else {
}
} else if (m_exposedOnMoveToWindow) {
m_exposedOnMoveToWindow = false;
m_platformWindow->obscureWindow();
}
}