Remove excessive focus logging; fix timer bug for BT by posting event so EvtGetEvent can exit

This commit is contained in:
ehouse 2007-12-06 05:26:44 +00:00
parent ad78ec1fd8
commit 33cb34abfe
4 changed files with 17 additions and 7 deletions

View file

@ -2887,7 +2887,6 @@ XP_Bool
board_focusChanged( BoardCtxt* board, BoardObjectType typ, XP_Bool gained )
{
XP_Bool draw = XP_FALSE;
LOG_FUNC();
/* Called when there's been a decision to advance the focus to a new
object, or when an object will lose it. Need to update internal data
structures, but also to communicate to client draw code in a way that
@ -2926,7 +2925,6 @@ board_focusChanged( BoardCtxt* board, BoardObjectType typ, XP_Bool gained )
}
}
LOG_RETURNF( "%d", (int)draw );
return draw;
} /* board_focusChanged */

View file

@ -648,7 +648,7 @@ pbt_takedown_master( PalmBTStuff* btStuff )
LOG_RETURN_VOID();
} /* pbt_takedown_master */
#ifdef DEBUG
#if 0
static void
debug_logQueue( const PalmBTStuff* const btStuff )
{
@ -816,10 +816,10 @@ static void
pbt_postpone( PalmBTStuff* btStuff, PBT_ACTION act )
{
EventType eventToPost;
eventToPost.eType = nilEvent;
eventToPost.eType = noopEvent;
EvtAddEventToQueue( &eventToPost );
XP_LOGF( "%s(%s)", __func__, actToStr(act) );
EvtAddEventToQueue( &eventToPost );
if ( DUPLICATES_OK(act)
|| (btStuff->queueLen == 0)

View file

@ -2281,7 +2281,6 @@ handleFocusEvent( PalmAppGlobals* globals, const EventType* event,
setFormFocus( globals->mainForm, objectID );
}
}
LOG_RETURNF( "%d", (int)isBoardObj );
return isBoardObj;
} /* handleFocusEvent */
#endif
@ -2521,6 +2520,12 @@ mainViewHandleEvent( EventPtr event )
draw = handled = handleNilEvent( globals );
break;
case noopEvent:
/* do nothing! Exists just to force EvtGetEvent to return */
XP_ASSERT( handled );
break;
case newGameCancelEvent:
/* If user cancelled the new game dialog that came up the first time
he launched (i.e. when there's no game to fall back to) then just
@ -3825,6 +3830,7 @@ palm_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why,
{
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
XP_U32 now = TimGetTicks();
EventType eventToPost;
if ( why == TIMER_PENDOWN ) {
now += PALM_TIMER_DELAY;
@ -3846,6 +3852,11 @@ palm_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why,
globals->timerProcs[why] = proc;
globals->timerClosures[why] = closure;
globals->timerFireAt[why] = now;
/* Post an event to force us back out of EvtGetEvent. Required if this
* is called from inside some BT callback. */
eventToPost.eType = noopEvent;
EvtAddEventToQueue( &eventToPost );
} /* palm_util_setTimer */
static void

View file

@ -357,7 +357,8 @@ struct PalmAppGlobals {
}; /* PalmAppGlobals */
/* custom events */
enum { dictSelectedEvent = firstUserEvent /* 0x6000 */
enum { noopEvent = firstUserEvent /* 0x6000 */
,dictSelectedEvent
,newGameOkEvent
,newGameCancelEvent
,loadGameEvent