Fix bugs in recent focus/key changes.

This commit is contained in:
ehouse 2007-01-12 03:37:30 +00:00
parent a056dad08c
commit c1affa34d1

View file

@ -2638,8 +2638,12 @@ board_handleKeyDown( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
*pHandled = draw; *pHandled = draw;
} }
} else if ( board->focussed != OBJ_NONE ) { } else if ( board->focussed != OBJ_NONE ) {
if ( board->focusHasDived && (key == XP_RAISEFOCUS_KEY) ) {
*pHandled = XP_TRUE;
} else {
draw = handleFocusKeyUp( board, key, XP_TRUE, pHandled ) || draw; draw = handleFocusKeyUp( board, key, XP_TRUE, pHandled ) || draw;
} }
}
return draw; return draw;
} }
@ -2647,13 +2651,16 @@ board_handleKeyDown( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
XP_Bool XP_Bool
board_handleKeyRepeat( BoardCtxt* board, XP_Key key, XP_Bool* handled ) board_handleKeyRepeat( BoardCtxt* board, XP_Key key, XP_Bool* handled )
{ {
XP_Bool upHandled, downHandled;
XP_Bool draw; XP_Bool draw;
if ( key == XP_RETURN_KEY ) {
*handled = XP_FALSE;
} else {
XP_Bool upHandled, downHandled;
draw = board_handleKeyUp( board, key, &upHandled ); draw = board_handleKeyUp( board, key, &upHandled );
draw = board_handleKeyDown( board, key, &downHandled ) || draw; draw = board_handleKeyDown( board, key, &downHandled ) || draw;
*handled = upHandled || downHandled; *handled = upHandled || downHandled;
}
return draw; return draw;
} }
#endif /* KEYBOARD_NAV */ #endif /* KEYBOARD_NAV */
@ -2887,11 +2894,10 @@ figureNextLoc( BoardCtxt* board, XP_Key cursorKey,
end = max; end = max;
break; break;
default: default:
XP_ASSERT( XP_FALSE ); XP_LOGF( "%s: odd cursor key: %d", __FUNCTION__, cursorKey );
} }
XP_ASSERT( incr != 0 ); if ( incr != 0 ) {
for ( ; ; ) { for ( ; ; ) {
if ( *useWhat == end ) { if ( *useWhat == end ) {
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
@ -2903,12 +2909,13 @@ figureNextLoc( BoardCtxt* board, XP_Key cursorKey,
} }
result = XP_TRUE; result = XP_TRUE;
*useWhat += incr; *useWhat += incr;
if ( forceFirst || !cellOccupied( board, if ( forceFirst
*colP, *rowP, inclPending ) ) { || !cellOccupied( board, *colP, *rowP, inclPending ) ) {
break; break;
} }
} }
} }
}
return result; return result;
} /* figureNextLoc */ } /* figureNextLoc */