From f92ac0c25c3f8bbbc9d534b0b0bbd5125f24b3d4 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Mon, 24 May 2004 14:21:15 +0000 Subject: [PATCH] CE patch (from ) Disable processing of double-click messages if the first click causes map to scroll. The problem is that if the first click scrolls the map the second click is going to scroll it even further (before it is redrawn) which is very confusing for the user. --- doc/fixes34.4 | 2 ++ sys/wince/mhmap.c | 33 ++++++++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index cc240d41a..89c9d13a6 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -32,6 +32,8 @@ Platform- and/or Interface-Specific Fixes ----------------------------------------- unix: remove use of parentheses in nethack man page usage that confused a man page conversion tool +winCE: disable processing of double-click messages if the first click + causes map to scroll General New Features diff --git a/sys/wince/mhmap.c b/sys/wince/mhmap.c index aad79415c..e089ed0e0 100644 --- a/sys/wince/mhmap.c +++ b/sys/wince/mhmap.c @@ -26,8 +26,8 @@ typedef struct mswin_nethack_map_window { int xCur, yCur; /* position of the cursor */ int xScrTile, yScrTile; /* size of display tile */ POINT map_orig; /* map origin point */ - HFONT hMapFont; /* font for ASCII mode */ + int xLastMouseClick, yLastMouseClick; /* last mouse click */ } NHMapWindow, *PNHMapWindow; static TCHAR szNHMapWindowClass[] = TEXT("MSNethackMapWndClass"); @@ -324,6 +324,7 @@ void register_map_window_class() LRESULT CALLBACK MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PNHMapWindow data; + int x, y; data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA); switch (message) @@ -369,20 +370,24 @@ LRESULT CALLBACK MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara } break; - case WM_LBUTTONDOWN: - NHEVENT_MS( - CLICK_1, - max(0, min(COLNO, data->xPos + (LOWORD(lParam)-data->map_orig.x)/data->xScrTile)), - max(0, min(ROWNO, data->yPos + (HIWORD(lParam)-data->map_orig.y)/data->yScrTile)) - ); + case WM_LBUTTONDOWN: + x = max(0, min(COLNO, data->xPos + (LOWORD(lParam)-data->map_orig.x)/data->xScrTile)); + y = max(0, min(ROWNO, data->yPos + (HIWORD(lParam)-data->map_orig.y)/data->yScrTile)); + + NHEVENT_MS( CLICK_1, x, y); + + data->xLastMouseClick = x; + data->yLastMouseClick = y; return 0; - case WM_LBUTTONDBLCLK : - NHEVENT_MS( - CLICK_2, - max(0, min(COLNO, data->xPos + (LOWORD(lParam)-data->map_orig.x)/data->xScrTile)), - max(0, min(ROWNO, data->yPos + (HIWORD(lParam)-data->map_orig.y)/data->yScrTile)) - ); + case WM_LBUTTONDBLCLK: + x = max(0, min(COLNO, data->xPos + (LOWORD(lParam)-data->map_orig.x)/data->xScrTile)); + y = max(0, min(ROWNO, data->yPos + (HIWORD(lParam)-data->map_orig.y)/data->yScrTile)); + + /* if map has scrolled since the last mouse click - ignore double-click message */ + if( data->xLastMouseClick == x && data->yLastMouseClick == y ) { + NHEVENT_MS( CLICK_1, x, y); + } return 0; case WM_DESTROY: @@ -522,6 +527,8 @@ void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam) data->xScrTile = GetNHApp()->mapTile_X; data->yScrTile = GetNHApp()->mapTile_Y; + data->xLastMouseClick = data->yLastMouseClick = -1; + SetWindowLong(hWnd, GWL_USERDATA, (LONG)data); } -- 2.40.0