Clean up mouse driver implementation.

This commit is contained in:
Jukka Heinonen 2003-10-27 22:06:27 +00:00 committed by Alexandre Julliard
parent 181a7cca2b
commit 6b47f11db6
1 changed files with 134 additions and 84 deletions

View File

@ -35,13 +35,37 @@ WINE_DEFAULT_DEBUG_CHANNEL(int);
static struct static struct
{ {
DWORD x, y, but; WORD x, y, but;
WORD lbcount, rbcount, rlastx, rlasty, llastx, llasty; WORD lbcount, rbcount, rlastx, rlasty, llastx, llasty;
FARPROC16 callback; FARPROC16 callback;
WORD callmask; WORD callmask;
WORD VMPratio, HMPratio, oldx, oldy; WORD VMPratio, HMPratio, oldx, oldy;
} mouse_info; } mouse_info;
/**********************************************************************
* INT33_ResetMouse
*
* Handler for:
* - subfunction 0x00 (reset mouse)
* - subfunction 0x21 (software reset)
*/
static void INT33_ResetMouse( CONTEXT86 *context )
{
memset( &mouse_info, 0, sizeof(mouse_info) );
/* Set the default mickey/pixel ratio */
mouse_info.HMPratio = 8;
mouse_info.VMPratio = 16;
if (context)
{
SET_AX( context, 0xFFFF ); /* driver installed */
SET_BX( context, 3 ); /* number of buttons */
}
}
/********************************************************************** /**********************************************************************
* DOSVM_Int33Handler (WINEDOS16.151) * DOSVM_Int33Handler (WINEDOS16.151)
* *
@ -49,86 +73,112 @@ static struct
*/ */
void WINAPI DOSVM_Int33Handler( CONTEXT86 *context ) void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
{ {
switch (LOWORD(context->Eax)) { switch (AX_reg(context))
case 0x00: {
case 0x21: case 0x0000:
TRACE("Reset mouse driver and request status\n"); TRACE("Reset mouse driver and request status\n");
SET_AX( context, 0xFFFF ); /* installed */ INT33_ResetMouse( context );
SET_BX( context, 3 ); /* # of buttons */ break;
memset( &mouse_info, 0, sizeof(mouse_info) );
/* Set the default mickey/pixel ratio */ case 0x0001:
mouse_info.HMPratio = 8; FIXME("Show mouse cursor\n");
mouse_info.VMPratio = 16; break;
break;
case 0x01: case 0x0002:
FIXME("Show mouse cursor\n"); FIXME("Hide mouse cursor\n");
break; break;
case 0x02:
FIXME("Hide mouse cursor\n"); case 0x0003:
break; TRACE("Return mouse position and button status: (%d,%d) and %d\n",
case 0x03: mouse_info.x, mouse_info.y, mouse_info.but);
TRACE("Return mouse position and button status: (%ld,%ld) and %ld\n", SET_BX( context, mouse_info.but );
mouse_info.x, mouse_info.y, mouse_info.but); SET_CX( context, mouse_info.x );
SET_BX( context, mouse_info.but ); SET_DX( context, mouse_info.y );
SET_CX( context, mouse_info.x ); break;
SET_DX( context, mouse_info.y );
break; case 0x0004:
case 0x04: FIXME("Position mouse cursor\n");
FIXME("Position mouse cursor\n"); break;
break;
case 0x05: case 0x0005:
TRACE("Return Mouse button press Information for %s mouse button\n", TRACE("Return Mouse button press Information for %s mouse button\n",
BX_reg(context) ? "right" : "left"); BX_reg(context) ? "right" : "left");
if (BX_reg(context)) { if (BX_reg(context))
SET_BX( context, mouse_info.rbcount ); {
mouse_info.rbcount = 0; SET_BX( context, mouse_info.rbcount );
SET_CX( context, mouse_info.rlastx ); mouse_info.rbcount = 0;
SET_DX( context, mouse_info.rlasty ); SET_CX( context, mouse_info.rlastx );
} else { SET_DX( context, mouse_info.rlasty );
SET_BX( context, mouse_info.lbcount ); }
mouse_info.lbcount = 0; else
SET_CX( context, mouse_info.llastx ); {
SET_DX( context, mouse_info.llasty ); 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 { typedef struct {