Cocoa: NSMenu views never get viewDidUnhide called
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>
Tue, 1 Apr 2014 16:18:17 +0000 (18:18 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 18 Apr 2014 09:05:25 +0000 (11:05 +0200)
commitc7bd85e97df1b188bcbd4a2a511313d221c5bb83
tree757f1fea25705524b6fbdf280fd68dadb5aa602d
parent454dc332b3856c1726683595575c34281650a469
Cocoa: NSMenu views never get viewDidUnhide called

This is the case for QWidgets added as native menu items with
QWidgetAction. According to Cocoa's documentation [1], we should
rely on -[QNSView viewDidMoveToWindow] instead.

On 10.9 however, we receive NSWindowDidChangeOcclusionStateNotification
from the NSMenu window, which is preferable to using -[QNSView
viewDidMoveToWindow] as it guarantees the view is actually visible.
We do runtime symbol lookup to get this to work on 10.9 regardless
of the build SDK version.

[1] https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/MenuList/Articles/ViewsInMenuItems.html

Task-number: QTBUG-19840
Change-Id: If4676df5d79c359965f09ef2e5eddf4c925e3533
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
src/plugins/platforms/cocoa/qnsview.mm