Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
mouse.h File Reference

Go to the source code of this file.

Data Structures

struct  _MOUSE_DATA
struct  _MOUSE_BUFFER
struct  _MOUSE_PROPERTIES
struct  _MOUSE_DEVICE
struct  _USB_HID_DESCRIPTOR

Macros

#define MOUSE_NAME_PREFIX   "Mouse"
 Name prefix for Mouse Devices.
#define MOUSE_TYPE_NONE   0
#define MOUSE_TYPE_USB   1
#define MOUSE_TYPE_PS2   2
#define MOUSE_TYPE_SERIAL   3
#define MOUSE_TYPE_MAX   3
#define MOUSE_STATE_DETACHED   0
#define MOUSE_STATE_DETACHING   1
#define MOUSE_STATE_ATTACHING   2
#define MOUSE_STATE_ATTACHED   3
#define MOUSE_STATE_MAX   3
#define MOUSE_FLAG_NONE   0x00000000
#define MOUSE_FLAG_NON_BLOCK   0x00000001
 If set device reads are non blocking (Also supported in Flags parameter of MouseReadEx).
#define MOUSE_FLAG_DIRECT_READ   0x00000002
 If set device writes mouse data to its local buffer which must be read using MouseDeviceRead.
#define MOUSE_FLAG_SWAP_BUTTONS   0x00000004
 If set left and right mouse buttons will be swapped in mouse data.
#define MOUSE_FLAG_PEEK_BUFFER   0x00000008
 Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of MouseReadEx).
#define MOUSE_FLAG_SWAP_XY   0x00000010
 If set swap the X and Y coordinates.
#define MOUSE_FLAG_INVERT_X   0x00000020
 If set invert the X coordinate.
#define MOUSE_FLAG_INVERT_Y   0x00000040
 If set invert the Y coordinate.
#define MOUSE_FLAG_SWAP_MAX_XY   0x00000080
 If set swap the maximum X and Y values.
#define MOUSE_FLAG_MASK   MOUSE_FLAG_NON_BLOCK | MOUSE_FLAG_DIRECT_READ | MOUSE_FLAG_SWAP_BUTTONS | MOUSE_FLAG_SWAP_XY | MOUSE_FLAG_INVERT_X | MOUSE_FLAG_INVERT_Y | MOUSE_FLAG_SWAP_MAX_XY
#define MOUSE_CONTROL_GET_FLAG   1
 Get Flag.
#define MOUSE_CONTROL_SET_FLAG   2
 Set Flag.
#define MOUSE_CONTROL_CLEAR_FLAG   3
 Clear Flag.
#define MOUSE_CONTROL_FLUSH_BUFFER   4
 Flush Buffer.
#define MOUSE_CONTROL_GET_SAMPLE_RATE   5
 Get Sample Rate.
#define MOUSE_CONTROL_SET_SAMPLE_RATE   6
 Set Sample Rate.
#define MOUSE_CONTROL_GET_MAX_X   7
 Get Maximum X value (Only applies to Absolute X values).
#define MOUSE_CONTROL_GET_MAX_Y   8
 Get Maximum Y value (Only applies to Absolute Y values).
#define MOUSE_CONTROL_GET_MAX_WHEEL   9
 Get Maximum Wheel value (Only applies to Absolute Wheel values).
#define MOUSE_CONTROL_GET_MAX_BUTTONS   10
 Get Maximum Buttons mask (eg MOUSE_LEFT_BUTTON or MOUSE_RIGHT_BUTTON etc).
#define MOUSE_CONTROL_GET_ROTATION   11
 Get Rotation value (0, 90, 180, 270)(Only where supported by the driver).
#define MOUSE_CONTROL_SET_ROTATION   12
 Set Rotation value (0, 90, 180, 270)(Only where supported by the driver).
#define MOUSE_BUFFER_SIZE   512
#define MOUSE_SAMPLE_RATE   100
 100 samples/sec
#define MOUSE_LEFT_BUTTON   0x0001
 The Left mouse button is pressed.
#define MOUSE_RIGHT_BUTTON   0x0002
 The Right mouse button is pressed.
#define MOUSE_MIDDLE_BUTTON   0x0004
 The Middle mouse button is pressed.
#define MOUSE_SIDE_BUTTON   0x0008
 The Side mouse button is pressed.
