Require two key events to reveal tray and act on a tile; don't treat

divider as wider (to make it easier to tap on) when keyboard being
used to select.
This commit is contained in:
ehouse 2008-09-18 03:53:53 +00:00
parent a9d255592a
commit 918c876e13
3 changed files with 27 additions and 18 deletions

View file

@ -1269,9 +1269,12 @@ setTrayVisState( BoardCtxt* board, XW_TrayVisState newState )
recalculated */ recalculated */
figureBoardRect( board ); /* comes before setYOffset since that figureBoardRect( board ); /* comes before setYOffset since that
uses rects to calc scroll */ uses rects to calc scroll */
if ( (board->focussed == OBJ_TRAY) && board->focusHasDived ) {
board->focusHasDived = XP_FALSE; /* This is sometimes the wrong thing to do, and seems not to be
} needed at all. */
/* if ( (board->focussed == OBJ_TRAY) && board->focusHasDived ) { */
/* board->focusHasDived = XP_FALSE; */
/* } */
invalFocusOwner( board ); invalFocusOwner( board );
if ( board->boardObscuresTray ) { if ( board->boardObscuresTray ) {
@ -1861,7 +1864,7 @@ handleLikeDown( BoardCtxt* board, BoardObjectType onWhich, XP_U16 x, XP_U16 y )
break; break;
case OBJ_TRAY: case OBJ_TRAY:
if ( checkRevealTray(board) if ( (board->trayVisState == TRAY_REVEALED)
&& !board->selInfo->tradeInProgress ) { && !board->selInfo->tradeInProgress ) {
result = dragDropStart( board, OBJ_TRAY, x, y ) || result; result = dragDropStart( board, OBJ_TRAY, x, y ) || result;
} }
@ -1892,6 +1895,8 @@ board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool* handled )
XP_Bool penDidSomething; XP_Bool penDidSomething;
BoardObjectType onWhich; BoardObjectType onWhich;
board->srcIsPen = XP_TRUE;
penDidSomething = pointOnSomething( board, x, y, &onWhich ); penDidSomething = pointOnSomething( board, x, y, &onWhich );
if ( !penDidSomething ) { if ( !penDidSomething ) {
@ -2253,6 +2258,8 @@ board_handleKeyDown( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
XP_U16 x, y; XP_U16 x, y;
board->srcIsPen = XP_FALSE;
*pHandled = XP_FALSE; *pHandled = XP_FALSE;
if ( key == XP_RETURN_KEY ) { if ( key == XP_RETURN_KEY ) {

View file

@ -160,6 +160,7 @@ struct BoardCtxt {
XP_Bool boardObscuresTray; XP_Bool boardObscuresTray;
XP_Bool boardHidesTray; XP_Bool boardHidesTray;
XP_Bool scoreSplitHor;/* how to divide the scoreboard? */ XP_Bool scoreSplitHor;/* how to divide the scoreboard? */
XP_Bool srcIsPen; /* We're processing a pen event, not a key event */
XP_U16 star_row; XP_U16 star_row;

View file

@ -62,8 +62,10 @@ pointToTileIndex( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool* onDividerP )
/* The divider rect is narrower and kinda hard to tap on. Let's expand /* The divider rect is narrower and kinda hard to tap on. Let's expand
it just for this test */ it just for this test */
biggerRect = divider; biggerRect = divider;
biggerRect.left -= 2; if ( board->srcIsPen ) {
biggerRect.left -= 2; /* should be in proportion to tile dims */
biggerRect.width += 4; biggerRect.width += 4;
}
onDivider = rectContainsPt( &biggerRect, x, y ); onDivider = rectContainsPt( &biggerRect, x, y );
if ( !onDivider ) { if ( !onDivider ) {
@ -157,7 +159,7 @@ drawTray( BoardCtxt* board )
Tile blank = dict_getBlankTile( dictionary ); Tile blank = dict_getBlankTile( dictionary );
if ( turn >= 0 ) { if ( turn >= 0 ) {
XP_S16 i; /* which tile slot are we drawing in */ XP_S16 ii; /* which tile slot are we drawing in */
XP_U16 ddAddedIndx, ddRmvdIndx; XP_U16 ddAddedIndx, ddRmvdIndx;
XP_U16 numInTray = countTilesToShow( board ); XP_U16 numInTray = countTilesToShow( board );
XP_Bool isBlank; XP_Bool isBlank;
@ -167,10 +169,9 @@ drawTray( BoardCtxt* board )
/* draw in reverse order so drawing happens after /* draw in reverse order so drawing happens after
erasing */ erasing */
for ( i = MAX_TRAY_TILES - 1; for ( ii = MAX_TRAY_TILES - 1; ii >= 0; --ii ) {
i >= 0; --i ) {
CellFlags flags = CELL_NONE; CellFlags flags = CELL_NONE;
XP_U16 mask = 1 << i; XP_U16 mask = 1 << ii;
if ( (board->trayInvalBits & mask) == 0 ) { if ( (board->trayInvalBits & mask) == 0 ) {
continue; continue;
@ -180,9 +181,9 @@ drawTray( BoardCtxt* board )
flags |= CELL_ISCURSOR; flags |= CELL_ISCURSOR;
} }
#endif #endif
figureTrayTileRect( board, i, &tileRect ); figureTrayTileRect( board, ii, &tileRect );
if ( i >= numInTray ) { if ( ii >= numInTray ) {
draw_drawTile( board->draw, &tileRect, NULL, draw_drawTile( board->draw, &tileRect, NULL,
NULL, -1, flags | CELL_ISEMPTY ); NULL, -1, flags | CELL_ISEMPTY );
} else if ( showFaces ) { } else if ( showFaces ) {
@ -193,11 +194,11 @@ drawTray( BoardCtxt* board )
XP_S16 value; XP_S16 value;
Tile tile; Tile tile;
if ( ddAddedIndx == i ) { if ( ddAddedIndx == ii ) {
dragDropTileInfo( board, &tile, &isBlank ); dragDropTileInfo( board, &tile, &isBlank );
} else { } else {
XP_U16 modIndex = i; XP_U16 modIndex = ii;
if ( ddAddedIndx < i ) { if ( ddAddedIndx < ii ) {
--modIndex; --modIndex;
} }
/* while we're right of the removal area, /* while we're right of the removal area,
@ -219,10 +220,10 @@ drawTray( BoardCtxt* board )
} }
if ( isADrag ) { if ( isADrag ) {
if ( ddAddedIndx == i ) { if ( ddAddedIndx == ii ) {
flags |= CELL_HIGHLIGHT; flags |= CELL_HIGHLIGHT;
} }
} else if ( (traySelBits & (1<<i)) != 0 ) { } else if ( (traySelBits & (1<<ii)) != 0 ) {
flags |= CELL_HIGHLIGHT; flags |= CELL_HIGHLIGHT;
} }
if ( isBlank ) { if ( isBlank ) {