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).
This commit is contained in:
ehouse 2006-07-07 08:39:31 +00:00
parent 27057de11e
commit de0c62fb39
3 changed files with 33 additions and 9 deletions

View file

@ -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:

View file

@ -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

View file

@ -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