4 * Copyright 1998 Ulrich Weigand
10 #include "debugtools.h"
12 #include "builtin16.h"
17 #include "wine/winbase16.h"
19 DEFAULT_DEBUG_CHANNEL(event);
22 typedef struct _MOUSEINFO
33 } MOUSEINFO, *LPMOUSEINFO;
36 /**********************************************************************/
38 static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
40 /***********************************************************************
43 WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo)
45 mouseInfo->msExist = TRUE;
46 mouseInfo->msRelative = FALSE;
47 mouseInfo->msNumButtons = 2;
48 mouseInfo->msRate = 34; /* the DDK says so ... */
49 mouseInfo->msXThreshold = 0;
50 mouseInfo->msYThreshold = 0;
51 mouseInfo->msXRes = 0;
52 mouseInfo->msYRes = 0;
53 mouseInfo->msMouseCommPort = 0;
55 return sizeof(MOUSEINFO);
58 /***********************************************************************
61 VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
63 THUNK_Free( (FARPROC)DefMouseEventProc );
64 DefMouseEventProc = lpMouseEventProc;
65 USER_Driver.pInitMouse( lpMouseEventProc );
68 /**********************************************************************/
70 static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
71 DWORD dwFlags, DWORD dx, DWORD dy,
72 DWORD cButtons, DWORD dwExtraInfo )
76 memset( &context, 0, sizeof(context) );
77 context.SegCs = SELECTOROF( proc );
78 context.Eip = OFFSETOF( proc );
79 context.Eax = (WORD)dwFlags;
80 context.Ebx = (WORD)dx;
81 context.Ecx = (WORD)dy;
82 context.Edx = (WORD)cButtons;
83 context.Esi = LOWORD( dwExtraInfo );
84 context.Edi = HIWORD( dwExtraInfo );
86 wine_call_to_16_regs_short( &context, 0 );
89 /**********************************************************************/
91 VOID WINAPI WIN16_MOUSE_Enable( FARPROC16 proc )
93 LPMOUSE_EVENT_PROC thunk =
94 (LPMOUSE_EVENT_PROC)THUNK_Alloc( proc, (RELAY)MOUSE_CallMouseEventProc );
96 MOUSE_Enable( thunk );
99 /***********************************************************************
102 VOID WINAPI MOUSE_Disable(VOID)
104 THUNK_Free( (FARPROC)DefMouseEventProc );
105 DefMouseEventProc = 0;
106 USER_Driver.pInitMouse( 0 );