MCPcopy Create free account
hub / github.com/NetHack/NetHack / onMouseMove

Function onMouseMove

outdated/sys/wince/mhcmd.c:953–991  ·  view source on GitHub ↗

-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

951}
952/*-------------------------------------------------------------------------*/
953void
954onMouseMove(HWND hWnd, WPARAM wParam, LPARAM lParam)
955{
956 PNHCmdWindow data;
957 POINT mpt;
958 int newActiveCell;
959
960 /* get mouse coordinates */
961 mpt.x = LOWORD(lParam);
962 mpt.y = HIWORD(lParam);
963
964 /* map mouse coordinates to the display cell */
965 data = (PNHCmdWindow) GetWindowLong(hWnd, GWL_USERDATA);
966 newActiveCell = CellFromPoint(data, mpt);
967 if (data->active_cell == -1)
968 return;
969
970 /* if mouse is within orginal display cell - select the cell otherwise
971 clear the selection */
972 switch (nhcmdlayout_cell_direct(data->layout_current, data->active_cell)
973 ->type) {
974 case NH_CELL_REG:
975 HighlightCell(hWnd, data->active_cell,
976 (newActiveCell == data->active_cell));
977 break;
978
979 case NH_CELL_CTRL:
980 HighlightCell(hWnd, data->active_cell,
981 ((newActiveCell == data->active_cell) ? !data->is_ctrl
982 : data->is_ctrl));
983 break;
984
985 case NH_CELL_CAP:
986 HighlightCell(hWnd, data->active_cell,
987 ((newActiveCell == data->active_cell) ? !data->is_caps
988 : data->is_caps));
989 break;
990 }
991}
992/*-------------------------------------------------------------------------*/
993void
994onMouseUp(HWND hWnd, WPARAM wParam, LPARAM lParam)

Callers 1

NHCommandWndProcFunction · 0.85

Calls 2

CellFromPointFunction · 0.85
HighlightCellFunction · 0.85

Tested by

no test coverage detected