Call HsNavDrawFocusRing on Treo600, FrmNavDrawFocusRing on later

devices.  Fixes crasher on devices that don't have the former.  Up version.
This commit is contained in:
ehouse 2007-04-23 03:20:37 +00:00
parent 630d9e391b
commit a1a0f9934a
8 changed files with 85 additions and 16 deletions

View file

@ -141,7 +141,7 @@ newGameHandleEvent( EventPtr event )
object */
case frmObjectFocusTakeEvent:
case frmObjectFocusLostEvent:
result = considerGadgetFocus( event, XW_SOLO_GADGET_ID,
result = considerGadgetFocus( globals, event, XW_SOLO_GADGET_ID,
XW_CLIENT_GADGET_ID );
break;
#endif
@ -345,7 +345,7 @@ drawConnectGadgets( PalmAppGlobals* globals )
drawGadgetsFromList( list, XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID,
hiliteItem );
#ifdef XWFEATURE_FIVEWAY
drawFocusRingOnGadget( XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID );
drawFocusRingOnGadget( globals, XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID );
#endif
} /* drawConnectGadgets */

View file

@ -168,6 +168,38 @@ HsNavDrawFocusRing (FormType* formP, UInt16 objectID, Int16 extraInfo,
FUNC_TAIL(HsNavDrawFocusRing);
return result;
}
Err
FrmNavDrawFocusRing(FormType* formP, UInt16 objectID, Int16 extraInfo,
RectangleType* rP,
HsNavFocusRingStyleEnum ringStyle, Boolean forceRestore)
{
Err result;
FUNC_HEADER(FrmNavDrawFocusRing);
RectangleType RectangleType_68K1;
SWAP_RECTANGLETYPE_ARM_TO_68K( &RectangleType_68K1, rP );
{
PNOState* sp = GET_CALLBACK_STATE();
STACK_START(unsigned char, stack, 18);
ADD_TO_STACK2(stack, 0x0007, 0);
ADD_TO_STACK4(stack, formP, 2);
ADD_TO_STACK2(stack, objectID, 6);
ADD_TO_STACK2(stack, extraInfo, 8);
ADD_TO_STACK4(stack, &RectangleType_68K1, 10);
ADD_TO_STACK1(stack, ringStyle, 14);
ADD_TO_STACK1(stack, forceRestore, 16);
STACK_END(stack);
result = (Err)(*sp->call68KFuncP)( sp->emulStateP,
PceNativeTrapNo(sysTrapNavSelector),
stack, 18 );
sp->emulStateP->regA[7] -= 2;
}
FUNC_TAIL(FrmNavDrawFocusRing);
return result;
}
#endif
/* Need to parse the format string */

View file

@ -968,12 +968,20 @@ initHighResGlobals( PalmAppGlobals* globals )
&& (err == errNone) && (vers >= 5);
#ifdef XWFEATURE_FIVEWAY
# ifndef hsFtrIDNavigationSupported
# define hsFtrIDNavigationSupported 14
# endif
err = FtrGet( sysFtrCreator, sysFtrNumUIHardwareFlags, &vers );
globals->generatesKeyUp = ( (err == errNone) &&
((vers & sysFtrNumUIHardwareHasKbd) != 0) )
|| globals->isZodiac;
globals->hasTreoFiveWay = (err == errNone)
&& ((vers & sysFtrNumUIHardwareHas5Way) != 0) && !globals->isZodiac;
err = FtrGet( hsFtrCreator, hsFtrIDNavigationSupported, &vers );
XP_ASSERT( errNone == err );
XP_ASSERT( vers == 1 || vers == 2 );
globals->isTreo600 = (err == errNone) && (vers == 1);
#endif
#ifdef FEATURE_SILK
@ -1833,11 +1841,11 @@ drawFormButtons( PalmAppGlobals* globals )
setFormFocus( globals->mainForm, focusItem );
if ( !isBoardObject( focusItem )
&& buttonIsUsable( getActiveObjectPtr(focusItem) ) ) {
drawFocusRingOnGadget( focusItem, focusItem );
drawFocusRingOnGadget( globals, focusItem, focusItem );
}
globals->gState.focusItem = -1;
} else {
drawFocusRingOnGadget( XW_MAIN_DONE_BUTTON_ID,
drawFocusRingOnGadget( globals, XW_MAIN_DONE_BUTTON_ID,
XW_MAIN_HIDE_BUTTON_ID );
}
}

View file

