[Interest] [OS X] maintaining a list of own WIds

John Weeks john at wavemetrics.com
Fri Mar 4 20:45:51 CET 2016


> On Mar 4, 2016, at 11:24 AM, René J. V. Bertin <rjvbertin at gmail.com> wrote:
> 
> Indeed. But it seems it *is* possible to be notified when the widget (finally) 
> does become visible using something like

Which is exactly what we do because we need to know *before* a window is minimized:

 void IgorNormalWindow::showEvent(QShowEvent *event) {
	QWidget::showEvent(event);
	emit windowVisibilityChanged(this, true);
	TellIgorWindowStatus(this, WINDOW_STATUS_DID_SHOW, 0);

#ifdef MACIGOR
	if (!igorNSWindowNotifier)
	{
		if (!IgorApp()->IsMDI())
		{
			igorNSWindowNotifier = CreateMinimizeNotification(reinterpret_cast<void *>(effectiveWinId()), reinterpret_cast<void *>(this));
			SetNSWindowParticipatesInCycle(this, false);
		}
	}
	else
	{
		if (IgorApp()->IsMDI())
		{
			DeleteIgorCocoaWindowNotifier(igorNSWindowNotifier);
			igorNSWindowNotifier = NULL;
		}
	}
#endif

}

The CreateMinimizeNotification() function wraps Objective C++ code that ultimately does this:

 	[[NSNotificationCenter defaultCenter]
							addObserver:self
							selector:@selector(handleMinimizationNotification:)
							name:@"NSWindowWillMiniaturizeNotification"
							object:cocoaWindow];

 

-John




More information about the Interest mailing list