Clean up for non-keyboard and non-keyboard-nav cases. Wince is the

latter: make it compile again.
This commit is contained in:
ehouse 2007-01-07 01:01:20 +00:00
parent c423f04d0d
commit 4646ac5711
5 changed files with 38 additions and 17 deletions

View file

@ -111,12 +111,12 @@ static XP_Bool setTrayVisState( BoardCtxt* board, XW_TrayVisState newState );
static XP_Bool advanceArrow( BoardCtxt* board );
static XP_Bool exitTradeMode( BoardCtxt* board );
#ifdef KEY_SUPPORT
static XP_Bool getArrow( BoardCtxt* board, XP_U16* col, XP_U16* row );
static XP_Bool board_moveArrow( BoardCtxt* board, XP_Key cursorKey );
static XP_Bool setArrowVisibleFor( BoardCtxt* board, XP_U16 player,
XP_Bool visible );
static XP_Bool board_moveArrow( BoardCtxt* board, XP_Key cursorKey );
#ifdef KEY_SUPPORT
static XP_Bool moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey,
XP_Bool* gotArrow );
#endif
@ -2528,7 +2528,6 @@ flipKey( XP_Key key, XP_Bool flip ) {
}
return result;
} /* flipKey */
#endif
static void
getRectCenter( const XP_Rect* rect, XP_U16* xp, XP_U16* yp )
@ -2603,7 +2602,9 @@ board_handleKeyDown( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
return draw;
}
#endif /* KEYBOARD_NAV */
#ifdef KEY_SUPPORT
XP_Bool
board_handleKeyUp( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
{
@ -2695,6 +2696,7 @@ board_handleKeyUp( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
}
return redraw;
} /* board_handleKeyUp */
#endif
#ifdef KEYBOARD_NAV
@ -2808,7 +2810,8 @@ advanceArrow( BoardCtxt* board )
static XP_Bool
figureNextLoc( BoardCtxt* board, XP_Key cursorKey,
XP_Bool inclPending, XP_Bool forceFirst,
XP_U16* colP, XP_U16* rowP, XP_Bool* pUp )
XP_U16* colP, XP_U16* rowP,
XP_Bool* XP_UNUSED_KEYBOARD_NAV(pUp) )
{
XP_S16 max;
XP_S16* useWhat;
@ -3019,6 +3022,7 @@ moveTileToBoard( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_U16 tileIndex,
return XP_TRUE;
} /* moveTileToBoard */
#ifdef KEY_SUPPORT
static XP_Bool
moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
{
@ -3075,6 +3079,7 @@ moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
return success;
} /* moveKeyTileToBoard */
#endif
static void
setArrowFor( BoardCtxt* board, XP_U16 player, XP_U16 col, XP_U16 row )

View file

@ -126,14 +126,15 @@ XP_Bool board_handlePenMove( BoardCtxt* board, XP_U16 x, XP_U16 y );
XP_Bool board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y );
#endif
#ifdef KEY_SUPPORT
XP_Bool board_handleKeyUp( BoardCtxt* board, XP_Key key, XP_Bool* handled );
XP_Bool board_handleKeyDown( BoardCtxt* board, XP_Key key, XP_Bool* handled );
#ifdef KEYBOARD_NAV
/* void board_focusChange( BoardCtxt* board ); */
# ifdef KEYBOARD_NAV
XP_Bool board_handleKeyDown( BoardCtxt* board, XP_Key key, XP_Bool* handled );
XP_Bool board_focusChanged( BoardCtxt* board, BoardObjectType typ,
XP_Bool gained );
XP_Bool board_toggle_arrowDir( BoardCtxt* board );
# endif
#endif
/******************** Tray methods ********************/

View file

