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;


Reply via email to