1998-11-08 12:21:35 +00:00
|
|
|
/*
|
|
|
|
* MOUSE driver
|
|
|
|
*
|
|
|
|
* Copyright 1998 Ulrich Weigand
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1999-09-20 18:49:02 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
1999-07-04 16:02:24 +00:00
|
|
|
#include "debugtools.h"
|
1999-09-20 18:49:02 +00:00
|
|
|
#include "callback.h"
|
|
|
|
#include "builtin16.h"
|
1999-04-01 08:16:08 +00:00
|
|
|
#include "mouse.h"
|
2000-02-10 19:03:02 +00:00
|
|
|
#include "windef.h"
|
|
|
|
#include "wingdi.h"
|
1999-04-01 08:16:08 +00:00
|
|
|
#include "winuser.h"
|
1999-12-06 01:20:00 +00:00
|
|
|
#include "wine/winbase16.h"
|
1999-02-04 14:05:38 +00:00
|
|
|
|
2000-03-20 18:21:19 +00:00
|
|
|
DEFAULT_DEBUG_CHANNEL(event);
|
1999-04-19 14:56:29 +00:00
|
|
|
|
2000-06-08 04:57:22 +00:00
|
|
|
#include "pshpack1.h"
|
|
|
|
typedef struct _MOUSEINFO
|
|
|
|
{
|
|
|
|
BYTE msExist;
|
|
|
|
BYTE msRelative;
|
|
|
|
WORD msNumButtons;
|
|
|
|
WORD msRate;
|
|
|
|
WORD msXThreshold;
|
|
|
|
WORD msYThreshold;
|
|
|
|
WORD msXRes;
|
|
|
|
WORD msYRes;
|
|
|
|
WORD msMouseCommPort;
|
|
|
|
} MOUSEINFO, *LPMOUSEINFO;
|
|
|
|
#include "poppack.h"
|
|
|
|
|
1999-02-04 14:05:38 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
|
1998-11-08 12:21:35 +00:00
|
|
|
static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MOUSE_Inquire (MOUSE.1)
|
|
|
|
*/
|
|
|
|
WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo)
|
|
|
|
{
|
|
|
|
mouseInfo->msExist = TRUE;
|
|
|
|
mouseInfo->msRelative = FALSE;
|
|
|
|
mouseInfo->msNumButtons = 2;
|
|
|
|
mouseInfo->msRate = 34; /* the DDK says so ... */
|
|
|
|
mouseInfo->msXThreshold = 0;
|
|
|
|
mouseInfo->msYThreshold = 0;
|
|
|
|
mouseInfo->msXRes = 0;
|
|
|
|
mouseInfo->msYRes = 0;
|
|
|
|
mouseInfo->msMouseCommPort = 0;
|
|
|
|
|
|
|
|
return sizeof(MOUSEINFO);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MOUSE_Enable (MOUSE.2)
|
|
|
|
*/
|
|
|
|
VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
|
|
|
|
{
|
1999-09-20 18:49:02 +00:00
|
|
|
THUNK_Free( (FARPROC)DefMouseEventProc );
|
1998-11-08 12:21:35 +00:00
|
|
|
DefMouseEventProc = lpMouseEventProc;
|
2000-08-10 01:16:19 +00:00
|
|
|
USER_Driver.pInitMouse( lpMouseEventProc );
|
1998-11-08 12:21:35 +00:00
|
|
|
}
|
|
|
|
|
1999-09-20 18:49:02 +00:00
|
|
|
static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
|
|
|
|
DWORD dwFlags, DWORD dx, DWORD dy,
|
|
|
|
DWORD cButtons, DWORD dwExtraInfo )
|
|
|
|
{
|
|
|
|
CONTEXT86 context;
|
|
|
|
|
|
|
|
memset( &context, 0, sizeof(context) );
|
2000-09-25 23:53:07 +00:00
|
|
|
context.SegCs = SELECTOROF( proc );
|
|
|
|
context.Eip = OFFSETOF( proc );
|
|
|
|
context.Eax = (WORD)dwFlags;
|
|
|
|
context.Ebx = (WORD)dx;
|
|
|
|
context.Ecx = (WORD)dy;
|
|
|
|
context.Edx = (WORD)cButtons;
|
|
|
|
context.Esi = LOWORD( dwExtraInfo );
|
|
|
|
context.Edi = HIWORD( dwExtraInfo );
|
1999-09-20 18:49:02 +00:00
|
|
|
|
2000-11-29 19:39:30 +00:00
|
|
|
wine_call_to_16_regs_short( &context, 0 );
|
1999-09-20 18:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID WINAPI WIN16_MOUSE_Enable( FARPROC16 proc )
|
|
|
|
{
|
|
|
|
LPMOUSE_EVENT_PROC thunk =
|
|
|
|
(LPMOUSE_EVENT_PROC)THUNK_Alloc( proc, (RELAY)MOUSE_CallMouseEventProc );
|
|
|
|
|
|
|
|
MOUSE_Enable( thunk );
|
|
|
|
}
|
|
|
|
|
1998-11-08 12:21:35 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* MOUSE_Disable (MOUSE.3)
|
|
|
|
*/
|
|
|
|
VOID WINAPI MOUSE_Disable(VOID)
|
|
|
|
{
|
1999-09-20 18:49:02 +00:00
|
|
|
THUNK_Free( (FARPROC)DefMouseEventProc );
|
1998-11-08 12:21:35 +00:00
|
|
|
DefMouseEventProc = 0;
|
2000-08-10 01:16:19 +00:00
|
|
|
USER_Driver.pInitMouse( 0 );
|
1998-11-08 12:21:35 +00:00
|
|
|
}
|