@ -275,6 +275,9 @@ struct PalmAppGlobals {
Boolean menuIsDown;
XP_Bool newGameIsNew;
XP_Bool runningOnPOSE; /* Needed for NetLibSelect */
#ifdef XWFEATURE_FIVEWAY
XP_Bool isTreo600;
#endif
#ifdef XWFEATURE_BLUETOOTH
XP_Bool userCancelledBT;
#endif
@ -423,4 +426,6 @@ void checkAndDeliver( PalmAppGlobals* globals, const CommsAddrRec* addr,
# define READ_UNALIGNED16(n) *(n)
#endif
#define IS_T600(g) (g)->isTreo600
#endif /* _PALMMAIN_H_ */

View file

@ -411,8 +411,23 @@ setFormFocus( FormPtr form, XP_U16 objectID )
FrmSetFocus( form, FrmGetObjectIndex( form, objectID ) );
} /* setFormFocus */
#ifndef XW_TARGET_PNO
/* Warning: gross hack. HsNavDrawFocusRing doesn't work on newer Palms,
e.g. Tungsten T. It's been replaced by FrmNavDrawFocusRing. But that
requires the sdk-5r4 headers which require significant changes I don't want
to make right before shipping. So here's a hack: define FrmNavDrawFocusRing
based on info in the r4 header info without actually including any headers.
*/
Err FrmNavDrawFocusRing( FormType* fp, UInt16 oid, Int16 ei,
RectangleType* birp,
HsNavFocusRingStyleEnum rs, Boolean fr )
_SYSTEM_API(_CALL_WITH_UNPOPPED_16BIT_SELECTOR)(_SYSTEM_TABLE,
sysTrapNavSelector,
0x07 );
#endif
void
drawFocusRingOnGadget( XP_U16 idLow, XP_U16 idHigh )
drawFocusRingOnGadget( PalmAppGlobals* globals, XP_U16 idLow, XP_U16 idHigh )
{
FormPtr form;
XP_S16 index;
@ -430,16 +445,24 @@ drawFocusRingOnGadget( XP_U16 idLow, XP_U16 idHigh )
getObjectBounds( focusID, &rect );
/* growing the rect didn't work to fix glitches in ring drawing. */
err = HsNavDrawFocusRing( form, focusID, 0, &rect,
hsNavFocusRingStyleObjectTypeDefault,
false );
if ( IS_T600(globals) ) {
XP_LOGF( "%s: calling HsNavDrawFocusRing", __func__ );
err = HsNavDrawFocusRing( form, focusID, 0, &rect,
hsNavFocusRingStyleObjectTypeDefault,
false );
} else {
XP_LOGF( "%s: calling FrmNavDrawFocusRing", __func__ );
err = FrmNavDrawFocusRing( form, focusID, 0, &rect,
hsNavFocusRingStyleObjectTypeDefault,
false );
}
XP_ASSERT( err == errNone );
}
}
} /* drawFocusRingOnGadget */
XP_Bool
considerGadgetFocus( const EventType* event, XP_U16 idLow, XP_U16 idHigh )
considerGadgetFocus( PalmAppGlobals* globals, const EventType* event, XP_U16 idLow, XP_U16 idHigh )
{
XP_Bool handled;
XP_U16 objectID;
@ -456,7 +479,7 @@ considerGadgetFocus( const EventType* event, XP_U16 idLow, XP_U16 idHigh )
if ( event->eType == frmObjectFocusTakeEvent ) {
FormPtr form = FrmGetActiveForm();
setFormFocus( form, objectID );
drawFocusRingOnGadget( idLow, idHigh );
drawFocusRingOnGadget( globals, idLow, idHigh );
}
}

View file

@ -78,9 +78,10 @@ void drawOneGadget( UInt16 id, const char* text, Boolean hilite );
# ifdef XWFEATURE_FIVEWAY
XP_S16 getFocusOwner( void );
void setFormFocus( FormPtr form, XP_U16 objectID );
void drawFocusRingOnGadget( XP_U16 idLow, XP_U16 idHigh );
XP_Bool considerGadgetFocus( const EventType* event, XP_U16 idLow,
XP_U16 idHigh );
void drawFocusRingOnGadget( PalmAppGlobals* globals, XP_U16 idLow,
XP_U16 idHigh );
XP_Bool considerGadgetFocus( PalmAppGlobals* globals, const EventType* event,
XP_U16 idLow, XP_U16 idHigh );
XP_Bool tryRockerKey( XP_U16 key, XP_U16 selGadget,
XP_U16 idLow, XP_U16 idHigh );

View file

@ -101,7 +101,7 @@ PrefsFormHandleEvent( EventPtr event )
case frmObjectFocusTakeEvent:
case frmObjectFocusLostEvent:
result = considerGadgetFocus( event, XW_PREFS_ALLGAMES_GADGET_ID,
result = considerGadgetFocus( globals, event, XW_PREFS_ALLGAMES_GADGET_ID,
XW_PREFS_ONEGAME_GADGET_ID );
break;
#endif
@ -353,7 +353,7 @@ drawPrefsTypeGadgets( PalmAppGlobals* globals )
drawGadgetsFromList( list, XW_PREFS_ALLGAMES_GADGET_ID,
XW_PREFS_ONEGAME_GADGET_ID, active );
#ifdef XWFEATURE_FIVEWAY
drawFocusRingOnGadget( XW_PREFS_ALLGAMES_GADGET_ID,
drawFocusRingOnGadget( globals, XW_PREFS_ALLGAMES_GADGET_ID,
XW_PREFS_ONEGAME_GADGET_ID );
#endif
LOG_RETURN_VOID();

View file

@ -436,7 +436,7 @@
#ifdef XWFEATURE_BLUETOOTH
# define XW_PALM_VERSION_STRING "4.3a8"
#else
# define XW_PALM_VERSION_STRING "4.2rc1"
# define XW_PALM_VERSION_STRING "4.2rc2"
#endif
#define CUR_PREFS_VERS 0x0405