Merged mouse dll into USER.
[wine.git] / dlls / user / mouse.c
bloba74a8a34d684a36ffc15ba333cf1f0b2a8e33701
1 /*
2 * MOUSE driver
3 *
4 * Copyright 1998 Ulrich Weigand
5 *
6 */
8 #include <string.h>
10 #include "debugtools.h"
11 #include "callback.h"
12 #include "builtin16.h"
13 #include "module.h"
14 #include "mouse.h"
15 #include "windef.h"
16 #include "wingdi.h"
17 #include "winuser.h"
18 #include "wine/winbase16.h"
20 DEFAULT_DEBUG_CHANNEL(event);
22 #include "pshpack1.h"
23 typedef struct _MOUSEINFO
25 BYTE msExist;
26 BYTE msRelative;
27 WORD msNumButtons;
28 WORD msRate;
29 WORD msXThreshold;
30 WORD msYThreshold;
31 WORD msXRes;
32 WORD msYRes;
33 WORD msMouseCommPort;
34 } MOUSEINFO, *LPMOUSEINFO;
35 #include "poppack.h"
37 /**********************************************************************/
39 static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
41 /***********************************************************************
42 * MOUSE_Inquire (MOUSE.1)
44 WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo)
46 mouseInfo->msExist = TRUE;
47 mouseInfo->msRelative = FALSE;
48 mouseInfo->msNumButtons = 2;
49 mouseInfo->msRate = 34; /* the DDK says so ... */
50 mouseInfo->msXThreshold = 0;
51 mouseInfo->msYThreshold = 0;
52 mouseInfo->msXRes = 0;
53 mouseInfo->msYRes = 0;
54 mouseInfo->msMouseCommPort = 0;
56 return sizeof(MOUSEINFO);
59 /***********************************************************************
60 * MOUSE_Enable (MOUSE.2)
62 VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
64 THUNK_Free( (FARPROC)DefMouseEventProc );
65 DefMouseEventProc = lpMouseEventProc;
66 USER_Driver->pInitMouse( lpMouseEventProc );
69 static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
70 DWORD dwFlags, DWORD dx, DWORD dy,
71 DWORD cButtons, DWORD dwExtraInfo )
73 CONTEXT86 context;
75 memset( &context, 0, sizeof(context) );
76 CS_reg(&context) = SELECTOROF( proc );
77 EIP_reg(&context) = OFFSETOF( proc );
78 AX_reg(&context) = (WORD)dwFlags;
79 BX_reg(&context) = (WORD)dx;
80 CX_reg(&context) = (WORD)dy;
81 DX_reg(&context) = (WORD)cButtons;
82 SI_reg(&context) = LOWORD( dwExtraInfo );
83 DI_reg(&context) = HIWORD( dwExtraInfo );
85 CallTo16RegisterShort( &context, 0 );
88 VOID WINAPI WIN16_MOUSE_Enable( FARPROC16 proc )
90 LPMOUSE_EVENT_PROC thunk =
91 (LPMOUSE_EVENT_PROC)THUNK_Alloc( proc, (RELAY)MOUSE_CallMouseEventProc );
93 MOUSE_Enable( thunk );
96 /***********************************************************************
97 * MOUSE_Disable (MOUSE.3)
99 VOID WINAPI MOUSE_Disable(VOID)
101 THUNK_Free( (FARPROC)DefMouseEventProc );
102 DefMouseEventProc = 0;
103 USER_Driver->pInitMouse( 0 );