[fix] Lost of menubar in 'full screen on' mode

Javier Diaz xdiaz at ECNET.ec
Thu May 6 20:56:17 UTC 1999


This fix is for Mac Squeak source 'sqMacWindow.c', when in 'full screen on'
mode if you switch to other application with Command-Tab you lost the
menubar, this is because the VM is not processing the suspend/resume event.
Add this lines in function HandleEvents(void):

case osEvt:		/* this restore menubar in suspendMessage. JDR. */
	switch ((theEvent.message >> 24) & 0x0FF) { /* high byte of message */
		Boolean		gInBackground;

		case suspendResumeMessage:
			/* suspend/resume is also an activate/deactivate */
			gInBackground = (theEvent.message & resumeFlag) == 0;
			if (fullScreenFlag)	{
				if (gInBackground)	{
					MenuBarRestore();
				}
				else
				{
					MenuBarHide();
				}
			}
		break;
	}
break;

Also the function MenuBarRestore is incomplete, needs to be:

void MenuBarRestore(void) {
  /* Restore the menu bar from its saved state. Do nothing if it isn''t
hidden. */
  /* Many thanks to John McIntosh for this code!! */
	WindowPtr	win;

	if (menuBarRegion == nil) return;  /* no saved state, so menu bar
is not hidden */
	DiffRgn(LMGetGrayRgn(), menuBarRegion, LMGetGrayRgn());
	LMSetMBarHeight(menuBarHeight);

	win = FrontWindow();	/* to restore menubar in suspendMessage.
JDR. */
	if (win)	{
		CalcVis(win);
		CalcVisBehind(win, menuBarRegion);
	}
	HiliteMenu(0);

	DisposeRgn(menuBarRegion);
	menuBarRegion = nil;
	DrawMenuBar();
}

Finally the SIZE flag 'acceptSuspendResumeEvents' needs to be activated in
the CW proyect.

Javier Diaz-Reinoso





More information about the Squeak-dev mailing list