2 * DOS interrupt 33h handler
15 #include "debugtools.h"
17 DEFAULT_DEBUG_CHANNEL(int);
22 WORD lbcount
, rbcount
, rlastx
, rlasty
, llastx
, llasty
;
27 /**********************************************************************
30 * Handler for int 33h (MS MOUSE).
32 void WINAPI
DOSVM_Int33Handler( CONTEXT86
*context
)
34 switch (LOWORD(context
->Eax
)) {
36 TRACE("Reset mouse driver and request status\n");
37 AX_reg(context
) = 0xFFFF; /* installed */
38 BX_reg(context
) = 3; /* # of buttons */
39 memset( &mouse_info
, 0, sizeof(mouse_info
) );
42 FIXME("Show mouse cursor\n");
45 FIXME("Hide mouse cursor\n");
48 TRACE("Return mouse position and button status\n");
49 BX_reg(context
) = mouse_info
.but
;
50 CX_reg(context
) = mouse_info
.x
;
51 DX_reg(context
) = mouse_info
.y
;
54 FIXME("Position mouse cursor\n");
57 TRACE("Return Mouse button press Information for %s mouse button\n",
58 BX_reg(context
) ? "right" : "left");
59 if (BX_reg(context
)) {
60 BX_reg(context
) = mouse_info
.rbcount
;
61 mouse_info
.rbcount
= 0;
62 CX_reg(context
) = mouse_info
.rlastx
;
63 DX_reg(context
) = mouse_info
.rlasty
;
65 BX_reg(context
) = mouse_info
.lbcount
;
66 mouse_info
.lbcount
= 0;
67 CX_reg(context
) = mouse_info
.llastx
;
68 DX_reg(context
) = mouse_info
.llasty
;
70 AX_reg(context
) = mouse_info
.but
;
73 FIXME("Define horizontal mouse cursor range\n");
76 FIXME("Define vertical mouse cursor range\n");
79 FIXME("Define graphics mouse cursor\n");
82 FIXME("Define text mouse cursor\n");
85 TRACE("Define mouse interrupt subroutine\n");
86 mouse_info
.callmask
= CX_reg(context
);
87 mouse_info
.callback
= (FARPROC16
)MAKESEGPTR(context
->SegEs
, LOWORD(context
->Edx
));
90 FIXME("Define screen region for update\n");
93 INT_BARF(context
,0x33);
99 WORD mask
,but
,x
,y
,mx
,my
;
102 static void MouseRelay(CONTEXT86
*context
,void *mdata
)
104 MCALLDATA
*data
= (MCALLDATA
*)mdata
;
105 CONTEXT86 ctx
= *context
;
107 ctx
.Eax
= data
->mask
;
113 ctx
.SegCs
= SELECTOROF(data
->proc
);
114 ctx
.Eip
= OFFSETOF(data
->proc
);
116 DPMI_CallRMProc(&ctx
, NULL
, 0, 0);
119 void WINAPI
DOSVM_Int33Message(UINT message
,WPARAM wParam
,LPARAM lParam
)
122 unsigned Height
, Width
, SX
=1, SY
=1;
124 if (!VGA_GetMode(&Height
,&Width
,NULL
)) {
125 /* may need to do some coordinate scaling */
130 mouse_info
.x
= LOWORD(lParam
) * SX
;
131 mouse_info
.y
= HIWORD(lParam
) * SY
;
137 case WM_LBUTTONDBLCLK
:
138 mouse_info
.but
|= 0x01;
140 mouse_info
.llastx
= mouse_info
.x
;
141 mouse_info
.llasty
= mouse_info
.y
;
142 mouse_info
.lbcount
++;
145 mouse_info
.but
&= ~0x01;
149 case WM_RBUTTONDBLCLK
:
150 mouse_info
.but
|= 0x02;
152 mouse_info
.rlastx
= mouse_info
.x
;
153 mouse_info
.rlasty
= mouse_info
.y
;
154 mouse_info
.rbcount
++;
157 mouse_info
.but
&= ~0x02;
161 case WM_MBUTTONDBLCLK
:
162 mouse_info
.but
|= 0x04;
166 mouse_info
.but
&= ~0x04;
171 if ((mask
& mouse_info
.callmask
) && mouse_info
.callback
) {
172 MCALLDATA
*data
= calloc(1,sizeof(MCALLDATA
));
173 data
->proc
= mouse_info
.callback
;
174 data
->mask
= mask
& mouse_info
.callmask
;
175 data
->but
= mouse_info
.but
;
176 data
->x
= mouse_info
.x
;
177 data
->y
= mouse_info
.y
;
178 DOSVM_QueueEvent(-1, DOS_PRIORITY_MOUSE
, MouseRelay
, data
);