Renamed CallTo16* functions to wine_call_to_16* and export them from
[wine/multimedia.git] / dlls / user / mouse.c
blobc7b2b241ff675338a6789187eafae0a0fb032698
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 context.SegCs = SELECTOROF( proc );
77 context.Eip = OFFSETOF( proc );
78 context.Eax = (WORD)dwFlags;
79 context.Ebx = (WORD)dx;
80 context.Ecx = (WORD)dy;
81 context.Edx = (WORD)cButtons;
82 context.Esi = LOWORD( dwExtraInfo );
83 context.Edi = HIWORD( dwExtraInfo );
85 wine_call_to_16_regs_short( &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 );