CE patch (from <Someone>)
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user