From aac30fffea79506de5b3767140dbe0e59b8f1879 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 4 Feb 2007 04:10:11 +0000 Subject: [PATCH] Drop keyUp events not preceeded by keyDowns to catch leaks from dismissed dialogs; don't drop first keyDown on OS4 since the bug that works around isn't there; turn BT back off by default. --- palm/Makefile | 2 +- palm/palmmain.c | 13 ++++++++++--- palm/palmmain.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/palm/Makefile b/palm/Makefile index 06f6e0256..2784b8324 100644 --- a/palm/Makefile +++ b/palm/Makefile @@ -119,7 +119,7 @@ MYDEFS_COMMON += -DXWFEATURE_SEARCHLIMIT # MYDEFS_COMMON += -DXWFEATURE_RELAY # turn on bluetooth comms option for 68K and ARM -- which won't work yet -BLUETOOTH = -DXWFEATURE_BLUETOOTH +#BLUETOOTH = -DXWFEATURE_BLUETOOTH #MYDEFS_COMMON += $(BLUETOOTH) # Add menu allowing to choose to run 68K or ARM diff --git a/palm/palmmain.c b/palm/palmmain.c index 4bce38652..409dcecb1 100644 --- a/palm/palmmain.c +++ b/palm/palmmain.c @@ -953,6 +953,7 @@ initHighResGlobals( PalmAppGlobals* globals ) XP_U32 vers; err = FtrGet( sysFtrCreator, sysFtrNumWinVersion, &vers ); + XP_ASSERT( err == errNone ); globals->hasHiRes = (err == errNone) && (vers >= 4) && !globals->isZodiac; XP_LOGF( "hasHiRes = %d", (XP_U16)globals->hasHiRes ); globals->oneDotFiveAvail = globals->hasHiRes @@ -2358,7 +2359,6 @@ handleKeyEvent( PalmAppGlobals* globals, const EventType* event, /* remove this and break focus drilldown. Why? */ handled = draw; } - LOG_RETURNF( "%d", draw ); *handledP = handled; globals->handlingKeyEvent = XP_FALSE; @@ -2805,8 +2805,14 @@ mainViewHandleEvent( EventPtr event ) case keyUpEvent: XP_ASSERT( globals->generatesKeyUp ); + if ( globals->keyDownReceived ) { + globals->keyDownReceived = XP_FALSE; + draw = handleKeyEvent( globals, event, &handled ); + } + break; case keyDownEvent: if ( !globals->menuIsDown ) { + globals->keyDownReceived = XP_TRUE; draw = handleKeyEvent( globals, event, &handled ); } break; @@ -3176,8 +3182,9 @@ palmask( PalmAppGlobals* globals, const XP_UCHAR* str, const XP_UCHAR* yesButton centerControl( form, XW_ASK_YES_BUTTON_ID ); } - /* This is making me puke.... :-) */ - if ( globals->handlingKeyEvent ) { + /* If we're running OS5 (oneDotFiveAvail), then eat the first keyDown. + If an earlier OS (Treo600) then we won't see that spurious event. */ + if ( globals->handlingKeyEvent && globals->oneDotFiveAvail ) { globals->ignoreFirstKeyDown = XP_TRUE; } diff --git a/palm/palmmain.h b/palm/palmmain.h index 3f9cba667..5561fbc9d 100644 --- a/palm/palmmain.h +++ b/palm/palmmain.h @@ -298,6 +298,7 @@ struct PalmAppGlobals { XP_Bool hasTreoFiveWay; XP_Bool generatesKeyUp; XP_Bool isZodiac; + XP_Bool keyDownReceived; /* 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. */