Warning fixes.
[wine.git] / dlls / user / mouse.c
blobb65a25da728447685e028a0925869dd1da41c0f6
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 "mouse.h"
14 #include "windef.h"
15 #include "wingdi.h"
16 #include "winuser.h"
17 #include "wine/winbase16.h"
19 DEFAULT_DEBUG_CHANNEL(event);
21 #include "pshpack1.h"
22 typedef struct _MOUSEINFO
24 BYTE msExist;
25 BYTE msRelative;
26 WORD msNumButtons;
27 WORD msRate;
28 WORD msXThreshold;
29 WORD msYThreshold;
30 WORD msXRes;
31 WORD msYRes;
32 WORD msMouseCommPort;
33 } MOUSEINFO, *LPMOUSEINFO;
34 #include "poppack.h"
36 /**********************************************************************/
38 static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
40 /***********************************************************************
41 * MOUSE_Inquire (MOUSE.1)
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 /***********************************************************************
59 * MOUSE_Enable (MOUSE.2)
61 VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
63 THUNK_Free( (FARPROC)DefMouseEventProc );
64 DefMouseEventProc = lpMouseEventProc;
65 USER_Driver.pInitMouse( lpMouseEventProc );
68 static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
69 DWORD dwFlags, DWORD dx, DWORD dy,
70 DWORD cButtons, DWORD dwExtraInfo )
72 CONTEXT86 context;
74 memset( &context, 0, sizeof(context) );
75 context.SegCs = SELECTOROF( proc );
76 context.Eip = OFFSETOF( proc );
77 context.Eax = (WORD)dwFlags;
78 context.Ebx = (WORD)dx;
79 context.Ecx = (WORD)dy;
80 context.Edx = (WORD)cButtons;
81 context.Esi = LOWORD( dwExtraInfo );
82 context.Edi = HIWORD( dwExtraInfo );
84 wine_call_to_16_regs_short( &context, 0 );
87 VOID WINAPI WIN16_MOUSE_Enable( FARPROC16 proc )
89 LPMOUSE_EVENT_PROC thunk =
90 (LPMOUSE_EVENT_PROC)THUNK_Alloc( proc, (RELAY)MOUSE_CallMouseEventProc );
92 MOUSE_Enable( thunk );
95 /***********************************************************************
96 * MOUSE_Disable (MOUSE.3)
98 VOID WINAPI MOUSE_Disable(VOID)
100 THUNK_Free( (FARPROC)DefMouseEventProc );
101 DefMouseEventProc = 0;
102 USER_Driver.pInitMouse( 0 );