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 /***********************************************************************
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
)
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 );