VirtualBox Main API
Public Member Functions | Public Attributes | List of all members
IMouse Interface Reference

The IMouse interface represents the virtual machine's mouse. More...

Inheritance diagram for IMouse:

Public Member Functions

void putMouseEvent (in long dx, in long dy, in long dz, in long dw, in long buttonState)
 Initiates a mouse event using relative pointer movements along x and y axis.
 
void putMouseEventAbsolute (in long x, in long y, in long dz, in long dw, in long buttonState)
 Positions the mouse pointer using absolute x and y coordinates.
 
void putEventMultiTouch (in long count, in long long[] contacts, in boolean isTouchScreen, in unsigned long scanTime)
 Sends a multi-touch pointer event.
 
void putEventMultiTouchString (in long count, in wstring contacts, in boolean isTouchScreen, in unsigned long scanTime)
 

Public Attributes

readonly attribute boolean absoluteSupported
 Whether the guest OS supports absolute mouse pointer positioning or not.
 
readonly attribute boolean relativeSupported
 Whether the guest OS supports relative mouse pointer positioning or not.
 
readonly attribute boolean touchScreenSupported
 Whether the guest OS has enabled the multi-touch reporting device, touchscreen variant.
 
readonly attribute boolean touchPadSupported
 Whether the guest OS has enabled the multi-touch reporting device, touchpad variant.
 
readonly attribute boolean needsHostCursor
 Whether the guest OS can currently switch to drawing it's own mouse cursor on demand.
 
readonly attribute IMousePointerShape pointerShape
 The current mouse pointer used by the guest.
 
readonly attribute IEventSource eventSource
 Event source for mouse events.
 

Detailed Description

The IMouse interface represents the virtual machine's mouse.

Used in IConsole::mouse.

Through this interface, the virtual machine's virtual mouse can be controlled.

Interface ID:
{25360A74-55E5-4F14-AC2A-F5CF8E62E4AF}

Member Function Documentation

◆ putMouseEvent()

void IMouse::putMouseEvent ( in long  dx,
in long  dy,
in long  dz,
in long  dw,
in long  buttonState 
)

Initiates a mouse event using relative pointer movements along x and y axis.

Parameters
dxAmount of pixels the mouse should move to the right. Negative values move the mouse to the left.
dyAmount of pixels the mouse should move downwards. Negative values move the mouse upwards.
dzAmount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations.
dwAmount of horizontal mouse wheel moves. Positive values describe a movement to the left, negative values describe a movement to the right.
buttonStateThe current state of mouse buttons. Every bit represents a mouse button as follows:
Bit 0 (0x01)
left mouse button
Bit 1 (0x02)
right mouse button
Bit 2 (0x04)
middle mouse button
A value of 1 means the corresponding button is pressed. otherwise it is released.
Expected result codes:
E_ACCESSDENIEDConsole not powered up.
VBOX_E_IPRT_ERRORCould not send mouse event to virtual mouse.

◆ putMouseEventAbsolute()

void IMouse::putMouseEventAbsolute ( in long  x,
in long  y,
in long  dz,
in long  dw,
in long  buttonState 
)

Positions the mouse pointer using absolute x and y coordinates.

These coordinates are expressed in pixels and start from [1,1] which corresponds to the top left corner of the virtual display. The values [-1,-1] and [0x7fffffff,0x7fffffff] have special meanings as respectively "no data" (to signal that the host wishes to report absolute pointer data in future) and "out of range" (the host pointer is outside of all guest windows).

Parameters
xX coordinate of the pointer in pixels, starting from 1.
yY coordinate of the pointer in pixels, starting from 1.
dzAmount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations.
dwAmount of horizontal mouse wheel moves. Positive values describe a movement to the left, negative values describe a movement to the right.
buttonStateThe current state of mouse buttons. Every bit represents a mouse button as follows:
Bit 0 (0x01)
left mouse button
Bit 1 (0x02)
right mouse button
Bit 2 (0x04)
middle mouse button
A value of 1 means the corresponding button is pressed. otherwise it is released.
Expected result codes:
E_ACCESSDENIEDConsole not powered up.
VBOX_E_IPRT_ERRORCould not send mouse event to virtual mouse.
Note
This method will have effect only if absolute mouse positioning is supported by the guest OS.
See also
absoluteSupported

