bug: choosing hint menu also chooses commit-turn if focus happens to

be on 7th tile.  Problem is that OS sends key up after handling menu.
Fix is to track when we've seen a keyDown, and drop keyUp events when
we haven't.
This commit is contained in:
ehouse 2008-10-31 04:36:44 +00:00
parent 288e58373d
commit ff2bef6711
2 changed files with 91 additions and 80 deletions

View file

@ -418,6 +418,7 @@ scrollWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
if ( setFocus ) {
SetFocus( globals->hWnd );
result = 0;
globals->keyDown = XP_TRUE;
}
}
if ( 0 != result ) {
@ -2049,10 +2050,16 @@ static XP_Bool
ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
XP_Bool keyDown, XP_Bool* handledP )
{
XP_Bool draw = XP_FALSE;
/* Sometimes, e.g. after a menu is released, we get KEY_UP not preceeded
by KEY_DOWN. Just drop those. */
if ( !keyDown && !globals->keyDown ) {
XP_LOGF( "%s: keyUp not preceeded by keyDown: dropping", __func__ );
} else {
XP_Bool isRepeat = keyDown && ((HIWORD(lParam) & KF_REPEAT) != 0);
XP_Key key;
XP_S16 incr = 0;
XP_Bool draw = XP_FALSE;
switch ( wParam ) {
case VK_UP:
@ -2081,10 +2088,10 @@ ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
break;
/* Still need to produce these somehow */
/* XP_CURSOR_KEY_ALTRIGHT, */
/* XP_CURSOR_KEY_ALTUP, */
/* XP_CURSOR_KEY_ALTLEFT, */
/* XP_CURSOR_KEY_ALTDOWN, */
/* XP_CURSOR_KEY_ALTRIGHT, */
/* XP_CURSOR_KEY_ALTUP, */
/* XP_CURSOR_KEY_ALTLEFT, */
/* XP_CURSOR_KEY_ALTDOWN, */
default:
key = XP_KEY_NONE;
@ -2154,6 +2161,8 @@ ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
}
}
}
}
globals->keyDown = keyDown;
return draw;
} /* ceCheckHandleFocusKey */
#endif /* KEYBOARD_NAV */

View file

@ -153,7 +153,9 @@ typedef struct CEAppGlobals {
#endif
XP_Bool scrollerHasFocus;
#endif
#ifdef KEYBOARD_NAV
XP_Bool keyDown;
#endif
CeSocketWrapper* socketWrap;
CEAppPrefs appPrefs;