# HG changeset patch
# User Jeff Sickel <jas@corpus-callosum.com>
# Date 1236550276 18000
# Node ID 10b09a2845ad89d87369bf6dcf1ee82ea60bd7ac
# Parent  263100a4d8b2cb93acc35fec46d86289e9aff1ae
flush window on kEventAppShow

diff -r 263100a4d8b2 -r 10b09a2845ad src/cmd/devdraw/osx-screen.c
--- a/src/cmd/devdraw/osx-screen.c	Fri Mar 06 12:25:38 2009 -0800
+++ b/src/cmd/devdraw/osx-screen.c	Sun Mar 08 17:11:16 2009 -0500
@@ -80,6 +80,7 @@
 };
 
 void screeninit(void);
+void _flushmemscreen(Rectangle r);
 
 Memimage*
 attachscreen(char *label, char *winsize)
@@ -126,7 +127,7 @@
 		CFSTR("Full Screen"), 0, CmdFullScreen, &ix);
 	SetMenuItemCommandKey(osx.vmenu, ix, 0, 'F');
 	AppendMenuItemTextWithCFString(osx.vmenu,
-		CFSTR("Ctl-Opt exits full screen"),
+		CFSTR("Cmd-F exits full screen"),
 		kMenuItemAttrDisabled, CmdFullScreen, &ix);
 	InsertMenu(osx.vmenu, GetMenuID(osx.wmenu));
 	DrawMenuBar();
@@ -165,6 +166,7 @@
 		{ kEventClassWindow, kEventWindowDeactivated },
 	};
 	const EventTypeSpec events[] = {
+		{ kEventClassApplication, kEventAppShown },
 		{ kEventClassKeyboard, kEventRawKeyDown },
 		{ kEventClassKeyboard, kEventRawKeyModifiersChanged },
 		{ kEventClassKeyboard, kEventRawKeyRepeat },
@@ -244,6 +246,11 @@
 	result = CallNextEventHandler(next, event);
 
 	switch(GetEventClass(event)){
+	case kEventClassApplication:;
+		Rectangle r = Rect(0, 0, Dx(osx.screenr), Dy(osx.screenr));
+		_flushmemscreen(r);
+		return eventNotHandledErr;
+
 	case kEventClassKeyboard:
 		return kbdevent(event);
 	
@@ -267,7 +274,7 @@
 		}
 		break;
 	
-	case kEventClassWindow:;
+	case kEventClassWindow:
 		switch(GetEventKind(event)){
 		case kEventWindowClosed:
 			exit(0);