#define MOUSE_EXTRA_BUTTON   0x0010
 The Extra mouse button is pressed.
#define MOUSE_TOUCH_BUTTON   0x0020
 The Touch screen is being touched.
#define MOUSE_ABSOLUTE_X   0x0040
 The OffsetX value is absolute not relative.
#define MOUSE_ABSOLUTE_Y   0x0080
 The OffsetY value is absolute not relative.
#define MOUSE_ABSOLUTE_WHEEL   0x0100
 The OffsetWheel value is absolute not relative.
#define MOUSE_ROTATION_0   FRAMEBUFFER_ROTATION_0
 No rotation.
#define MOUSE_ROTATION_90   FRAMEBUFFER_ROTATION_90
 90 degree rotation
#define MOUSE_ROTATION_180   FRAMEBUFFER_ROTATION_180
 180 degree rotation
#define MOUSE_ROTATION_270   FRAMEBUFFER_ROTATION_270
 270 degree rotation
#define USB_HID_SUBCLASS_NONE   0
 Section 4.2.
#define USB_HID_SUBCLASS_BOOT   1
 Section 4.2.
#define USB_HID_BOOT_PROTOCOL_NONE   0
 Section 4.3.
#define USB_HID_BOOT_PROTOCOL_KEYBOARD   1
 Section 4.3.
#define USB_HID_BOOT_PROTOCOL_MOUSE   2
 Section 4.3.
#define USB_HID_DESCRIPTOR_TYPE_HID   0x21
 Section 7.1.
#define USB_HID_DESCRIPTOR_TYPE_REPORT   0x22
 Section 7.1.
#define USB_HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR   0x23
 Section 7.1.
#define USB_HID_REQUEST_GET_REPORT   0x01
#define USB_HID_REQUEST_GET_IDLE   0x02
#define USB_HID_REQUEST_GET_PROTOCOL   0x03
 Section 7.2.
#define USB_HID_REQUEST_SET_REPORT   0x09
#define USB_HID_REQUEST_SET_IDLE   0x0A
#define USB_HID_REQUEST_SET_PROTOCOL   0x0B
 Section 7.2.
#define USB_HID_PROTOCOL_BOOT   0
 Section 7.2.5.
#define USB_HID_PROTOCOL_REPORT   1
 Section 7.2.5.
#define USB_HID_REPORT_INPUT   1
 Section 7.2.1.
#define USB_HID_REPORT_OUTPUT   2
 Section 7.2.1.
#define USB_HID_REPORT_FEATURE   3
 Section 7.2.1.
#define USB_HID_REPORTID_NONE   0
 Section 7.2.1.
#define USB_HID_BOOT_LEFT_BUTTON   (1 << 0)
#define USB_HID_BOOT_RIGHT_BUTTON   (1 << 1)
#define USB_HID_BOOT_MIDDLE_BUTTON   (1 << 2)
#define USB_HID_BOOT_SIDE_BUTTON   (1 << 3)
#define USB_HID_BOOT_EXTRA_BUTTON   (1 << 4)
#define USB_HID_BOOT_REPORT_SIZE   8
 3 // Appendix B of HID Device Class Definition 1.11
#define USB_HID_BOOT_DATA_SIZE   8
 Allocate more than the minimum to allow for extra data.

Typedefs

typedef struct _MOUSE_DATA MOUSE_DATA
typedef struct _MOUSE_BUFFER MOUSE_BUFFER
typedef struct _MOUSE_PROPERTIES MOUSE_PROPERTIES
typedef struct _MOUSE_DEVICE MOUSE_DEVICE
typedef uint32_t STDCALL(* mouse_enumerate_cb) (MOUSE_DEVICE *mouse, void *data)
typedef uint32_t STDCALL(* mouse_notification_cb) (DEVICE *device, void *data, uint32_t notification)
typedef uint32_t STDCALL(* mouse_device_read_proc) (MOUSE_DEVICE *mouse, void *buffer, uint32_t size, uint32_t *count)
typedef uint32_t STDCALL(* mouse_device_update_proc) (MOUSE_DEVICE *mouse)
typedef uint32_t STDCALL(* mouse_device_control_proc) (MOUSE_DEVICE *mouse, int request, size_t argument1, size_t *argument2)
typedef uint32_t STDCALL(* mouse_device_get_properties_proc) (MOUSE_DEVICE *mouse, MOUSE_PROPERTIES *properties)

