force miniwindow entirely onto board even if natural position is on

tray; fix overdrawing onto miniwindow by making timer proc return a
boolean and only redrawing (on wince) when it's true.
This commit is contained in:
ehouse 2008-04-12 15:36:31 +00:00
parent ff254fcef4
commit c2fbb06438
5 changed files with 15 additions and 8 deletions

View file

@ -77,6 +77,7 @@ static XP_Bool getCellRect( BoardCtxt* board, XP_U16 col, XP_U16 row,
static XP_Bool drawCell( BoardCtxt* board, XP_U16 col, XP_U16 row,
XP_Bool skipBlanks );
static void figureBoardRect( BoardCtxt* board );
static void forceRectToBoard( const BoardCtxt* board, XP_Rect* rect );
static void drawBoard( BoardCtxt* board );
static void invalCell( BoardCtxt* board, XP_U16 col, XP_U16 row );
@ -100,7 +101,7 @@ static void makeMiniWindowForText( BoardCtxt* board, const XP_UCHAR* text,
static void invalTradeWindow( BoardCtxt* board, XP_S16 turn, XP_Bool redraw );
static void invalSelTradeWindow( BoardCtxt* board );
static void setTimerIf( BoardCtxt* board );
static void p_board_timerFired( void* closure, XWTimerReason why );
static XP_Bool p_board_timerFired( void* closure, XWTimerReason why );
static XP_Bool replaceLastTile( BoardCtxt* board );
static XP_Bool setTrayVisState( BoardCtxt* board, XW_TrayVisState newState );
@ -749,7 +750,8 @@ positionMiniWRect( BoardCtxt* board, XP_Rect* rect, XP_Bool center )
rect->left = XP_MAX( board->boardBounds.left + 1, rect->left );
rect->top = XP_MAX( board->boardBounds.top + 1, y - rect->height );
}
} /* positionBonusRect */
forceRectToBoard( board, rect );
} /*positionMiniWRect */
static void
timerFiredForPen( BoardCtxt* board )
@ -841,7 +843,7 @@ timerFiredForTimer( BoardCtxt* board )
setTimerIf( board );
} /* timerFiredForTimer */
static void
static XP_Bool
p_board_timerFired( void* closure, XWTimerReason why )
{
BoardCtxt* board = (BoardCtxt*)closure;
@ -851,6 +853,7 @@ p_board_timerFired( void* closure, XWTimerReason why )
XP_ASSERT( why == TIMER_TIMERTICK );
timerFiredForTimer( board );
}
return XP_FALSE;
} /* board_timerFired */
void

View file

@ -1309,7 +1309,7 @@ heartbeat_checks( CommsCtxt* comms )
#endif
#if defined RELAY_HEARTBEAT || defined COMMS_HEARTBEAT
static void
static XP_Bool
p_comms_timerFired( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
{
CommsCtxt* comms = (CommsCtxt*)closure;
@ -1328,6 +1328,7 @@ p_comms_timerFired( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
heartbeat_checks( comms );
#endif
}
return XP_FALSE; /* no need for redraw */
} /* p_comms_timerFired */
static void

View file

@ -512,9 +512,10 @@ setLimitsFrom( const BoardCtxt* board, BdHintLimits* limits )
limits->bottom = XP_MAX( ds->start.u.board.row, ds->cur.u.board.row );
}
static void
static XP_Bool
scrollTimerProc( void* closure, XWTimerReason why )
{
XP_Bool draw = XP_FALSE;
BoardCtxt* board = (BoardCtxt*)closure;
DragState* ds = &board->dragState;
XP_ASSERT( why == TIMER_PENDOWN );
@ -529,9 +530,11 @@ scrollTimerProc( void* closure, XWTimerReason why )
ds->cur.u.board.row ) ) {
board_draw( board ); /* may fail, e.g. on wince */
startScrollTimerIf( board );
draw = XP_TRUE;
}
}
}
return draw;
} /* scrollTimerProc */
static void

View file

@ -91,7 +91,8 @@ typedef struct BadWordInfo {
XP_UCHAR* words[MAX_TRAY_TILES+1]; /* can form in both directions */
} BadWordInfo;
typedef void (*XWTimerProc)( void* closure, XWTimerReason why );
/* XWTimerProc returns true if redraw was necessitated by what the proc did */
typedef XP_Bool (*XWTimerProc)( void* closure, XWTimerReason why );
/* Platform-specific utility functions that need to be
*/

View file

@ -1798,12 +1798,11 @@ ceFireTimer( CEAppGlobals* globals, XWTimerReason why )
if ( !!proc ) {
globals->timerProcs[why] = NULL;
closure = globals->timerClosures[why];
(*proc)( closure, why );
draw = (*proc)( closure, why );
/* Setting draw after firing timer allows scrolling to happen
while pen is held down. This is a hack. Perhaps having
the timer proc return whether drawing is needed would be
more consistent. */
draw = XP_TRUE;
} else {
XP_LOGF( "skipped timer; alread fired?" );
}