summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2015-01-22 14:27:34 +0100
committerTimur Pocheptsov <Timur.Pocheptsov@digia.com>2015-02-03 11:30:04 +0000
commitd50eb5e8acffc34dfd25ace13dc64434e6055b8f (patch)
tree5940b31b562fb03042adac96056f1a7ebeb36377 /src/plugins/platforms/cocoa
parenta40d390a3bbc1919843000b427a168180b83a344 (diff)
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 (c7bd85e97df1b188bcbd4a2a511313d221c5bb83, QTBUG-19840). Change-Id: I4cc7a6b1bd3e34741ad50c2e0d2a2add242b28e4 Task-number: QTBUG-41701 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm9
2 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index c36634db74..59297bdffe 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -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;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 156cf38821..780be644e7 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -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();
}
}