From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <1DCB1697-9715-43B9-891B-89EAE039B55B@corpus-callosum.com> From: Jeff Sickel To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Fri, 20 Mar 2009 12:17:00 -0500 Subject: [9fans] drawterm update to gui-osx/screen.c Topicbox-Message-UUID: c16c4a6e-ead4-11e9-9d60-3106f5b1d025 This is the same patch that I applied to devdraw, just in the current drawterm code base. kEventAppShown gets called when the application comes out from being hidden/screen saver/etc. Without catching it and passing it on, we get a blank white window until a resize or fullscreen event occurs. -jas [cpu:cmd/drawterm/gui-osx] jas% cvs diff . ? plan9bunny.icns cvs diff: Diffing . Index: screen.c =================================================================== RCS file: /cvs/drawterm/gui-osx/screen.c,v retrieving revision 1.12 diff -r1.12 screen.c 95,98d94 < // devRect.origin.x = 0; < // devRect.origin.y = 0; < // devRect.size.width = 1024; < // devRect.size.height = 768; 115c111 < static OSStatus ApplicationQuitEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); --- > static OSStatus ApplicationEventHandler(EventHandlerCallRef next, EventRef event, void *arg); 167c163,164 < const EventTypeSpec quit_events[] = { --- > const EventTypeSpec app_events[] = { > { kEventClassApplication, kEventAppShown }, 187,189c184,186 < NewEventHandlerUPP (ApplicationQuitEventHandler), < GetEventTypeCount(quit_events), < quit_events, --- > NewEventHandlerUPP (ApplicationEventHandler), > GetEventTypeCount(app_events), > app_events, 341c338,339 < static OSStatus ApplicationQuitEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) --- > // and other Application events > static OSStatus ApplicationEventHandler(EventHandlerCallRef next, EventRef event, void *arg) 343,345c341,354 < exit(0); < // QuitApplicationEventLoop(); < return noErr; --- > OSStatus result = noErr; > switch(GetEventKind(event)){ > case kEventAppShown:; > Rectangle r = Rect(0, 0, bounds.size.width, bounds.size.height); > flushmemscreen(r); > result = eventNotHandledErr; > break; > > case kEventAppQuit: > exit(0); > // QuitApplicationEventLoop(); > } > > return result;