From de0c62fb3912e482960675f0cc19a764ca13f39a Mon Sep 17 00:00:00 2001 From: ehouse Date: Fri, 7 Jul 2006 08:39:31 +0000 Subject: [PATCH] Compensate for OS' failure to deliver penup events by checking for pendownness at critical points when an up event should have been processed: when another pen down happens, when about to scroll, and when events (menus and buttons) occur. This seems to catch all the lingering miniwindow problems. Add flip menuitem (win32 only for now). --- xwords4/wince/cemain.c | 28 +++++++++++++++++++++++----- xwords4/wince/resource.h | 11 +++++++---- xwords4/wince/xwords4.rc | 3 +++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c index 1418c09e0..1cbc8a4b0 100755 --- a/xwords4/wince/cemain.c +++ b/xwords4/wince/cemain.c @@ -1813,10 +1813,21 @@ processPacket( CEAppGlobals* globals, XWStreamCtxt* instream ) } /* processPacket */ #endif +static XP_Bool +checkPenDown( CEAppGlobals* globals ) +{ + XP_Bool draw = globals->penDown; + if ( draw ) { + draw = board_handlePenUp( globals->game.board, 0x7FFF, 0x7FFF ); + globals->penDown = XP_FALSE; + } + return draw; +} /* checkPenDown */ + LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - int wmId, wmEvent; + int wmId; RECT rt; XP_Bool draw = XP_FALSE; XWTimerReason why; @@ -1859,15 +1870,17 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) #ifdef CEFEATURE_CANSCROLL case WM_VSCROLL: + draw = checkPenDown( globals ); draw = handleScroll( globals, (short int)HIWORD(wParam), (short int)LOWORD(wParam), - (HWND)lParam ); + (HWND)lParam ) || draw; break; #endif case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + (void)checkPenDown( globals ); + wmId = LOWORD(wParam); + // Parse the menu selections: switch (wmId) { case ID_FILE_ABOUT: @@ -1947,6 +1960,9 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) draw = handleDoneCmd( globals); break; +#ifndef _WIN32_WCE + case ID_MOVE_FLIP: +#endif case FLIP_BUTTON_ID: draw = board_flip( globals->game.board ); break; @@ -2004,9 +2020,11 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_LBUTTONDOWN: + draw = checkPenDown( globals ); globals->penDown = XP_TRUE; draw = board_handlePenDown( globals->game.board, LOWORD(lParam), - HIWORD(lParam), &handled ); + HIWORD(lParam), &handled ) + || draw; break; case WM_MOUSEMOVE: diff --git a/xwords4/wince/resource.h b/xwords4/wince/resource.h index 3981489fd..74602c933 100755 --- a/xwords4/wince/resource.h +++ b/xwords4/wince/resource.h @@ -169,10 +169,13 @@ #define ID_MOVE_JUGGLE 40016 #define ID_MOVE_HIDETRAY 40017 #define ID_MOVE_TURNDONE 40018 -#define ID_FILE_NEWGAME 40019 -#define ID_FILE_SAVEDGAMES 40020 -#define ID_EDITTEXT 40021 -#define ID_FILE_PREFERENCES 40022 +#ifndef _WIN32_WCE +# define ID_MOVE_FLIP 40019 +#endif +#define ID_FILE_NEWGAME 40020 +#define ID_FILE_SAVEDGAMES 40021 +#define ID_EDITTEXT 40022 +#define ID_FILE_PREFERENCES 40023 #define ID_GAME_RESENDMSGS 40025 #define ID_COLORS_RES 9999 diff --git a/xwords4/wince/xwords4.rc b/xwords4/wince/xwords4.rc index eff0cbf57..4b08c6af7 100755 --- a/xwords4/wince/xwords4.rc +++ b/xwords4/wince/xwords4.rc @@ -125,6 +125,9 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Turn &done", ID_MOVE_TURNDONE MENUITEM "&Juggle", ID_MOVE_JUGGLE +#ifndef _WIN32_WCE + MENUITEM "&Flip", ID_MOVE_FLIP +#endif MENUITEM "&Trade", ID_MOVE_TRADE MENUITEM "(un)&Hide tray", ID_MOVE_HIDETRAY END