From b23d51fba4b0c09f6e61293c842e62c0909a5e7d Mon Sep 17 00:00:00 2001 From: ehouse Date: Fri, 17 Nov 2006 13:46:06 +0000 Subject: [PATCH] Draw focus differently in tray if whole thing has it, to include borders between the tiles. --- palm/palmdraw.c | 24 ++++++++++++++---------- palm/palmmain.c | 9 +++++++++ palm/palmmain.h | 1 + 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/palm/palmdraw.c b/palm/palmdraw.c index 7a7f4cb58..985e15f45 100644 --- a/palm/palmdraw.c +++ b/palm/palmdraw.c @@ -615,6 +615,7 @@ palm_bnw_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect, WinGetClip( &dctx->oldTrayClip ); WinSetClip( (RectangleType*)rect ); + dctx->topFocus = dfs == DFS_TOP; return XP_TRUE; } /* palm_bnw_draw_trayBegin */ @@ -647,27 +648,33 @@ palm_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 len, width; XP_U16 doubler = 1; const XP_Bool cursor = (flags & CELL_ISCURSOR) != 0; - IndexedColorType oclr = 0; XP_Bool empty = (flags & CELL_ISEMPTY) != 0; + WinPushDrawState(); + if ( dctx->doHiRes ) { doubler = 2; } draw_clearRect( p_dctx, &localR ); + + if ( dctx->topFocus || cursor ) { + (void)WinSetBackColor( dctx->drawingPrefs->drawColors[COLOR_CURSOR] ); + if ( dctx->topFocus ) { + WinEraseRectangle( (const RectangleType*)&localR, 0 ); + } + } localR.height -= 3 * doubler; localR.top += 2 * doubler; + localR.width -= 3 * doubler; + localR.left += 2 * doubler; - if ( cursor ) { - oclr = WinSetBackColor( dctx->drawingPrefs->drawColors[COLOR_CURSOR] ); + if ( cursor && !dctx->topFocus ) { /* this will fill it with the tile background color */ WinEraseRectangle( (const RectangleType*)&localR, 0 ); } - localR.width -= 3 * doubler; - localR.left += 2 * doubler; - /* this will fill it with the tile background color */ if ( !empty && !cursor ) { WinEraseRectangle( (const RectangleType*)&localR, 0 ); @@ -723,10 +730,7 @@ palm_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect, } } } - - if ( cursor ) { - WinSetBackColor( oclr ); - } + WinPopDrawState(); } /* palm_draw_drawTile */ static void diff --git a/palm/palmmain.c b/palm/palmmain.c index 0d904234f..a5f58a016 100644 --- a/palm/palmmain.c +++ b/palm/palmmain.c @@ -2570,6 +2570,15 @@ mainViewHandleEvent( EventPtr event ) } if ( xpkey != XP_KEY_NONE ) { draw = board_handleKey( globals->game.board, xpkey, &handled ); + /* If handled comes back false yet something changed (draw), + we'll be getting another event shortly. Put the draw off + until then so we don't flash the tray focussed then not. This + is a hack, but I can't think of a way to integrate it into + board.c logic without making too many palm-centric assumptions + there. */ + if ( draw && !handled ) { + draw = XP_FALSE; + } } else { /* remove this and break focus drilldown. Why? */ handled = draw; diff --git a/palm/palmmain.h b/palm/palmmain.h index bb0fd30bc..ead5bcec0 100644 --- a/palm/palmmain.h +++ b/palm/palmmain.h @@ -85,6 +85,7 @@ typedef struct PalmDrawCtx { UInt16 oldCoord; XP_Bool doHiRes; XP_Bool oneDotFiveAvail; + XP_Bool topFocus; XP_LangCode fontLangCode; PalmFontHtInfo* fontHtInfo;