Functions

uint32_t STDCALL mouse_peek (void)
 Peek at the global mouse buffer to see if any data packets are ready.
uint32_t STDCALL mouse_read (void *buffer, uint32_t size, uint32_t *count)
 Read mouse data packets from the global mouse buffer.
uint32_t STDCALL mouse_read_ex (void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
 Read mouse data packets from the global mouse buffer.
uint32_t STDCALL mouse_write (void *buffer, uint32_t size, uint32_t count)
 Write mouse data packets to the global mouse buffer.
uint32_t STDCALL mouse_flush (void)
 Flush the contents of the global mouse buffer.
uint32_t STDCALL mouse_device_read (MOUSE_DEVICE *mouse, void *buffer, uint32_t size, uint32_t *count)
 Read mouse data packets from the buffer of the specified mouse.
uint32_t STDCALL mouse_device_update (MOUSE_DEVICE *mouse)
 Request the specified mouse device to update the current configuration.
uint32_t STDCALL mouse_device_control (MOUSE_DEVICE *mouse, int request, size_t argument1, size_t *argument2)
 Perform a control request on the specified mouse device.
uint32_t STDCALL mouse_device_get_properties (MOUSE_DEVICE *mouse, MOUSE_PROPERTIES *properties)
 Get the properties for the specified mouse device.
uint32_t STDCALL mouse_device_set_state (MOUSE_DEVICE *mouse, uint32_t state)
 Set the state of the specified mouse and send a notification.
MOUSE_DEVICE *STDCALL mouse_device_create (void)
 Create a new Mouse device entry.
MOUSE_DEVICE *STDCALL mouse_device_create_ex (uint32_t size)
 Create a new Mouse device entry.
uint32_t STDCALL mouse_device_destroy (MOUSE_DEVICE *mouse)
 Destroy an existing Mouse device entry.
uint32_t STDCALL mouse_device_register (MOUSE_DEVICE *mouse)
 Register a new Mouse device in the Mouse table.
uint32_t STDCALL mouse_device_deregister (MOUSE_DEVICE *mouse)
 Deregister a Mouse device from the Mouse table.
MOUSE_DEVICE *STDCALL mouse_device_find (uint32_t mouseid)
 Find a mouse device by ID in the mouse table.
MOUSE_DEVICE *STDCALL mouse_device_find_by_name (const char *name)
 Find a mouse device by name in the mouse table.
MOUSE_DEVICE *STDCALL mouse_device_find_by_description (const char *description)
 Find a mouse device by description in the mouse table.
uint32_t STDCALL mouse_device_enumerate (mouse_enumerate_cb callback, void *data)
 Enumerate all mouse devices in the mouse table.
uint32_t STDCALL mouse_device_notification (MOUSE_DEVICE *mouse, mouse_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
 Register a notification for mouse device changes.
uint32_t STDCALL mouse_get_count (void)
 Get the current mouse count.
MOUSE_DEVICE *STDCALL mouse_device_check (MOUSE_DEVICE *mouse)
 Check if the supplied Mouse is in the mouse table.
uint32_t STDCALL mouse_device_type_to_string (uint32_t mousetype, char *string, uint32_t len)
uint32_t STDCALL mouse_device_state_to_string (uint32_t mousestate, char *string, uint32_t len)
uint32_t STDCALL mouse_device_rotation_to_string (uint32_t rotation, char *string, uint32_t len)
 Return a string describing the supplied mouse rotation value.
uint32_t STDCALL mouse_device_state_to_notification (uint32_t state)
 Convert a Mouse state value into the notification code for device notifications.
uint32_t STDCALL mouse_device_resolve_rotation (uint32_t rotation)
 Resolve a value of 0, 90, 180 or 270 to a mouse rotation constant (eg MOUSE_ROTATION_180).
uint32_t STDCALL mouse_insert_data (MOUSE_DEVICE *mouse, MOUSE_DATA *data, BOOL signal)
 Insert a TMouseData entry into the mouse buffer (Direct or Global).

Variables

struct _USB_HID_DESCRIPTOR PACKED

Macro Definition Documentation

◆ MOUSE_NAME_PREFIX

#define MOUSE_NAME_PREFIX   "Mouse"

Name prefix for Mouse Devices.

Mouse specific constants

◆ MOUSE_TYPE_NONE

#define MOUSE_TYPE_NONE   0

Mouse Device Types

◆ MOUSE_TYPE_USB

#define MOUSE_TYPE_USB   1

◆ MOUSE_TYPE_PS2

#define MOUSE_TYPE_PS2   2

◆ MOUSE_TYPE_SERIAL

#define MOUSE_TYPE_SERIAL   3

◆ MOUSE_TYPE_MAX

#define MOUSE_TYPE_MAX   3

◆ MOUSE_STATE_DETACHED

#define MOUSE_STATE_DETACHED   0

Mouse Device States

◆ MOUSE_STATE_DETACHING

#define MOUSE_STATE_DETACHING   1

◆ MOUSE_STATE_ATTACHING

#define MOUSE_STATE_ATTACHING   2

◆ MOUSE_STATE_ATTACHED

#define MOUSE_STATE_ATTACHED   3

◆ MOUSE_STATE_MAX

#define MOUSE_STATE_MAX   3

◆ MOUSE_FLAG_NONE

#define MOUSE_FLAG_NONE   0x00000000

Mouse Device Flags

◆ MOUSE_FLAG_NON_BLOCK

#define MOUSE_FLAG_NON_BLOCK   0x00000001

If set device reads are non blocking (Also supported in Flags parameter of MouseReadEx).

◆ MOUSE_FLAG_DIRECT_READ

#define MOUSE_FLAG_DIRECT_READ   0x00000002

If set device writes mouse data to its local buffer which must be read using MouseDeviceRead.

◆ MOUSE_FLAG_SWAP_BUTTONS

#define MOUSE_FLAG_SWAP_BUTTONS   0x00000004

If set left and right mouse buttons will be swapped in mouse data.

◆ MOUSE_FLAG_PEEK_BUFFER

#define MOUSE_FLAG_PEEK_BUFFER   0x00000008

Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of MouseReadEx).

◆ MOUSE_FLAG_SWAP_XY

#define MOUSE_FLAG_SWAP_XY   0x00000010

If set swap the X and Y coordinates.

◆ MOUSE_FLAG_INVERT_X

#define MOUSE_FLAG_INVERT_X   0x00000020

If set invert the X coordinate.

◆ MOUSE_FLAG_INVERT_Y

#define MOUSE_FLAG_INVERT_Y   0x00000040

If set invert the Y coordinate.

◆ MOUSE_FLAG_SWAP_MAX_XY

#define MOUSE_FLAG_SWAP_MAX_XY   0x00000080

If set swap the maximum X and Y values.

◆ MOUSE_FLAG_MASK

Flags supported by MOUSE_CONTROL_GET/SET/CLEAR_FLAG

◆ MOUSE_CONTROL_GET_FLAG

#define MOUSE_CONTROL_GET_FLAG   1

Get Flag.

Mouse Device Control Codes

◆ MOUSE_CONTROL_SET_FLAG

#define MOUSE_CONTROL_SET_FLAG   2

Set Flag.

◆ MOUSE_CONTROL_CLEAR_FLAG

#define MOUSE_CONTROL_CLEAR_FLAG   3

Clear Flag.

◆ MOUSE_CONTROL_FLUSH_BUFFER

#define MOUSE_CONTROL_FLUSH_BUFFER   4

Flush Buffer.

◆ MOUSE_CONTROL_GET_SAMPLE_RATE

#define MOUSE_CONTROL_GET_SAMPLE_RATE   5

Get Sample Rate.

◆ MOUSE_CONTROL_SET_SAMPLE_RATE

#define MOUSE_CONTROL_SET_SAMPLE_RATE   6

Set Sample Rate.

◆ MOUSE_CONTROL_GET_MAX_X

#define MOUSE_CONTROL_GET_MAX_X   7

Get Maximum X value (Only applies to Absolute X values).

◆ MOUSE_CONTROL_GET_MAX_Y

#define MOUSE_CONTROL_GET_MAX_Y   8

Get Maximum Y value (Only applies to Absolute Y values).

◆ MOUSE_CONTROL_GET_MAX_WHEEL

#define MOUSE_CONTROL_GET_MAX_WHEEL   9

Get Maximum Wheel value (Only applies to Absolute Wheel values).

◆ MOUSE_CONTROL_GET_MAX_BUTTONS

#define MOUSE_CONTROL_GET_MAX_BUTTONS   10

Get Maximum Buttons mask (eg MOUSE_LEFT_BUTTON or MOUSE_RIGHT_BUTTON etc).

◆ MOUSE_CONTROL_GET_ROTATION

#define MOUSE_CONTROL_GET_ROTATION   11

Get Rotation value (0, 90, 180, 270)(Only where supported by the driver).

◆ MOUSE_CONTROL_SET_ROTATION

#define MOUSE_CONTROL_SET_ROTATION   12

Set Rotation value (0, 90, 180, 270)(Only where supported by the driver).

◆ MOUSE_BUFFER_SIZE

#define MOUSE_BUFFER_SIZE   512

Mouse Buffer Size

◆ MOUSE_SAMPLE_RATE

#define MOUSE_SAMPLE_RATE   100

100 samples/sec

Mouse Sampling Rate

◆ MOUSE_LEFT_BUTTON

#define MOUSE_LEFT_BUTTON   0x0001

The Left mouse button is pressed.

Mouse Data Definitions (Values for TMouseData.Buttons)

◆ MOUSE_RIGHT_BUTTON

#define MOUSE_RIGHT_BUTTON   0x0002

The Right mouse button is pressed.

◆ MOUSE_MIDDLE_BUTTON

#define MOUSE_MIDDLE_BUTTON   0x0004

The Middle mouse button is pressed.

◆ MOUSE_SIDE_BUTTON

#define MOUSE_SIDE_BUTTON   0x0008

The Side mouse button is pressed.

◆ MOUSE_EXTRA_BUTTON

#define MOUSE_EXTRA_BUTTON   0x0010

The Extra mouse button is pressed.

◆ MOUSE_TOUCH_BUTTON

#define MOUSE_TOUCH_BUTTON   0x0020

The Touch screen is being touched.

◆ MOUSE_ABSOLUTE_X

#define MOUSE_ABSOLUTE_X   0x0040

The OffsetX value is absolute not relative.

◆ MOUSE_ABSOLUTE_Y

#define MOUSE_ABSOLUTE_Y   0x0080

The OffsetY value is absolute not relative.

◆ MOUSE_ABSOLUTE_WHEEL

#define MOUSE_ABSOLUTE_WHEEL   0x0100

The OffsetWheel value is absolute not relative.

◆ MOUSE_ROTATION_0

#define MOUSE_ROTATION_0   FRAMEBUFFER_ROTATION_0

No rotation.

Mouse Rotation

◆ MOUSE_ROTATION_90

#define MOUSE_ROTATION_90   FRAMEBUFFER_ROTATION_90

90 degree rotation

◆ MOUSE_ROTATION_180

#define MOUSE_ROTATION_180   FRAMEBUFFER_ROTATION_180

180 degree rotation

◆ MOUSE_ROTATION_270

#define MOUSE_ROTATION_270   FRAMEBUFFER_ROTATION_270

270 degree rotation

◆ USB_HID_SUBCLASS_NONE

#define USB_HID_SUBCLASS_NONE   0

Section 4.2.

USB Mouse specific constants Note: The following constants are duplicated with the USBMouse unit for backwards compatibility HID Interface Subclass types (See USB HID v1.11 specification)

◆ USB_HID_SUBCLASS_BOOT

#define USB_HID_SUBCLASS_BOOT   1

Section 4.2.

◆ USB_HID_BOOT_PROTOCOL_NONE

#define USB_HID_BOOT_PROTOCOL_NONE   0

Section 4.3.

HID Interface Protocol types (See USB HID v1.11 specification)

◆ USB_HID_BOOT_PROTOCOL_KEYBOARD

#define USB_HID_BOOT_PROTOCOL_KEYBOARD   1

Section 4.3.

◆ USB_HID_BOOT_PROTOCOL_MOUSE

#define USB_HID_BOOT_PROTOCOL_MOUSE   2

Section 4.3.

◆ USB_HID_DESCRIPTOR_TYPE_HID

#define USB_HID_DESCRIPTOR_TYPE_HID   0x21

Section 7.1.

HID Class Descriptor Types (See USB HID v1.11 specification)

◆ USB_HID_DESCRIPTOR_TYPE_REPORT

#define USB_HID_DESCRIPTOR_TYPE_REPORT   0x22

Section 7.1.

◆ USB_HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR

#define USB_HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR   0x23

Section 7.1.

◆ USB_HID_REQUEST_GET_REPORT

#define USB_HID_REQUEST_GET_REPORT   0x01

HID Request types

◆ USB_HID_REQUEST_GET_IDLE

#define USB_HID_REQUEST_GET_IDLE   0x02

◆ USB_HID_REQUEST_GET_PROTOCOL

#define USB_HID_REQUEST_GET_PROTOCOL   0x03

Section 7.2.

◆ USB_HID_REQUEST_SET_REPORT

#define USB_HID_REQUEST_SET_REPORT   0x09

◆ USB_HID_REQUEST_SET_IDLE

#define USB_HID_REQUEST_SET_IDLE   0x0A

◆ USB_HID_REQUEST_SET_PROTOCOL

#define USB_HID_REQUEST_SET_PROTOCOL   0x0B

Section 7.2.

◆ USB_HID_PROTOCOL_BOOT

#define USB_HID_PROTOCOL_BOOT   0

Section 7.2.5.

HID Protocol types

◆ USB_HID_PROTOCOL_REPORT

#define USB_HID_PROTOCOL_REPORT   1

Section 7.2.5.

◆ USB_HID_REPORT_INPUT

#define USB_HID_REPORT_INPUT   1

Section 7.2.1.

HID Report types

◆ USB_HID_REPORT_OUTPUT

#define USB_HID_REPORT_OUTPUT   2

Section 7.2.1.

◆ USB_HID_REPORT_FEATURE

#define USB_HID_REPORT_FEATURE   3

Section 7.2.1.

◆ USB_HID_REPORTID_NONE

#define USB_HID_REPORTID_NONE   0

Section 7.2.1.

HID Report IDs

◆ USB_HID_BOOT_LEFT_BUTTON

#define USB_HID_BOOT_LEFT_BUTTON   (1 << 0)

HID Boot Protocol Button bits

◆ USB_HID_BOOT_RIGHT_BUTTON

#define USB_HID_BOOT_RIGHT_BUTTON   (1 << 1)

◆ USB_HID_BOOT_MIDDLE_BUTTON

#define USB_HID_BOOT_MIDDLE_BUTTON   (1 << 2)

◆ USB_HID_BOOT_SIDE_BUTTON

#define USB_HID_BOOT_SIDE_BUTTON   (1 << 3)

◆ USB_HID_BOOT_EXTRA_BUTTON

#define USB_HID_BOOT_EXTRA_BUTTON   (1 << 4)

◆ USB_HID_BOOT_REPORT_SIZE

#define USB_HID_BOOT_REPORT_SIZE   8

3 // Appendix B of HID Device Class Definition 1.11

HID Boot Protocol Report data

◆ USB_HID_BOOT_DATA_SIZE

#define USB_HID_BOOT_DATA_SIZE   8

Allocate more than the minimum to allow for extra data.

Typedef Documentation

◆ MOUSE_DATA

typedef struct _MOUSE_DATA MOUSE_DATA

Mouse specific types Mouse Data

◆ MOUSE_BUFFER

typedef struct _MOUSE_BUFFER MOUSE_BUFFER

Mouse Buffer

◆ MOUSE_PROPERTIES

Mouse Properties

◆ MOUSE_DEVICE

typedef struct _MOUSE_DEVICE MOUSE_DEVICE

Mouse Device

◆ mouse_enumerate_cb

typedef uint32_t STDCALL(* mouse_enumerate_cb) (MOUSE_DEVICE *mouse, void *data)

Mouse Enumeration Callback

◆ mouse_notification_cb

typedef uint32_t STDCALL(* mouse_notification_cb) (DEVICE *device, void *data, uint32_t notification)

Mouse Notification Callback

◆ mouse_device_read_proc

typedef uint32_t STDCALL(* mouse_device_read_proc) (MOUSE_DEVICE *mouse, void *buffer, uint32_t size, uint32_t *count)

Mouse Device Methods

◆ mouse_device_update_proc

typedef uint32_t STDCALL(* mouse_device_update_proc) (MOUSE_DEVICE *mouse)

◆ mouse_device_control_proc

typedef uint32_t STDCALL(* mouse_device_control_proc) (MOUSE_DEVICE *mouse, int request, size_t argument1, size_t *argument2)

◆ mouse_device_get_properties_proc

typedef uint32_t STDCALL(* mouse_device_get_properties_proc) (MOUSE_DEVICE *mouse, MOUSE_PROPERTIES *properties)

Function Documentation

◆ mouse_peek()

uint32_t STDCALL mouse_peek ( void )

Peek at the global mouse buffer to see if any data packets are ready.

Mouse Functions

Returns
ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure

◆ mouse_read()

uint32_t STDCALL mouse_read ( void * buffer,
uint32_t size,
uint32_t * count )

Read mouse data packets from the global mouse buffer.

Parameters
BufferPointer to a buffer to copy the mouse data packets to
SizeThe size of the buffer in bytes (Must be at least TMouseData or greater)
CountThe number of mouse data packets copied to the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_read_ex()

uint32_t STDCALL mouse_read_ex ( void * buffer,
uint32_t size,
uint32_t flags,
uint32_t * count )

Read mouse data packets from the global mouse buffer.

Parameters
BufferPointer to a buffer to copy the mouse data packets to
SizeThe size of the buffer in bytes (Must be at least TMouseData or greater)
FlagsThe flags for the behaviour of the read (eg MOUSE_FLAG_NON_BLOCK)
CountThe number of mouse data packets copied to the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_write()

uint32_t STDCALL mouse_write ( void * buffer,
uint32_t size,
uint32_t count )

Write mouse data packets to the global mouse buffer.

Parameters
BufferPointer to a buffer to copy the mouse data packets from
SizeThe size of the buffer in bytes (Must be at least TMouseData or greater)
CountThe number of mouse data packets to copy from the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_flush()

uint32_t STDCALL mouse_flush ( void )

Flush the contents of the global mouse buffer.

Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_read()

uint32_t STDCALL mouse_device_read ( MOUSE_DEVICE * mouse,
void * buffer,
uint32_t size,
uint32_t * count )

Read mouse data packets from the buffer of the specified mouse.

Parameters
MouseThe mouse device to read from
BufferPointer to a buffer to copy the mouse data packets to
SizeThe size of the buffer in bytes (Must be at least TMouseData or greater)
CountThe number of mouse data packets copied to the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_update()

uint32_t STDCALL mouse_device_update ( MOUSE_DEVICE * mouse)

Request the specified mouse device to update the current configuration.

Parameters
MouseThe mouse device to update
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Items updated can include rotation, maximum X, Y and wheel and flags (If supported)

◆ mouse_device_control()

uint32_t STDCALL mouse_device_control ( MOUSE_DEVICE * mouse,
int request,
size_t argument1,
size_t * argument2 )

Perform a control request on the specified mouse device.

Parameters
MouseThe mouse device to control
RequestThe request code for the operation (eg MOUSE_CONTROL_GET_FLAG)
Argument1The first argument for the operation (Dependent on request code)
Argument2The second argument for the operation (Dependent on request code)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_get_properties()

uint32_t STDCALL mouse_device_get_properties ( MOUSE_DEVICE * mouse,
MOUSE_PROPERTIES * properties )

Get the properties for the specified mouse device.

Parameters
MouseThe mouse device to get properties from
PropertiesPointer to a TMouseProperties structure to fill in
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_set_state()

uint32_t STDCALL mouse_device_set_state ( MOUSE_DEVICE * mouse,
uint32_t state )

Set the state of the specified mouse and send a notification.

Parameters
MouseThe mouse to set the state for
StateThe new state to set and notify
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_create()

MOUSE_DEVICE *STDCALL mouse_device_create ( void )

Create a new Mouse device entry.

Returns
Pointer to new Mouse device entry or nil if mouse could not be created

◆ mouse_device_create_ex()

MOUSE_DEVICE *STDCALL mouse_device_create_ex ( uint32_t size)

Create a new Mouse device entry.

Parameters
SizeSize in bytes to allocate for new mouse (Including the mouse device entry)
Returns
Pointer to new Mouse device entry or nil if mouse could not be created

◆ mouse_device_destroy()

uint32_t STDCALL mouse_device_destroy ( MOUSE_DEVICE * mouse)

Destroy an existing Mouse device entry.

Parameters
MouseThe mouse device to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_register()

uint32_t STDCALL mouse_device_register ( MOUSE_DEVICE * mouse)

Register a new Mouse device in the Mouse table.

Parameters
MouseThe mouse device to register
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_deregister()

uint32_t STDCALL mouse_device_deregister ( MOUSE_DEVICE * mouse)

Deregister a Mouse device from the Mouse table.

Parameters
MouseThe mouse device to deregister
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_find()

MOUSE_DEVICE *STDCALL mouse_device_find ( uint32_t mouseid)

Find a mouse device by ID in the mouse table.

Parameters
MouseIdThe ID number of the mouse to find
Returns
Pointer to mouse device entry or nil if not found

◆ mouse_device_find_by_name()

MOUSE_DEVICE *STDCALL mouse_device_find_by_name ( const char * name)

Find a mouse device by name in the mouse table.

Parameters
NameThe name of the mouse to find (eg Mouse0)
Returns
Pointer to mouse device entry or nil if not found

◆ mouse_device_find_by_description()

MOUSE_DEVICE *STDCALL mouse_device_find_by_description ( const char * description)

Find a mouse device by description in the mouse table.

Parameters
DescriptionThe description of the mouse to find (eg USB HID Mouse)
Returns
Pointer to mouse device entry or nil if not found

◆ mouse_device_enumerate()

uint32_t STDCALL mouse_device_enumerate ( mouse_enumerate_cb callback,
void * data )

Enumerate all mouse devices in the mouse table.

Parameters
CallbackThe callback function to call for each mouse in the table
DataA private data pointer to pass to callback for each mouse in the table
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mouse_device_notification()

uint32_t STDCALL mouse_device_notification ( MOUSE_DEVICE * mouse,
mouse_notification_cb callback,
void * data,
uint32_t notification,
uint32_t flags )

Register a notification for mouse device changes.

Parameters
MouseThe mouse device to notify changes for (Optional, pass nil for all mice)
CallbackThe function to call when a notification event occurs
DataA private data pointer to pass to callback when a notification event occurs
NotificationThe events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
FlagsThe flags to control the notification (eg NOTIFIER_FLAG_WORKER)

◆ mouse_get_count()

uint32_t STDCALL mouse_get_count ( void )

Get the current mouse count.

Mouse Helper Functions

◆ mouse_device_check()

MOUSE_DEVICE *STDCALL mouse_device_check ( MOUSE_DEVICE * mouse)

Check if the supplied Mouse is in the mouse table.

◆ mouse_device_type_to_string()

uint32_t STDCALL mouse_device_type_to_string ( uint32_t mousetype,
char * string,
uint32_t len )

◆ mouse_device_state_to_string()

uint32_t STDCALL mouse_device_state_to_string ( uint32_t mousestate,
char * string,
uint32_t len )

◆ mouse_device_rotation_to_string()

uint32_t STDCALL mouse_device_rotation_to_string ( uint32_t rotation,
char * string,
uint32_t len )

Return a string describing the supplied mouse rotation value.

◆ mouse_device_state_to_notification()

uint32_t STDCALL mouse_device_state_to_notification ( uint32_t state)

Convert a Mouse state value into the notification code for device notifications.

◆ mouse_device_resolve_rotation()

uint32_t STDCALL mouse_device_resolve_rotation ( uint32_t rotation)

Resolve a value of 0, 90, 180 or 270 to a mouse rotation constant (eg MOUSE_ROTATION_180).

Note
Also accepts passing the mouse rotation constant values directly

◆ mouse_insert_data()

uint32_t STDCALL mouse_insert_data ( MOUSE_DEVICE * mouse,
MOUSE_DATA * data,
BOOL signal )

Insert a TMouseData entry into the mouse buffer (Direct or Global).

Parameters
MouseThe mouse device to insert data for
DataThe TMouseData entry to insert
SignalIf True then signal that new data is available in the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the mouse lock

Variable Documentation

◆ PACKED

struct _USB_HID_DESCRIPTOR PACKED