mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +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 ) {
|
if ( !!smallestTip ) {
|
||||||
XP_U32 now = util_getCurSeconds( globals->cGlobals.params->util ) ;
|
XP_U32 now = util_getCurSeconds( globals->cGlobals.params->util ) ;
|
||||||
if ( now >= smallestTip->when ) {
|
if ( now >= smallestTip->when ) {
|
||||||
linuxFireTimer( &globals->cGlobals,
|
if ( linuxFireTimer( &globals->cGlobals,
|
||||||
smallestTip - globals->cGlobals.timerInfo );
|
smallestTip - globals->cGlobals.timerInfo ) ){
|
||||||
|
board_draw( globals->cGlobals.game.board );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
XP_LOGF( "skipping timer: now (%ld) < when (%ld)",
|
XP_LOGF( "skipping timer: now (%ld) < when (%ld)",
|
||||||
now, smallestTip->when );
|
now, smallestTip->when );
|
||||||
|
|
|
@ -1336,7 +1336,9 @@ pentimer_idle_func( gpointer data )
|
||||||
gettimeofday( &tv, NULL );
|
gettimeofday( &tv, NULL );
|
||||||
|
|
||||||
if ( (tv.tv_usec - globals->penTv.tv_usec) >= globals->penTimerInterval) {
|
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;
|
callAgain = XP_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1348,7 +1350,9 @@ score_timer_func( gpointer data )
|
||||||
{
|
{
|
||||||
GtkAppGlobals* globals = (GtkAppGlobals*)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;
|
return XP_FALSE;
|
||||||
} /* score_timer_func */
|
} /* score_timer_func */
|
||||||
|
@ -1359,7 +1363,9 @@ comms_timer_func( gpointer data )
|
||||||
{
|
{
|
||||||
GtkAppGlobals* globals = (GtkAppGlobals*)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;
|
return (gint)0;
|
||||||
}
|
}
|
||||||
|
@ -1371,7 +1377,9 @@ slowrob_timer_func( gpointer data )
|
||||||
{
|
{
|
||||||
GtkAppGlobals* globals = (GtkAppGlobals*)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;
|
return (gint)0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ usage( char* appName, char* msg )
|
||||||
#endif
|
#endif
|
||||||
#if defined PLATFORM_GTK
|
#if defined PLATFORM_GTK
|
||||||
"\t [-k] # ask for parameters via \"new games\" dlg\n"
|
"\t [-k] # ask for parameters via \"new games\" dlg\n"
|
||||||
"\t [-h numRowsHidded] \n"
|
"\t [-h numRowsHidden] \n"
|
||||||
# ifdef XWFEATURE_SEARCHLIMIT
|
# ifdef XWFEATURE_SEARCHLIMIT
|
||||||
"\t [-I] # don't support hint rect dragging\n"
|
"\t [-I] # don't support hint rect dragging\n"
|
||||||
# endif
|
# endif
|
||||||
|
@ -585,21 +585,23 @@ linux_util_makeStreamFromAddr( XW_UtilCtxt* uctx, XP_U16 channelNo )
|
||||||
} /* linux_util_makeStreamFromAddr */
|
} /* linux_util_makeStreamFromAddr */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
XP_Bool
|
||||||
linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why )
|
linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why )
|
||||||
{
|
{
|
||||||
TimerInfo* tip = &cGlobals->timerInfo[why];
|
TimerInfo* tip = &cGlobals->timerInfo[why];
|
||||||
XWTimerProc proc = tip->proc;
|
XWTimerProc proc = tip->proc;
|
||||||
void* closure = tip->closure;
|
void* closure = tip->closure;
|
||||||
|
XP_Bool draw = false;
|
||||||
|
|
||||||
tip->proc = NULL;
|
tip->proc = NULL;
|
||||||
|
|
||||||
if ( !!proc ) {
|
if ( !!proc ) {
|
||||||
(*proc)( closure, why );
|
draw = (*proc)( closure, why );
|
||||||
} else {
|
} else {
|
||||||
XP_LOGF( "%s: skipping timer %d; cancelled?", __func__, why );
|
XP_LOGF( "%s: skipping timer %d; cancelled?", __func__, why );
|
||||||
}
|
}
|
||||||
} /* fireTimer */
|
return draw;
|
||||||
|
} /* linuxFireTimer */
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -49,7 +49,7 @@ void linux_reset( void* closure );
|
||||||
int linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf,
|
int linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf,
|
||||||
int bufSize );
|
int bufSize );
|
||||||
|
|
||||||
void linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why );
|
XP_Bool linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why );
|
||||||
|
|
||||||
|
|
||||||
XWStreamCtxt* stream_from_msgbuf( CommonGlobals* cGlobals,
|
XWStreamCtxt* stream_from_msgbuf( CommonGlobals* cGlobals,
|
||||||
|
|
Loading…
Reference in a new issue