mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-11 08:48:06 +01:00
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:
parent
288e58373d
commit
ff2bef6711
2 changed files with 91 additions and 80 deletions
|
@ -418,6 +418,7 @@ scrollWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
if ( setFocus ) {
|
if ( setFocus ) {
|
||||||
SetFocus( globals->hWnd );
|
SetFocus( globals->hWnd );
|
||||||
result = 0;
|
result = 0;
|
||||||
|
globals->keyDown = XP_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( 0 != result ) {
|
if ( 0 != result ) {
|
||||||
|
@ -2049,10 +2050,16 @@ static XP_Bool
|
||||||
ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
|
ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
|
||||||
XP_Bool keyDown, XP_Bool* handledP )
|
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_Bool isRepeat = keyDown && ((HIWORD(lParam) & KF_REPEAT) != 0);
|
||||||
XP_Key key;
|
XP_Key key;
|
||||||
XP_S16 incr = 0;
|
XP_S16 incr = 0;
|
||||||
XP_Bool draw = XP_FALSE;
|
|
||||||
|
|
||||||
switch ( wParam ) {
|
switch ( wParam ) {
|
||||||
case VK_UP:
|
case VK_UP:
|
||||||
|
@ -2081,10 +2088,10 @@ ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Still need to produce these somehow */
|
/* Still need to produce these somehow */
|
||||||
/* XP_CURSOR_KEY_ALTRIGHT, */
|
/* XP_CURSOR_KEY_ALTRIGHT, */
|
||||||
/* XP_CURSOR_KEY_ALTUP, */
|
/* XP_CURSOR_KEY_ALTUP, */
|
||||||
/* XP_CURSOR_KEY_ALTLEFT, */
|
/* XP_CURSOR_KEY_ALTLEFT, */
|
||||||
/* XP_CURSOR_KEY_ALTDOWN, */
|
/* XP_CURSOR_KEY_ALTDOWN, */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
key = XP_KEY_NONE;
|
key = XP_KEY_NONE;
|
||||||
|
@ -2154,6 +2161,8 @@ ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
globals->keyDown = keyDown;
|
||||||
return draw;
|
return draw;
|
||||||
} /* ceCheckHandleFocusKey */
|
} /* ceCheckHandleFocusKey */
|
||||||
#endif /* KEYBOARD_NAV */
|
#endif /* KEYBOARD_NAV */
|
||||||
|
|
|
@ -153,7 +153,9 @@ typedef struct CEAppGlobals {
|
||||||
#endif
|
#endif
|
||||||
XP_Bool scrollerHasFocus;
|
XP_Bool scrollerHasFocus;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef KEYBOARD_NAV
|
||||||
|
XP_Bool keyDown;
|
||||||
|
#endif
|
||||||
CeSocketWrapper* socketWrap;
|
CeSocketWrapper* socketWrap;
|
||||||
|
|
||||||
CEAppPrefs appPrefs;
|
CEAppPrefs appPrefs;
|
||||||
|
|
Loading…
Add table
Reference in a new issue