mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
Work around what looks like a PalmOS bug that generates a spurious
keyDown event to a form put up while processing a keyUp event in the main form: set a flag while handling key events, and drop the first keyDown in child forms when it's set.
This commit is contained in:
parent
f56b170b2a
commit
9d74699181
2 changed files with 22 additions and 2 deletions
|
@ -2179,6 +2179,9 @@ handleKeyEvent( PalmAppGlobals* globals, const EventType* event,
|
||||||
BoardCtxt* board = globals->game.board;
|
BoardCtxt* board = globals->game.board;
|
||||||
XP_S16 incr = 0; /* needed for tungsten and zodiac, but not treo since
|
XP_S16 incr = 0; /* needed for tungsten and zodiac, but not treo since
|
||||||
the OS handled focus movement between objects. */
|
the OS handled focus movement between objects. */
|
||||||
|
|
||||||
|
globals->handlingKeyEvent = XP_TRUE;
|
||||||
|
|
||||||
#ifdef DO_TUNGSTEN_FIVEWAY
|
#ifdef DO_TUNGSTEN_FIVEWAY
|
||||||
if ( !globals->generatesKeyUp ) { /* this is the Tungsten case */
|
if ( !globals->generatesKeyUp ) { /* this is the Tungsten case */
|
||||||
if ( event->data.keyDown.chr == vchrNavChange ) {
|
if ( event->data.keyDown.chr == vchrNavChange ) {
|
||||||
|
@ -2319,6 +2322,9 @@ handleKeyEvent( PalmAppGlobals* globals, const EventType* event,
|
||||||
}
|
}
|
||||||
LOG_RETURNF( "%d", draw );
|
LOG_RETURNF( "%d", draw );
|
||||||
*handledP = handled;
|
*handledP = handled;
|
||||||
|
|
||||||
|
globals->handlingKeyEvent = XP_FALSE;
|
||||||
|
|
||||||
return draw;
|
return draw;
|
||||||
} /* handleKeyEvent */
|
} /* handleKeyEvent */
|
||||||
|
|
||||||
|
@ -2992,8 +2998,12 @@ handleScrollInAsk( EventPtr event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case keyDownEvent:
|
case keyDownEvent:
|
||||||
/* don't scroll a menu if open! */
|
if ( globals->ignoreFirstKeyDown ) {
|
||||||
if ( FrmGetWindowHandle( FrmGetActiveForm() ) == WinGetDrawWindow() ) {
|
globals->ignoreFirstKeyDown = XP_FALSE;
|
||||||
|
XP_ASSERT( result );
|
||||||
|
} else if ( FrmGetWindowHandle( FrmGetActiveForm() )
|
||||||
|
== WinGetDrawWindow() ) {
|
||||||
|
/* don't scroll a menu if open! */
|
||||||
switch ( event->data.keyDown.chr ) {
|
switch ( event->data.keyDown.chr ) {
|
||||||
case pageUpChr:
|
case pageUpChr:
|
||||||
case vchrRockerUp:
|
case vchrRockerUp:
|
||||||
|
@ -3128,6 +3138,11 @@ palmask( PalmAppGlobals* globals, XP_UCHAR* str, XP_UCHAR* yesButton,
|
||||||
centerControl( form, XW_ASK_YES_BUTTON_ID );
|
centerControl( form, XW_ASK_YES_BUTTON_ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is making me puke.... :-) */
|
||||||
|
if ( globals->handlingKeyEvent ) {
|
||||||
|
globals->ignoreFirstKeyDown = XP_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
FrmSetEventHandler( form, handleScrollInAsk );
|
FrmSetEventHandler( form, handleScrollInAsk );
|
||||||
|
|
||||||
globals->prevScroll = 0;
|
globals->prevScroll = 0;
|
||||||
|
|
|
@ -298,6 +298,11 @@ struct PalmAppGlobals {
|
||||||
XP_Bool hasTreoFiveWay;
|
XP_Bool hasTreoFiveWay;
|
||||||
XP_Bool generatesKeyUp;
|
XP_Bool generatesKeyUp;
|
||||||
XP_Bool isZodiac;
|
XP_Bool isZodiac;
|
||||||
|
/* PalmOS seems pretty broken w.r.t. key events. If I put up a modal
|
||||||
|
dialog while in the process of handling a keyUp, that form gets a
|
||||||
|
keyDown (and not with the repeat bit set either.) Hack around it. */
|
||||||
|
XP_Bool handlingKeyEvent;
|
||||||
|
XP_Bool ignoreFirstKeyDown;
|
||||||
|
|
||||||
XP_U16 lastKeyDown;
|
XP_U16 lastKeyDown;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue