Cocoa: Send obscure events on OcclusionStateHidden
This disables animations for windows that are completely obscured by other windows. On examples/quick/animation, obscured CPU usage goes from 10% to 1%. Change-Id: I9945431e6387e406e2064c08d5aa01d5d96ef602 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
This commit is contained in:
parent
ebc835c2aa
commit
f5cf06f4af
@ -420,12 +420,10 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
||||
#pragma clang diagnostic ignored "-Wobjc-method-access"
|
||||
enum { NSWindowOcclusionStateVisible = 1UL << 1 };
|
||||
#endif
|
||||
// Older versions managed in -[QNSView viewDidMoveToWindow].
|
||||
// Support QWidgetAction in NSMenu. Mavericks only sends this notification.
|
||||
// Ideally we should support this in Qt as well, in order to disable animations
|
||||
// when the window is occluded.
|
||||
if ((NSUInteger)[self.window occlusionState] & NSWindowOcclusionStateVisible)
|
||||
m_platformWindow->exposeWindow();
|
||||
else
|
||||
m_platformWindow->obscureWindow();
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user