diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-10-09 20:13:40 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-10-14 18:15:04 +0200 |
commit | f5cf06f4afc48198780e3c3d0d1a52afce425507 (patch) | |
tree | efd72e2fd2c8c771b774275211e7321c7faa72cf /src | |
parent | ebc835c2aa02f0b3dc6e4806bde03f33513d3556 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 10a92667c1..06680228bc 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -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 |