mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
Pass results back via timers and call board_draw() when so indicates.
Needed to test dragDropSetAdd. Candidate for merge to trunk.
This commit is contained in:
parent
1073a98f9f
commit
82382a7cfa
4 changed files with 23 additions and 11 deletions
|
@ -969,8 +969,10 @@ fireCursesTimer( CursesAppGlobals* globals )
|
|||
if ( !!smallestTip ) {
|
||||
XP_U32 now = util_getCurSeconds( globals->cGlobals.params->util ) ;
|
||||
if ( now >= smallestTip->when ) {
|
||||
linuxFireTimer( &globals->cGlobals,
|
||||
smallestTip - globals->cGlobals.timerInfo );
|
||||
if ( linuxFireTimer( &globals->cGlobals,
|
||||
smallestTip - globals->cGlobals.timerInfo ) ){
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
}
|
||||
} else {
|
||||
XP_LOGF( "skipping timer: now (%ld) < when (%ld)",
|
||||
now, smallestTip->when );
|
||||
|
|
|
@ -1336,7 +1336,9 @@ pentimer_idle_func( gpointer data )
|
|||
gettimeofday( &tv, NULL );
|
||||
|
||||
if ( (tv.tv_usec - globals->penTv.tv_usec) >= globals->penTimerInterval) {
|
||||
linuxFireTimer( &globals->cGlobals, TIMER_PENDOWN );
|
||||
if ( linuxFireTimer( &globals->cGlobals, TIMER_PENDOWN ) ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
}
|
||||
callAgain = XP_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1348,7 +1350,9 @@ score_timer_func( gpointer data )
|
|||
{
|
||||
GtkAppGlobals* globals = (GtkAppGlobals*)data;
|
||||
|
||||
linuxFireTimer( &globals->cGlobals, TIMER_TIMERTICK );
|
||||
if ( linuxFireTimer( &globals->cGlobals, TIMER_TIMERTICK ) ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
}
|
||||
|
||||
return XP_FALSE;
|
||||
} /* score_timer_func */
|
||||
|
@ -1359,7 +1363,9 @@ comms_timer_func( gpointer data )
|
|||
{
|
||||
GtkAppGlobals* globals = (GtkAppGlobals*)data;
|
||||
|
||||
linuxFireTimer( &globals->cGlobals, TIMER_COMMS );
|
||||
if ( linuxFireTimer( &globals->cGlobals, TIMER_COMMS ) ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
}
|
||||
|
||||
return (gint)0;
|
||||
}
|
||||
|
@ -1371,7 +1377,9 @@ slowrob_timer_func( gpointer data )
|
|||
{
|
||||
GtkAppGlobals* globals = (GtkAppGlobals*)data;
|
||||
|
||||
linuxFireTimer( &globals->cGlobals, TIMER_SLOWROBOT );
|
||||
if ( linuxFireTimer( &globals->cGlobals, TIMER_SLOWROBOT ) ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
}
|
||||
|
||||
return (gint)0;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ usage( char* appName, char* msg )
|
|||
#endif
|
||||
#if defined PLATFORM_GTK
|
||||
"\t [-k] # ask for parameters via \"new games\" dlg\n"
|
||||
"\t [-h numRowsHidded] \n"
|
||||
"\t [-h numRowsHidden] \n"
|
||||
# ifdef XWFEATURE_SEARCHLIMIT
|
||||
"\t [-I] # don't support hint rect dragging\n"
|
||||
# endif
|
||||
|
@ -585,21 +585,23 @@ linux_util_makeStreamFromAddr( XW_UtilCtxt* uctx, XP_U16 channelNo )
|
|||
} /* linux_util_makeStreamFromAddr */
|
||||
#endif
|
||||
|
||||
void
|
||||
XP_Bool
|
||||
linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why )
|
||||
{
|
||||
TimerInfo* tip = &cGlobals->timerInfo[why];
|
||||
XWTimerProc proc = tip->proc;
|
||||
void* closure = tip->closure;
|
||||
XP_Bool draw = false;
|
||||
|
||||
tip->proc = NULL;
|
||||
|
||||
if ( !!proc ) {
|
||||
(*proc)( closure, why );
|
||||
draw = (*proc)( closure, why );
|
||||
} else {
|
||||
XP_LOGF( "%s: skipping timer %d; cancelled?", __func__, why );
|
||||
}
|
||||
} /* fireTimer */
|
||||
return draw;
|
||||
} /* linuxFireTimer */
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static void
|
||||
|
|
|
@ -49,7 +49,7 @@ void linux_reset( void* closure );
|
|||
int linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf,
|
||||
int bufSize );
|
||||
|
||||
void linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why );
|
||||
XP_Bool linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why );
|
||||
|
||||
|
||||
XWStreamCtxt* stream_from_msgbuf( CommonGlobals* cGlobals,
|
||||
|
|
Loading…
Reference in a new issue