From e25caaba1a484f1f1361ddc8746404e063adcb39 Mon Sep 17 00:00:00 2001 From: ehouse Date: Wed, 29 Nov 2006 04:11:24 +0000 Subject: [PATCH] add hand-coded implementation of HsNavDrawFocusRing. This works, but should be replaced by generated code. --- palm/pace_man.c | 35 +++++++++++++++++++++++++++++++++++ palm/pace_man.h | 10 ++++++++++ palm/palmutil.c | 3 --- palm/pnostate.h | 10 +++++++++- 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/palm/pace_man.c b/palm/pace_man.c index c8d66aeb2..1e3733a8f 100644 --- a/palm/pace_man.c +++ b/palm/pace_man.c @@ -128,6 +128,41 @@ read_unaligned32( const unsigned char* src ) return val; } /* read_unaligned32 */ +#ifdef XWFEATURE_FIVEWAY +#include "pnostate.h" +Err +HsNavDrawFocusRing (FormType* formP, UInt16 objectID, Int16 extraInfo, + RectangleType* rP, + HsNavFocusRingStyleEnum ringStyle, Boolean forceRestore) +{ + Err result; + FUNC_HEADER(HsNavDrawFocusRing); + + 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, hsSelNavDrawFocusRing, 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(sysTrapHsSelector), + stack, 18 ); + sp->emulStateP->regA[7] -= 2; + } + FUNC_TAIL(HsNavDrawFocusRing); + return result; +} +#endif + /* Need to parse the format string */ Int16 StrPrintF( Char* s, const Char* formatStr, ... ) diff --git a/palm/pace_man.h b/palm/pace_man.h index a34e66389..ef73830ce 100644 --- a/palm/pace_man.h +++ b/palm/pace_man.h @@ -129,5 +129,15 @@ unsigned short read_unaligned16( const unsigned char* src ); # define EMIT_NAME(n,b) #endif +/* Temporary until can generate */ +#ifdef XWFEATURE_FIVEWAY +#include +extern Err HsNavDrawFocusRing( FormType* formP, UInt16 objectID, + Int16 extraInfo, + RectangleType* boundsInsideRingP, + HsNavFocusRingStyleEnum ringStyle, + Boolean forceRestore); +#endif + #endif #endif diff --git a/palm/palmutil.c b/palm/palmutil.c index 682d8a3ec..25f7519c2 100644 --- a/palm/palmutil.c +++ b/palm/palmutil.c @@ -407,8 +407,6 @@ getFocusOwner( void ) void drawFocusRingOnGadget( XP_U16 idLow, XP_U16 idHigh ) { -#ifndef XW_TARGET_PNO /* temporary: I need to figure out how to call - HsNavDrawFocusRing from ARM code */ FormPtr form; XP_S16 index; XP_U16 focusID; @@ -443,7 +441,6 @@ drawFocusRingOnGadget( XP_U16 idLow, XP_U16 idHigh ) } } LOG_RETURN_VOID(); -#endif } /* drawFocusRingOnGadget */ XP_Bool diff --git a/palm/pnostate.h b/palm/pnostate.h index 0c21f9f89..362f25f5f 100644 --- a/palm/pnostate.h +++ b/palm/pnostate.h @@ -6,9 +6,17 @@ #include #include +/* from http://news.palmos.com/read/messages?id=159373 */ +typedef struct EmulStateType { + UInt32 instr; + UInt32 regD[8]; + UInt32 regA[8]; + UInt32 regPC; +} EmulStateType; + /* This gets written into the code by the callback below. */ typedef struct PNOState { - const void* emulStateP; + const EmulStateType* emulStateP; Call68KFuncType* call68KFuncP; void* gotTable; } PNOState;