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 ) board_focusChanged( BoardCtxt* board, BoardObjectType typ, XP_Bool gained )
{ {
XP_Bool draw = XP_FALSE; XP_Bool draw = XP_FALSE;
LOG_FUNC();
/* Called when there's been a decision to advance the focus to a new /* 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 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 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; return draw;
} /* board_focusChanged */ } /* board_focusChanged */

View file

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

View file

@ -2281,7 +2281,6 @@ handleFocusEvent( PalmAppGlobals* globals, const EventType* event,
setFormFocus( globals->mainForm, objectID ); setFormFocus( globals->mainForm, objectID );
} }
} }
LOG_RETURNF( "%d", (int)isBoardObj );
return isBoardObj; return isBoardObj;
} /* handleFocusEvent */ } /* handleFocusEvent */
#endif #endif
@ -2521,6 +2520,12 @@ mainViewHandleEvent( EventPtr event )
draw = handled = handleNilEvent( globals ); draw = handled = handleNilEvent( globals );
break; break;
case noopEvent:
/* do nothing! Exists just to force EvtGetEvent to return */
XP_ASSERT( handled );
break;
case newGameCancelEvent: case newGameCancelEvent:
/* If user cancelled the new game dialog that came up the first time /* 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 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; PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
XP_U32 now = TimGetTicks(); XP_U32 now = TimGetTicks();
EventType eventToPost;
if ( why == TIMER_PENDOWN ) { if ( why == TIMER_PENDOWN ) {
now += PALM_TIMER_DELAY; now += PALM_TIMER_DELAY;
@ -3846,6 +3852,11 @@ palm_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why,
globals->timerProcs[why] = proc; globals->timerProcs[why] = proc;
globals->timerClosures[why] = closure; globals->timerClosures[why] = closure;
globals->timerFireAt[why] = now; 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 */ } /* palm_util_setTimer */
static void static void

View file

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