This patch does not change how mouse driver works but it does some minor cleanups that are probably better to do in a separate patch instead of mixing these things with patches that do change mouse driver logic. After this patch, the following things will be fixed in separate patches: - hide/show mouse - pointer warping - fix for virtual screen size and cursor ranges Changelog: Clean up mouse driver implementation. Index: dlls/winedos/int33.c =================================================================== RCS file: /home/wine/wine/dlls/winedos/int33.c,v retrieving revision 1.14 diff -u -r1.14 int33.c --- dlls/winedos/int33.c 5 Sep 2003 23:08:28 -0000 1.14 +++ dlls/winedos/int33.c 26 Oct 2003 10:22:46 -0000 @@ -35,100 +35,150 @@ static struct { - DWORD x, y, but; - WORD lbcount, rbcount, rlastx, rlasty, llastx, llasty; - FARPROC16 callback; - WORD callmask; - WORD VMPratio, HMPratio, oldx, oldy; + WORD x, y, but; + WORD lbcount, rbcount, rlastx, rlasty, llastx, llasty; + FARPROC16 callback; + WORD callmask; + WORD VMPratio, HMPratio, oldx, oldy; } mouse_info; + /********************************************************************** - * DOSVM_Int33Handler (WINEDOS16.151) + * INT33_ResetMouse * - * Handler for int 33h (MS MOUSE). + * Handler for: + * - subfunction 0x00 (reset mouse) + * - subfunction 0x21 (software reset) */ -void WINAPI DOSVM_Int33Handler( CONTEXT86 *context ) +static void INT33_ResetMouse( CONTEXT86 *context ) { - switch (LOWORD(context->Eax)) { - case 0x00: - case 0x21: - TRACE("Reset mouse driver and request status\n"); - SET_AX( context, 0xFFFF ); /* installed */ - SET_BX( context, 3 ); /* # of buttons */ memset( &mouse_info, 0, sizeof(mouse_info) ); + /* Set the default mickey/pixel ratio */ mouse_info.HMPratio = 8; mouse_info.VMPratio = 16; - break; - case 0x01: - FIXME("Show mouse cursor\n"); - break; - case 0x02: - FIXME("Hide mouse cursor\n"); - break; - case 0x03: - TRACE("Return mouse position and button status: (%ld,%ld) and %ld\n", - mouse_info.x, mouse_info.y, mouse_info.but); - SET_BX( context, mouse_info.but ); - SET_CX( context, mouse_info.x ); - SET_DX( context, mouse_info.y ); - break; - case 0x04: - FIXME("Position mouse cursor\n"); - break; - case 0x05: - TRACE("Return Mouse button press Information for %s mouse button\n", - BX_reg(context) ? "right" : "left"); - if (BX_reg(context)) { - SET_BX( context, mouse_info.rbcount ); - mouse_info.rbcount = 0; - SET_CX( context, mouse_info.rlastx ); - SET_DX( context, mouse_info.rlasty ); - } else { - SET_BX( context, mouse_info.lbcount ); - mouse_info.lbcount = 0; - SET_CX( context, mouse_info.llastx ); - SET_DX( context, mouse_info.llasty ); + + if (context) + { + SET_AX( context, 0xFFFF ); /* driver installed */ + SET_BX( context, 3 ); /* number of buttons */ + } +} + + +/********************************************************************** + * DOSVM_Int33Handler (WINEDOS16.151) + * + * Handler for int 33h (MS MOUSE). + */ +void WINAPI DOSVM_Int33Handler( CONTEXT86 *context ) +{ + switch (AX_reg(context)) + { + case 0x0000: + TRACE("Reset mouse driver and request status\n"); + INT33_ResetMouse( context ); + break; + + case 0x0001: + FIXME("Show mouse cursor\n"); + break; + + case 0x0002: + FIXME("Hide mouse cursor\n"); + break; + + case 0x0003: + TRACE("Return mouse position and button status: (%d,%d) and %d\n", + mouse_info.x, mouse_info.y, mouse_info.but); + SET_BX( context, mouse_info.but ); + SET_CX( context, mouse_info.x ); + SET_DX( context, mouse_info.y ); + break; + + case 0x0004: + FIXME("Position mouse cursor\n"); + break; + + case 0x0005: + TRACE("Return Mouse button press Information for %s mouse button\n", + BX_reg(context) ? "right" : "left"); + if (BX_reg(context)) + { + SET_BX( context, mouse_info.rbcount ); + mouse_info.rbcount = 0; + SET_CX( context, mouse_info.rlastx ); + SET_DX( context, mouse_info.rlasty ); + } + else + { + SET_BX( context, mouse_info.lbcount ); + mouse_info.lbcount = 0; + SET_CX( context, mouse_info.llastx ); + SET_DX( context, mouse_info.llasty ); + } + SET_AX( context, mouse_info.but ); + break; + + case 0x0007: + FIXME("Define horizontal mouse cursor range %d..%d\n", + CX_reg(context), DX_reg(context)); + break; + + case 0x0008: + FIXME("Define vertical mouse cursor range %d..%d\n", + CX_reg(context), DX_reg(context)); + break; + + case 0x0009: + FIXME("Define graphics mouse cursor\n"); + break; + + case 0x000A: + FIXME("Define text mouse cursor\n"); + break; + + case 0x000B: + TRACE("Read Mouse motion counters\n"); + { + int dx = ((int)mouse_info.x - (int)mouse_info.oldx) + * (mouse_info.HMPratio / 8); + int dy = ((int)mouse_info.y - (int)mouse_info.oldy) + * (mouse_info.VMPratio / 8); + + SET_CX( context, (WORD)dx ); + SET_DX( context, (WORD)dy ); + + mouse_info.oldx = mouse_info.x; + mouse_info.oldy = mouse_info.y; + } + break; + + case 0x000C: + TRACE("Define mouse interrupt subroutine\n"); + mouse_info.callmask = CX_reg(context); + mouse_info.callback = (FARPROC16)MAKESEGPTR(context->SegEs, + DX_reg(context)); + break; + + case 0x000F: + TRACE("Set mickey/pixel ratio\n"); + mouse_info.HMPratio = CX_reg(context); + mouse_info.VMPratio = DX_reg(context); + break; + + case 0x0010: + FIXME("Define screen region for update\n"); + break; + + case 0x0021: + TRACE("Software reset\n"); + INT33_ResetMouse( context ); + break; + + default: + INT_BARF(context,0x33); } - SET_AX( context, mouse_info.but ); - break; - case 0x07: - FIXME("Define horizontal mouse cursor range %d..%d\n", - CX_reg(context), DX_reg(context)); - break; - case 0x08: - FIXME("Define vertical mouse cursor range %d..%d\n", - CX_reg(context), DX_reg(context)); - break; - case 0x09: - FIXME("Define graphics mouse cursor\n"); - break; - case 0x0A: - FIXME("Define text mouse cursor\n"); - break; - case 0x0B: - TRACE("Read Mouse motion counters\n"); - SET_CX( context, (mouse_info.x - mouse_info.oldx) * (mouse_info.HMPratio / 8) ); - SET_DX( context, (mouse_info.y - mouse_info.oldy) * (mouse_info.VMPratio / 8) ); - mouse_info.oldx = mouse_info.x; - mouse_info.oldy = mouse_info.y; - break; - case 0x0C: - TRACE("Define mouse interrupt subroutine\n"); - mouse_info.callmask = CX_reg(context); - mouse_info.callback = (FARPROC16)MAKESEGPTR(context->SegEs, LOWORD(context->Edx)); - break; - case 0x0F: - TRACE("Set mickey/pixel ratio\n"); - mouse_info.HMPratio = CX_reg(context); - mouse_info.VMPratio = DX_reg(context); - break; - case 0x10: - FIXME("Define screen region for update\n"); - break; - default: - INT_BARF(context,0x33); - } } typedef struct { -- Jukka Heinonen <http://www.iki.fi/jhei/>