mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
Clean up for non-keyboard and non-keyboard-nav cases. Wince is the
latter: make it compile again.
This commit is contained in:
parent
c423f04d0d
commit
4646ac5711
5 changed files with 38 additions and 17 deletions
|
@ -111,12 +111,12 @@ static XP_Bool setTrayVisState( BoardCtxt* board, XW_TrayVisState newState );
|
||||||
static XP_Bool advanceArrow( BoardCtxt* board );
|
static XP_Bool advanceArrow( BoardCtxt* board );
|
||||||
static XP_Bool exitTradeMode( 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 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,
|
static XP_Bool setArrowVisibleFor( BoardCtxt* board, XP_U16 player,
|
||||||
XP_Bool visible );
|
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,
|
static XP_Bool moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey,
|
||||||
XP_Bool* gotArrow );
|
XP_Bool* gotArrow );
|
||||||
#endif
|
#endif
|
||||||
|
@ -2528,7 +2528,6 @@ flipKey( XP_Key key, XP_Bool flip ) {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} /* flipKey */
|
} /* flipKey */
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
getRectCenter( const XP_Rect* rect, XP_U16* xp, XP_U16* yp )
|
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;
|
return draw;
|
||||||
}
|
}
|
||||||
|
#endif /* KEYBOARD_NAV */
|
||||||
|
|
||||||
|
#ifdef KEY_SUPPORT
|
||||||
XP_Bool
|
XP_Bool
|
||||||
board_handleKeyUp( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
|
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;
|
return redraw;
|
||||||
} /* board_handleKeyUp */
|
} /* board_handleKeyUp */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef KEYBOARD_NAV
|
#ifdef KEYBOARD_NAV
|
||||||
|
|
||||||
|
@ -2808,7 +2810,8 @@ advanceArrow( BoardCtxt* board )
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
figureNextLoc( BoardCtxt* board, XP_Key cursorKey,
|
figureNextLoc( BoardCtxt* board, XP_Key cursorKey,
|
||||||
XP_Bool inclPending, XP_Bool forceFirst,
|
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 max;
|
||||||
XP_S16* useWhat;
|
XP_S16* useWhat;
|
||||||
|
@ -3019,6 +3022,7 @@ moveTileToBoard( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_U16 tileIndex,
|
||||||
return XP_TRUE;
|
return XP_TRUE;
|
||||||
} /* moveTileToBoard */
|
} /* moveTileToBoard */
|
||||||
|
|
||||||
|
#ifdef KEY_SUPPORT
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
|
moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
|
||||||
{
|
{
|
||||||
|
@ -3075,6 +3079,7 @@ moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey, XP_Bool* gotArrow )
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
} /* moveKeyTileToBoard */
|
} /* moveKeyTileToBoard */
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setArrowFor( BoardCtxt* board, XP_U16 player, XP_U16 col, XP_U16 row )
|
setArrowFor( BoardCtxt* board, XP_U16 player, XP_U16 col, XP_U16 row )
|
||||||
|
|
|
@ -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 );
|
XP_Bool board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef KEY_SUPPORT
|
||||||
XP_Bool board_handleKeyUp( BoardCtxt* board, XP_Key key, XP_Bool* handled );
|
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
|
# ifdef KEYBOARD_NAV
|
||||||
/* void board_focusChange( BoardCtxt* board ); */
|
XP_Bool board_handleKeyDown( BoardCtxt* board, XP_Key key, XP_Bool* handled );
|
||||||
XP_Bool board_focusChanged( BoardCtxt* board, BoardObjectType typ,
|
XP_Bool board_focusChanged( BoardCtxt* board, BoardObjectType typ,
|
||||||
XP_Bool gained );
|
XP_Bool gained );
|
||||||
XP_Bool board_toggle_arrowDir( BoardCtxt* board );
|
XP_Bool board_toggle_arrowDir( BoardCtxt* board );
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************** Tray methods ********************/
|
/******************** Tray methods ********************/
|
||||||
|
|
|
@ -169,12 +169,11 @@ drawScoreBoard( BoardCtxt* board )
|
||||||
innerRect.top = scoreRect.top +
|
innerRect.top = scoreRect.top +
|
||||||
((scoreRect.height - innerRect.height) / 2);
|
((scoreRect.height - innerRect.height) / 2);
|
||||||
|
|
||||||
XP_MEMCPY( &board->scoreRects[i], &scoreRect,
|
|
||||||
sizeof(scoreRect) );
|
|
||||||
|
|
||||||
draw_score_drawPlayer( board->draw, &innerRect, &scoreRect,
|
draw_score_drawPlayer( board->draw, &innerRect, &scoreRect,
|
||||||
&dp->dsi );
|
&dp->dsi );
|
||||||
#ifdef KEYBOARD_NAV
|
#ifdef KEYBOARD_NAV
|
||||||
|
XP_MEMCPY( &board->scoreRects[i], &scoreRect,
|
||||||
|
sizeof(scoreRect) );
|
||||||
if ( i == cursorIndex ) {
|
if ( i == cursorIndex ) {
|
||||||
cursorRect = scoreRect;
|
cursorRect = scoreRect;
|
||||||
cursorRectP = &cursorRect;
|
cursorRectP = &cursorRect;
|
||||||
|
|
|
@ -153,6 +153,7 @@ button_release_event( GtkWidget* XP_UNUSED(widget), GdkEventMotion *event,
|
||||||
return 1;
|
return 1;
|
||||||
} /* button_release_event */
|
} /* button_release_event */
|
||||||
|
|
||||||
|
#ifdef KEY_SUPPORT
|
||||||
static XP_Key
|
static XP_Key
|
||||||
evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
|
evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
|
||||||
{
|
{
|
||||||
|
@ -161,6 +162,7 @@ evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
|
||||||
guint keyval = event->keyval;
|
guint keyval = event->keyval;
|
||||||
|
|
||||||
switch( keyval ) {
|
switch( keyval ) {
|
||||||
|
#ifdef KEYBOARD_NAV
|
||||||
case GDK_Return:
|
case GDK_Return:
|
||||||
xpkey = XP_RETURN_KEY;
|
xpkey = XP_RETURN_KEY;
|
||||||
break;
|
break;
|
||||||
|
@ -184,6 +186,7 @@ evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
|
||||||
xpkey = XP_CURSOR_KEY_DOWN;
|
xpkey = XP_CURSOR_KEY_DOWN;
|
||||||
movesCursor = XP_TRUE;
|
movesCursor = XP_TRUE;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case GDK_BackSpace:
|
case GDK_BackSpace:
|
||||||
XP_LOGF( "... it's a DEL" );
|
XP_LOGF( "... it's a DEL" );
|
||||||
xpkey = XP_CURSOR_KEY_DEL;
|
xpkey = XP_CURSOR_KEY_DEL;
|
||||||
|
@ -199,6 +202,7 @@ evtToXPKey( GdkEventKey* event, XP_Bool* movesCursorP )
|
||||||
return xpkey;
|
return xpkey;
|
||||||
} /* evtToXPKey */
|
} /* evtToXPKey */
|
||||||
|
|
||||||
|
#ifdef KEYBOARD_NAV
|
||||||
static gint
|
static gint
|
||||||
key_press_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
|
key_press_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
|
||||||
GtkAppGlobals* globals )
|
GtkAppGlobals* globals )
|
||||||
|
@ -214,6 +218,7 @@ key_press_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
key_release_event( GtkWidget* XP_UNUSED(widget), GdkEventKey* event,
|
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 ) {
|
if ( xpkey != XP_KEY_NONE ) {
|
||||||
XP_Bool draw;
|
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 ) {
|
if ( movesCursor && !handled ) {
|
||||||
BoardObjectType order[] = { OBJ_SCORE, OBJ_BOARD, OBJ_TRAY };
|
BoardObjectType order[] = { OBJ_SCORE, OBJ_BOARD, OBJ_TRAY };
|
||||||
draw = linShiftFocus( &globals->cGlobals, xpkey, order,
|
draw = linShiftFocus( &globals->cGlobals, xpkey, order,
|
||||||
NULL ) || draw;
|
NULL ) || draw;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if ( draw ) {
|
if ( draw ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
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 */
|
return handled? 1 : 0; /* gtk will do something with the key if 0 returned */
|
||||||
} /* key_release_event */
|
} /* key_release_event */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MEM_DEBUG
|
#ifdef MEM_DEBUG
|
||||||
# define MEMPOOL globals->cGlobals.params->util->mpool,
|
# 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_signal_connect( GTK_OBJECT(drawing_area), "button_release_event",
|
||||||
G_CALLBACK(button_release_event), &globals );
|
G_CALLBACK(button_release_event), &globals );
|
||||||
|
|
||||||
|
#ifdef KEY_SUPPORT
|
||||||
|
# ifdef KEYBOARD_NAV
|
||||||
g_signal_connect( GTK_OBJECT(window), "key_press_event",
|
g_signal_connect( GTK_OBJECT(window), "key_press_event",
|
||||||
G_CALLBACK(key_press_event), &globals );
|
G_CALLBACK(key_press_event), &globals );
|
||||||
|
# endif
|
||||||
g_signal_connect( GTK_OBJECT(window), "key_release_event",
|
g_signal_connect( GTK_OBJECT(window), "key_release_event",
|
||||||
G_CALLBACK(key_release_event), &globals );
|
G_CALLBACK(key_release_event), &globals );
|
||||||
|
#endif
|
||||||
|
|
||||||
gtk_widget_set_events( drawing_area, GDK_EXPOSURE_MASK
|
gtk_widget_set_events( drawing_area, GDK_EXPOSURE_MASK
|
||||||
| GDK_LEAVE_NOTIFY_MASK
|
| GDK_LEAVE_NOTIFY_MASK
|
||||||
| GDK_BUTTON_PRESS_MASK
|
| GDK_BUTTON_PRESS_MASK
|
||||||
| GDK_POINTER_MOTION_MASK
|
| GDK_POINTER_MOTION_MASK
|
||||||
| GDK_BUTTON_RELEASE_MASK
|
| GDK_BUTTON_RELEASE_MASK
|
||||||
|
#ifdef KEY_SUPPORT
|
||||||
|
# ifdef KEYBOARD_NAV
|
||||||
| GDK_KEY_PRESS_MASK
|
| GDK_KEY_PRESS_MASK
|
||||||
|
# endif
|
||||||
| GDK_KEY_RELEASE_MASK
|
| GDK_KEY_RELEASE_MASK
|
||||||
|
#endif
|
||||||
/* | GDK_POINTER_MOTION_HINT_MASK */
|
/* | GDK_POINTER_MOTION_HINT_MASK */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -2033,8 +2033,9 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if ( wParam == 0x08 ) {
|
if ( wParam == 0x08 ) {
|
||||||
wParam = XP_CURSOR_KEY_DEL;
|
wParam = XP_CURSOR_KEY_DEL;
|
||||||
}
|
}
|
||||||
draw = board_handleKey( globals->game.board, wParam )
|
draw = board_handleKeyUp( globals->game.board, wParam, &handled )
|
||||||
|| board_handleKey( globals->game.board, wParam - ('a'-'A') );
|
|| board_handleKeyUp( globals->game.board, wParam - ('a'-'A'),
|
||||||
|
&handled );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
|
|
Loading…
Reference in a new issue