macOS: Clarify relation between occlusion state, hidden state, and expose
Pick-to: 6.5 Change-Id: I0e05332087fb3f876a9d2fadd9d7dcfd556d5734 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 7a7aecae2ac7ae411e5e3a719f82cd1a0e7fe5ee) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
cb9f861b2e
commit
c53356cfd6
@ -371,10 +371,6 @@ void QCocoaWindow::setVisible(bool visible)
|
||||
// Make the NSView visible first, before showing the NSWindow (in case of top level windows)
|
||||
m_view.hidden = NO;
|
||||
|
||||
// Explicitly mark the view as needing display, as we may
|
||||
// not have drawn anything to the view when it was hidden.
|
||||
[m_view setNeedsDisplay:YES];
|
||||
|
||||
if (isContentView()) {
|
||||
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
@ -1308,8 +1304,14 @@ void QCocoaWindow::windowDidOrderOffScreen()
|
||||
|
||||
void QCocoaWindow::windowDidChangeOcclusionState()
|
||||
{
|
||||
// Note, we don't take the view's hiddenOrHasHiddenAncestor state into
|
||||
// account here, but instead leave that up to handleExposeEvent, just
|
||||
// like all the other signals that could potentially change the exposed
|
||||
// state of the window.
|
||||
bool visible = m_view.window.occlusionState & NSWindowOcclusionStateVisible;
|
||||
qCDebug(lcQpaWindow) << "QCocoaWindow::windowDidChangeOcclusionState" << window() << "is now" << (visible ? "visible" : "occluded");
|
||||
qCDebug(lcQpaWindow) << "Occlusion state of" << m_view.window << "for"
|
||||
<< window() << "changed to" << (visible ? "visible" : "occluded");
|
||||
|
||||
if (visible)
|
||||
[m_view setNeedsDisplay:YES];
|
||||
else
|
||||
|
@ -273,15 +273,29 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMenuHelper);
|
||||
return focusWindow;
|
||||
}
|
||||
|
||||
/*
|
||||
Invoked when the view is hidden, either directly,
|
||||
or in response to an ancestor being hidden.
|
||||
*/
|
||||
- (void)viewDidHide
|
||||
{
|
||||
qCDebug(lcQpaWindow) << "Did hide" << self;
|
||||
|
||||
if (!m_platformWindow->isExposed())
|
||||
return;
|
||||
|
||||
m_platformWindow->handleExposeEvent(QRegion());
|
||||
}
|
||||
|
||||
// Note: setNeedsDisplay is automatically called for
|
||||
// viewDidUnhide so no reason to override it here.
|
||||
/*
|
||||
Invoked when the view is unhidden, either directly,
|
||||
or in response to an ancestor being unhidden.
|
||||
*/
|
||||
- (void)viewDidUnhide
|
||||
{
|
||||
qCDebug(lcQpaWindow) << "Did unhide" << self;
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (BOOL)isTransparentForUserInput
|
||||
|
Loading…
x
Reference in New Issue
Block a user