mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
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:
parent
ff254fcef4
commit
c2fbb06438
5 changed files with 15 additions and 8 deletions
|
@ -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,
|
static XP_Bool drawCell( BoardCtxt* board, XP_U16 col, XP_U16 row,
|
||||||
XP_Bool skipBlanks );
|
XP_Bool skipBlanks );
|
||||||
static void figureBoardRect( BoardCtxt* board );
|
static void figureBoardRect( BoardCtxt* board );
|
||||||
|
static void forceRectToBoard( const BoardCtxt* board, XP_Rect* rect );
|
||||||
|
|
||||||
static void drawBoard( BoardCtxt* board );
|
static void drawBoard( BoardCtxt* board );
|
||||||
static void invalCell( BoardCtxt* board, XP_U16 col, XP_U16 row );
|
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 invalTradeWindow( BoardCtxt* board, XP_S16 turn, XP_Bool redraw );
|
||||||
static void invalSelTradeWindow( BoardCtxt* board );
|
static void invalSelTradeWindow( BoardCtxt* board );
|
||||||
static void setTimerIf( 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 replaceLastTile( BoardCtxt* board );
|
||||||
static XP_Bool setTrayVisState( BoardCtxt* board, XW_TrayVisState newState );
|
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->left = XP_MAX( board->boardBounds.left + 1, rect->left );
|
||||||
rect->top = XP_MAX( board->boardBounds.top + 1, y - rect->height );
|
rect->top = XP_MAX( board->boardBounds.top + 1, y - rect->height );
|
||||||
}
|
}
|
||||||
} /* positionBonusRect */
|
forceRectToBoard( board, rect );
|
||||||
|
} /*positionMiniWRect */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
timerFiredForPen( BoardCtxt* board )
|
timerFiredForPen( BoardCtxt* board )
|
||||||
|
@ -841,7 +843,7 @@ timerFiredForTimer( BoardCtxt* board )
|
||||||
setTimerIf( board );
|
setTimerIf( board );
|
||||||
} /* timerFiredForTimer */
|
} /* timerFiredForTimer */
|
||||||
|
|
||||||
static void
|
static XP_Bool
|
||||||
p_board_timerFired( void* closure, XWTimerReason why )
|
p_board_timerFired( void* closure, XWTimerReason why )
|
||||||
{
|
{
|
||||||
BoardCtxt* board = (BoardCtxt*)closure;
|
BoardCtxt* board = (BoardCtxt*)closure;
|
||||||
|
@ -851,6 +853,7 @@ p_board_timerFired( void* closure, XWTimerReason why )
|
||||||
XP_ASSERT( why == TIMER_TIMERTICK );
|
XP_ASSERT( why == TIMER_TIMERTICK );
|
||||||
timerFiredForTimer( board );
|
timerFiredForTimer( board );
|
||||||
}
|
}
|
||||||
|
return XP_FALSE;
|
||||||
} /* board_timerFired */
|
} /* board_timerFired */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1309,7 +1309,7 @@ heartbeat_checks( CommsCtxt* comms )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined RELAY_HEARTBEAT || defined COMMS_HEARTBEAT
|
#if defined RELAY_HEARTBEAT || defined COMMS_HEARTBEAT
|
||||||
static void
|
static XP_Bool
|
||||||
p_comms_timerFired( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
|
p_comms_timerFired( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
|
||||||
{
|
{
|
||||||
CommsCtxt* comms = (CommsCtxt*)closure;
|
CommsCtxt* comms = (CommsCtxt*)closure;
|
||||||
|
@ -1328,6 +1328,7 @@ p_comms_timerFired( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
|
||||||
heartbeat_checks( comms );
|
heartbeat_checks( comms );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
return XP_FALSE; /* no need for redraw */
|
||||||
} /* p_comms_timerFired */
|
} /* p_comms_timerFired */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -512,9 +512,10 @@ setLimitsFrom( const BoardCtxt* board, BdHintLimits* limits )
|
||||||
limits->bottom = XP_MAX( ds->start.u.board.row, ds->cur.u.board.row );
|
limits->bottom = XP_MAX( ds->start.u.board.row, ds->cur.u.board.row );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static XP_Bool
|
||||||
scrollTimerProc( void* closure, XWTimerReason why )
|
scrollTimerProc( void* closure, XWTimerReason why )
|
||||||
{
|
{
|
||||||
|
XP_Bool draw = XP_FALSE;
|
||||||
BoardCtxt* board = (BoardCtxt*)closure;
|
BoardCtxt* board = (BoardCtxt*)closure;
|
||||||
DragState* ds = &board->dragState;
|
DragState* ds = &board->dragState;
|
||||||
XP_ASSERT( why == TIMER_PENDOWN );
|
XP_ASSERT( why == TIMER_PENDOWN );
|
||||||
|
@ -529,9 +530,11 @@ scrollTimerProc( void* closure, XWTimerReason why )
|
||||||
ds->cur.u.board.row ) ) {
|
ds->cur.u.board.row ) ) {
|
||||||
board_draw( board ); /* may fail, e.g. on wince */
|
board_draw( board ); /* may fail, e.g. on wince */
|
||||||
startScrollTimerIf( board );
|
startScrollTimerIf( board );
|
||||||
|
draw = XP_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return draw;
|
||||||
} /* scrollTimerProc */
|
} /* scrollTimerProc */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -91,7 +91,8 @@ typedef struct BadWordInfo {
|
||||||
XP_UCHAR* words[MAX_TRAY_TILES+1]; /* can form in both directions */
|
XP_UCHAR* words[MAX_TRAY_TILES+1]; /* can form in both directions */
|
||||||
} BadWordInfo;
|
} 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
|
/* Platform-specific utility functions that need to be
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1798,12 +1798,11 @@ ceFireTimer( CEAppGlobals* globals, XWTimerReason why )
|
||||||
if ( !!proc ) {
|
if ( !!proc ) {
|
||||||
globals->timerProcs[why] = NULL;
|
globals->timerProcs[why] = NULL;
|
||||||
closure = globals->timerClosures[why];
|
closure = globals->timerClosures[why];
|
||||||
(*proc)( closure, why );
|
draw = (*proc)( closure, why );
|
||||||
/* Setting draw after firing timer allows scrolling to happen
|
/* Setting draw after firing timer allows scrolling to happen
|
||||||
while pen is held down. This is a hack. Perhaps having
|
while pen is held down. This is a hack. Perhaps having
|
||||||
the timer proc return whether drawing is needed would be
|
the timer proc return whether drawing is needed would be
|
||||||
more consistent. */
|
more consistent. */
|
||||||
draw = XP_TRUE;
|
|
||||||
} else {
|
} else {
|
||||||
XP_LOGF( "skipped timer; alread fired?" );
|
XP_LOGF( "skipped timer; alread fired?" );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue