mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-02 06:20:14 +01:00
back out 2245: having scrollbar be focusable is a better way of allowing scrolling than overloading cursor movement; scroll cursor onscreen when diving and it is off
This commit is contained in:
parent
afbb5ed2fe
commit
c48f836fe7
1 changed files with 13 additions and 48 deletions
|
@ -2390,6 +2390,7 @@ invalFocusOwner( BoardCtxt* board )
|
||||||
if ( board->focusHasDived ) {
|
if ( board->focusHasDived ) {
|
||||||
BdCursorLoc loc = pti->bdCursor;
|
BdCursorLoc loc = pti->bdCursor;
|
||||||
invalCell( board, loc.col, loc.row );
|
invalCell( board, loc.col, loc.row );
|
||||||
|
checkScrollCell( board, loc.col, loc.row );
|
||||||
} else {
|
} else {
|
||||||
#ifdef PERIMETER_FOCUS
|
#ifdef PERIMETER_FOCUS
|
||||||
invalPerimeter( board );
|
invalPerimeter( board );
|
||||||
|
@ -2606,55 +2607,19 @@ stripAlt( XP_Key key, XP_Bool* wasAlt )
|
||||||
return key;
|
return key;
|
||||||
} /* stripAlt */
|
} /* stripAlt */
|
||||||
|
|
||||||
static XP_Bool
|
|
||||||
scrollTrumpsMove( const BoardCtxt* board, XP_Key cursorKey, XP_S16* moveBy )
|
|
||||||
{
|
|
||||||
XP_Bool scroll = XP_FALSE;
|
|
||||||
if ( XP_CURSOR_KEY_DOWN == cursorKey ) {
|
|
||||||
scroll = (board->lastVisibleRow+1) < model_numRows( board->model );
|
|
||||||
if ( scroll ) {
|
|
||||||
*moveBy = -1;
|
|
||||||
}
|
|
||||||
} else if ( XP_CURSOR_KEY_UP == cursorKey ) {
|
|
||||||
scroll = board->yOffset > 0;
|
|
||||||
if ( scroll ) {
|
|
||||||
*moveBy = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
board_moveCursor( BoardCtxt* board, XP_Key cursorKey, XP_Bool preflightOnly,
|
board_moveCursor( BoardCtxt* board, XP_Key cursorKey, XP_Bool preflightOnly,
|
||||||
XP_Bool* up )
|
XP_Bool* up )
|
||||||
{
|
{
|
||||||
PerTurnInfo* pti = board->selInfo;
|
PerTurnInfo* pti = board->selInfo;
|
||||||
BdCursorLoc loc;
|
BdCursorLoc loc = pti->bdCursor;
|
||||||
XP_S16 moveBy;
|
XP_U16 col = loc.col;
|
||||||
|
XP_U16 row = loc.row;
|
||||||
XP_Bool changed;
|
XP_Bool changed;
|
||||||
XP_Bool needMove = XP_FALSE;
|
|
||||||
|
|
||||||
XP_Bool altSet;
|
XP_Bool altSet;
|
||||||
cursorKey = stripAlt( cursorKey, &altSet );
|
cursorKey = stripAlt( cursorKey, &altSet );
|
||||||
|
|
||||||
changed = !preflightOnly
|
|
||||||
&& scrollTrumpsMove( board, cursorKey, &moveBy );
|
|
||||||
if ( changed ) {
|
|
||||||
if ( adjustYOffset( board, moveBy ) ) {
|
|
||||||
/* need to move the cursor too? */
|
|
||||||
XP_Rect ignore;
|
|
||||||
loc = pti->bdCursor;
|
|
||||||
needMove = !getCellRect( board, loc.col, loc.row, &ignore );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PENDING: Is it a problem that needMove will only get set if
|
|
||||||
preflightOnly is false? */
|
|
||||||
if ( !changed || needMove ) {
|
|
||||||
XP_U16 col, row;
|
|
||||||
loc = pti->bdCursor;
|
|
||||||
col = loc.col;
|
|
||||||
row = loc.row;
|
|
||||||
changed = figureNextLoc( board, cursorKey, XP_FALSE, altSet,
|
changed = figureNextLoc( board, cursorKey, XP_FALSE, altSet,
|
||||||
&col, &row, up );
|
&col, &row, up );
|
||||||
if ( changed && !preflightOnly ) {
|
if ( changed && !preflightOnly ) {
|
||||||
|
@ -2663,7 +2628,7 @@ board_moveCursor( BoardCtxt* board, XP_Key cursorKey, XP_Bool preflightOnly,
|
||||||
loc.col = col;
|
loc.col = col;
|
||||||
loc.row = row;
|
loc.row = row;
|
||||||
pti->bdCursor = loc;
|
pti->bdCursor = loc;
|
||||||
}
|
checkScrollCell( board, col, row );
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
} /* board_moveCursor */
|
} /* board_moveCursor */
|
||||||
|
|
Loading…
Reference in a new issue