devdraw: flush window on kEventAppShow

This commit is contained in:
Jeff Sicket 2009-05-17 11:07:09 -07:00
parent 9a0e004842
commit 834d2a4dff

View file

@ -80,6 +80,7 @@ enum
}; };
void screeninit(void); void screeninit(void);
void _flushmemscreen(Rectangle r);
Memimage* Memimage*
attachscreen(char *label, char *winsize) attachscreen(char *label, char *winsize)
@ -126,7 +127,7 @@ _screeninit(void)
CFSTR("Full Screen"), 0, CmdFullScreen, &ix); CFSTR("Full Screen"), 0, CmdFullScreen, &ix);
SetMenuItemCommandKey(osx.vmenu, ix, 0, 'F'); SetMenuItemCommandKey(osx.vmenu, ix, 0, 'F');
AppendMenuItemTextWithCFString(osx.vmenu, AppendMenuItemTextWithCFString(osx.vmenu,
CFSTR("Ctl-Opt exits full screen"), CFSTR("Cmd-F exits full screen"),
kMenuItemAttrDisabled, CmdFullScreen, &ix); kMenuItemAttrDisabled, CmdFullScreen, &ix);
InsertMenu(osx.vmenu, GetMenuID(osx.wmenu)); InsertMenu(osx.vmenu, GetMenuID(osx.wmenu));
DrawMenuBar(); DrawMenuBar();
@ -165,6 +166,7 @@ _screeninit(void)
{ kEventClassWindow, kEventWindowDeactivated }, { kEventClassWindow, kEventWindowDeactivated },
}; };
const EventTypeSpec events[] = { const EventTypeSpec events[] = {
{ kEventClassApplication, kEventAppShown },
{ kEventClassKeyboard, kEventRawKeyDown }, { kEventClassKeyboard, kEventRawKeyDown },
{ kEventClassKeyboard, kEventRawKeyModifiersChanged }, { kEventClassKeyboard, kEventRawKeyModifiersChanged },
{ kEventClassKeyboard, kEventRawKeyRepeat }, { kEventClassKeyboard, kEventRawKeyRepeat },
@ -244,6 +246,11 @@ eventhandler(EventHandlerCallRef next, EventRef event, void *arg)
result = CallNextEventHandler(next, event); result = CallNextEventHandler(next, event);
switch(GetEventClass(event)){ switch(GetEventClass(event)){
case kEventClassApplication:;
Rectangle r = Rect(0, 0, Dx(osx.screenr), Dy(osx.screenr));
_flushmemscreen(r);
return eventNotHandledErr;
case kEventClassKeyboard: case kEventClassKeyboard:
return kbdevent(event); return kbdevent(event);
@ -267,7 +274,7 @@ eventhandler(EventHandlerCallRef next, EventRef event, void *arg)
} }
break; break;
case kEventClassWindow:; case kEventClassWindow:
switch(GetEventKind(event)){ switch(GetEventKind(event)){
case kEventWindowClosed: case kEventWindowClosed:
exit(0); exit(0);