@ -169,12 +169,11 @@ drawScoreBoard( BoardCtxt* board )
innerRect.top = scoreRect.top +
((scoreRect.height - innerRect.height) / 2);
XP_MEMCPY( &board->scoreRects[i], &scoreRect,
sizeof(scoreRect) );
draw_score_drawPlayer( board->draw, &innerRect, &scoreRect,
&dp->dsi );
#ifdef KEYBOARD_NAV
XP_MEMCPY( &board->scoreRects[i], &scoreRect,
sizeof(scoreRect) );
if ( i == cursorIndex ) {
cursorRect = scoreRect;
cursorRectP = &cursorRect;

View file

@ -153,6 +153,7 @@ button_release_event( GtkWidget* XP_UNUSED(widget), GdkEventMotion *event,
return 1;
} /* button_release_event */
#ifdef KEY_SUPPORT
static XP_Key
evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
{
@ -161,6 +162,7 @@ evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
guint keyval = event->keyval;
switch( keyval ) {
#ifdef KEYBOARD_NAV
case GDK_Return:
xpkey = XP_RETURN_KEY;
break;
@ -184,6 +186,7 @@ evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
xpkey = XP_CURSOR_KEY_DOWN;
movesCursor = XP_TRUE;
break;
#endif
case GDK_BackSpace:
XP_LOGF( "... it's a DEL" );
xpkey = XP_CURSOR_KEY_DEL;
@ -199,6 +202,7 @@ evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
return xpkey;
} /* evtToXPKey */
#ifdef KEYBOARD_NAV
static gint
key_press_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
GtkAppGlobals* globals )
@ -214,6 +218,7 @@ key_press_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
}
return 1;
}
#endif
static gint
key_release_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
@ -225,14 +230,15 @@ key_release_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
if ( xpkey != XP_KEY_NONE ) {
XP_Bool draw;
draw = board_handleKeyUp( globals->cGlobals.game.board, xpkey, &handled );
draw = board_handleKeyUp( globals->cGlobals.game.board, xpkey,
&handled );
#ifdef KEYBOARD_NAV
if ( movesCursor && !handled ) {
BoardObjectType order[] = { OBJ_SCORE, OBJ_BOARD, OBJ_TRAY };
draw = linShiftFocus( &globals->cGlobals, xpkey, order,
NULL ) || draw;
}
#endif
if ( draw ) {
board_draw( globals->cGlobals.game.board );
}
@ -240,6 +246,7 @@ key_release_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
return handled? 1 : 0; /* gtk will do something with the key if 0 returned */
} /* key_release_event */
#endif
#ifdef MEM_DEBUG
# define MEMPOOL globals->cGlobals.params->util->mpool,
@ -1818,18 +1825,26 @@ gtkmain( LaunchParams* params, int argc, char *argv[] )
g_signal_connect( GTK_OBJECT(drawing_area), "button_release_event",
G_CALLBACK(button_release_event), &globals );
#ifdef KEY_SUPPORT
# ifdef KEYBOARD_NAV
g_signal_connect( GTK_OBJECT(window), "key_press_event",
G_CALLBACK(key_press_event), &globals );
# endif
g_signal_connect( GTK_OBJECT(window), "key_release_event",
G_CALLBACK(key_release_event), &globals );
#endif
gtk_widget_set_events( drawing_area, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK
#ifdef KEY_SUPPORT
# ifdef KEYBOARD_NAV
| GDK_KEY_PRESS_MASK
# endif
| GDK_KEY_RELEASE_MASK
#endif
/* | GDK_POINTER_MOTION_HINT_MASK */
);

View file

@ -2033,8 +2033,9 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if ( wParam == 0x08 ) {
wParam = XP_CURSOR_KEY_DEL;
}
draw = board_handleKey( globals->game.board, wParam )
|| board_handleKey( globals->game.board, wParam - ('a'-'A') );
draw = board_handleKeyUp( globals->game.board, wParam, &handled )
|| board_handleKeyUp( globals->game.board, wParam - ('a'-'A'),
&handled );
break;
case WM_TIMER: