--- np2/win9x/mousemng.cpp 2003/11/09 21:57:04 1.4 +++ np2/win9x/mousemng.cpp 2007/11/11 07:11:26 1.7 @@ -3,17 +3,20 @@ #include "mousemng.h" +#define MOUSEMNG_RANGE 128 + + typedef struct { SINT16 x; SINT16 y; - BYTE btn; + UINT8 btn; UINT flag; } MOUSEMNG; static MOUSEMNG mousemng; -BYTE mousemng_getstat(SINT16 *x, SINT16 *y, int clear) { +UINT8 mousemng_getstat(SINT16 *x, SINT16 *y, int clear) { *x = mousemng.x; *y = mousemng.y; @@ -31,7 +34,7 @@ static void getmaincenter(POINT *cp) { RECT rct; - GetWindowRect(hWndMain, &rct); + GetWindowRect(g_hWndMain, &rct); cp->x = (rct.right + rct.left) / 2; cp->y = (rct.bottom + rct.top) / 2; } @@ -42,14 +45,14 @@ static void mousecapture(BOOL capture) { POINT cp; RECT rct; - style = GetClassLong(hWndMain, GCL_STYLE); + style = GetClassLong(g_hWndMain, GCL_STYLE); if (capture) { ShowCursor(FALSE); getmaincenter(&cp); - rct.left = cp.x - 200; - rct.right = cp.x + 200; - rct.top = cp.y - 200; - rct.bottom = cp.y + 200; + rct.left = cp.x - MOUSEMNG_RANGE; + rct.right = cp.x + MOUSEMNG_RANGE; + rct.top = cp.y - MOUSEMNG_RANGE; + rct.bottom = cp.y + MOUSEMNG_RANGE; SetCursorPos(cp.x, cp.y); ClipCursor(&rct); style &= ~(CS_DBLCLKS); @@ -59,22 +62,17 @@ static void mousecapture(BOOL capture) { ClipCursor(NULL); style |= CS_DBLCLKS; } - SetClassLong(hWndMain, GCL_STYLE, style); + SetClassLong(g_hWndMain, GCL_STYLE, style); } void mousemng_initialize(void) { ZeroMemory(&mousemng, sizeof(mousemng)); mousemng.btn = uPD8255A_LEFTBIT | uPD8255A_RIGHTBIT; -#if 1 mousemng.flag = (1 << MOUSEPROC_SYSTEM); -#else - mousemng.flag = (1 << MOUSEPROC_SYSTEM) + (1 << MOUSEPROC_WINUI) + - (1 << MOUSEPROC_BG); -#endif } -void mousemng_callback(void) { +void mousemng_sync(void) { POINT p; POINT cp;