keep track of last key down so can fake key up event when palm won't

be giving us one, e.g. when holding key results in a system window
coming up;
This commit is contained in:
ehouse 2007-01-12 03:34:43 +00:00
parent f329966a8a
commit 5a87db48bd
2 changed files with 17 additions and 3 deletions

View file

@ -2144,11 +2144,14 @@ handleKeyEvent( PalmAppGlobals* globals, const EventType* event,
if ( treatAsUp ) {
handler = board_handleKeyUp;
globals->lastKeyDown = XP_KEY_NONE;
} else if ( globals->hasKeyboard ) {
if ( (event->data.keyDown.modifiers & autoRepeatKeyMask) != 0 ) {
handler = board_handleKeyRepeat;
} else {
handler = board_handleKeyDown;
XP_ASSERT( globals->lastKeyDown == XP_KEY_NONE );
globals->lastKeyDown = event->data.keyDown.keyCode;
}
} else {
handler = NULL;
@ -2327,9 +2330,18 @@ mainViewHandleEvent( EventPtr event )
break;
case winExitEvent:
if ( event->data.winExit.exitWindow == (WinHandle)FrmGetActiveForm() ) {
if ( event->data.winExit.exitWindow == (WinHandle)FrmGetActiveForm() ){
globals->menuIsDown = true;
}
if ( globals->lastKeyDown != XP_KEY_NONE ) {
EventType event;
XP_Bool ignore;
event.eType = keyUpEvent;
event.data.keyUp.chr = event.data.keyUp.keyCode
= globals->lastKeyDown;
(void)handleKeyEvent( globals, &event, &ignore );
}
break;
case winEnterEvent:
@ -2340,7 +2352,7 @@ mainViewHandleEvent( EventPtr event )
// the first form opened is not the one you are currently watching
// for)
if (event->data.winEnter.enterWindow == (WinHandle)FrmGetActiveForm() &&
event->data.winEnter.enterWindow == (WinHandle)FrmGetFirstForm() ) {
event->data.winEnter.enterWindow == (WinHandle)FrmGetFirstForm() ){
globals->menuIsDown = false;
}
break;

View file

@ -1,6 +1,6 @@
/* -*-mode: C; fill-column: 76; c-basic-offset: 4; -*- */
/*
* Copyright 1999 - 2003 by Eric House (xwords@eehouse.org). All rights reserved.
* Copyright 1999 - 2007 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -298,6 +298,8 @@ struct PalmAppGlobals {
XP_Bool hasFiveWay;
XP_Bool hasKeyboard;
XP_U16 lastKeyDown;
#ifdef XWFEATURE_SEARCHLIMIT
XP_Bool askTrayLimits;
#endif