Handling Mouse Interrupts

A mouse minidriver installs an interrupt handler to process hardware interrupts from the mouse. To install an interrupt handler, a mouse minidriver must use services provided by the virtual programmable interrupt controller device (VPICD).

After installing the interrupt handler, the mouse minidriver must call the VMD_Set_Mouse_Data service to provide VMOUSE with information about the mouse, including the mouse-type identifier, the number of the interrupt request (IRQ) the mouse is using, the number of the port the mouse is using, and the number of buttons on the mouse. VMOUSE uses this information to respond to various Interrupt 33H functions.

The interrupt handler translates the raw data from the mouse into messages and posts them to VMOUSE by calling the VMD_Post_Pointer_Message service. Each message includes the horizontal and vertical delta values and a value indicating the status of the mouse buttons. The horizontal and vertical delta values indicate the amount, in mickeys, of horizontal and vertical mouse movement that occurred since posting the last message to VMOUSE. A mickey is the distance the mouse must move to generate a mouse-movement signal.

The button-status value is a byte-size array of bits that indicate the status of each mouse button; that is, whether each is pressed or released. A bit is 1 if the corresponding button is pressed; otherwise, it is 0. The button status value has the following form:

Bit Meaning
0, 1 Undefined
2 Status of button 4
3 Status of button 2
4 Status of button 3
5 Status of button 1
6, 7 Undefined

VMOUSE interprets the data in the mouse messages based on user-defined settings such as the rotation angle, acceleration, and sensitivity and then passes the data to the appropriate VM. If the system VM has the mouse focus, VMOUSE passes the data to the Mouse_Event function in the Windows USER module. If an application in a non-system VM has the mouse focus, VMOUSE passes the data to the application's mouse callback function. The application installs the callback function by calling Interrupt 33h, Function 0Ch.

See also Mouse_Event, VMD_Post_Pointer_Message, VMD_Set_Mouse_Data