◆ putEventMultiTouch()

void IMouse::putEventMultiTouch ( in long  count,
in long long[]  contacts,
in boolean  isTouchScreen,
in unsigned long  scanTime 
)

Sends a multi-touch pointer event.

For touchscreen events the coordinates are expressed in pixels and start from [1,1] which corresponds to the top left corner of the virtual display, for touchpad events the coordinates are normalized to the range 0..0xffff.

Parameters
countNumber of contacts in the event.
contactsEach array element contains packed information about one contact. Bits 0..15: X coordinate in pixels or normalized X position. Bits 16..31: Y coordinate in pixels or normalized Y position. Bits 32..39: contact identifier. Bit 40: "in contact" flag, which indicates that there is a contact with the touch surface. Bit 41: "in range" flag, the contact is close enough to the touch surface. All other bits are reserved for future use and must be set to 0.
isTouchScreenDistinguishes between touchscreen and touchpad events.
scanTimeTimestamp of the event in milliseconds. Only relative time between events is important.
Expected result codes:
E_ACCESSDENIEDConsole not powered up.
VBOX_E_IPRT_ERRORCould not send event to virtual device.
Note
The guest may not understand or may choose to ignore this event.
See also
touchScreenSupported and touchPadSupported

◆ putEventMultiTouchString()

void IMouse::putEventMultiTouchString ( in long  count,
in wstring  contacts,
in boolean  isTouchScreen,
in unsigned long  scanTime 
)
Parameters
count
contactsContains information about all contacts: "id1,x1,y1,inContact1,inRange1;...;idN,xN,yN,inContactN,inRangeN". For example for two contacts: "0,10,20,1,1;1,30,40,1,1"
isTouchScreenDistinguishes between touchscreen and touchpad events.
scanTime
See also
putEventMultiTouch

Member Data Documentation

◆ absoluteSupported

readonly attribute boolean IMouse::absoluteSupported

Whether the guest OS supports absolute mouse pointer positioning or not.

Note
You can use the IMouseCapabilityChangedEvent event to be instantly informed about changes of this attribute during virtual machine execution.
See also
putMouseEventAbsolute

◆ relativeSupported

readonly attribute boolean IMouse::relativeSupported

Whether the guest OS supports relative mouse pointer positioning or not.

Note
You can use the IMouseCapabilityChangedEvent event to be instantly informed about changes of this attribute during virtual machine execution.
See also
putMouseEvent

◆ touchScreenSupported

readonly attribute boolean IMouse::touchScreenSupported

Whether the guest OS has enabled the multi-touch reporting device, touchscreen variant.

Note
You can use the IMouseCapabilityChangedEvent event to be instantly informed about changes of this attribute during virtual machine execution.
See also
putMouseEvent

◆ touchPadSupported

readonly attribute boolean IMouse::touchPadSupported

Whether the guest OS has enabled the multi-touch reporting device, touchpad variant.

Note
You can use the IMouseCapabilityChangedEvent event to be instantly informed about changes of this attribute during virtual machine execution.
See also
putMouseEvent

◆ needsHostCursor

readonly attribute boolean IMouse::needsHostCursor

Whether the guest OS can currently switch to drawing it's own mouse cursor on demand.

Note
You can use the IMouseCapabilityChangedEvent event to be instantly informed about changes of this attribute during virtual machine execution.
See also
putMouseEvent

◆ pointerShape

readonly attribute IMousePointerShape IMouse::pointerShape

The current mouse pointer used by the guest.

◆ eventSource

readonly attribute IEventSource IMouse::eventSource

Event source for mouse events.