4 * Copyright 1998 Ulrich Weigand
10 #include "debugtools.h"
12 #include "builtin16.h"
18 #include "wine/winbase16.h"
20 DEFAULT_DEBUG_CHANNEL(event
);
23 typedef struct _MOUSEINFO
34 } MOUSEINFO
, *LPMOUSEINFO
;
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
)
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 );