µGFX  2.9
version 2.9
Mouse

Detailed Description

Sub-Module to handle touchscreens and mices.

Both resistive and capacitive touchscreens are supported.

Precondition
GFX_USE_GINPUT must be set to GFXON in your gfxconf.h
GINPUT_NEED_MOUSE must be set to GFXON in your gfxconf.h

Functions

GSourceHandle ginputGetMouse (unsigned instance)
 Get the Source handler for a mouse using the instance number. More...
 
void ginputSetFingerMode (unsigned instance, gBool on)
 Should this device be in Pen mode or Finger mode. More...
 
void ginputSetMouseDisplay (unsigned instance, GDisplay *g)
 Assign the display associated with the mouse. More...
 
GDisplay * ginputGetMouseDisplay (unsigned instance)
 Get the display currently associated with the mouse. More...
 
gBool ginputGetMouseStatus (unsigned instance, GEventMouse *pmouse)
 Get the current mouse position and button status. More...
 
gU32 ginputCalibrateMouse (unsigned instance)
 Performs a calibration. More...
 
gBool LoadMouseCalibration (unsigned instance, void *data, gMemSize sz)
 Load a set of mouse calibration data. More...
 
gBool SaveMouseCalibration (unsigned instance, const void *data, gMemSize sz)
 Save a set of mouse calibration data. More...
 

Function Documentation

◆ ginputCalibrateMouse()

gU32 ginputCalibrateMouse ( unsigned  instance)

Performs a calibration.

Parameters
[in]instanceThe ID of the mouse input instance
Returns
The calibration error squared if calibration fails, or 0 on success or if the driver dosen't need calibration.
Note
An invalid instance will also return 0.

◆ ginputGetMouse()

GSourceHandle ginputGetMouse ( unsigned  instance)

Get the Source handler for a mouse using the instance number.

Parameters
[in]instanceThe mouse instance number
Returns
The source handle of the mouse or NULL
Note
You can use the special value of GMOUSE_ALL_INSTANCES to get a source handle that returns events for all mice rather than a specific mouse. Using GMOUSE_ALL_INSTANCES will always return a valid spurce handle even if there are currently no mice in the system.

◆ ginputGetMouseDisplay()

GDisplay* ginputGetMouseDisplay ( unsigned  instance)

Get the display currently associated with the mouse.

Returns
A pointer to the display
Parameters
[in]instanceThe ID of the mouse input instance

◆ ginputGetMouseStatus()

gBool ginputGetMouseStatus ( unsigned  instance,
GEventMouse *  pmouse 
)

Get the current mouse position and button status.

Note
Unlinke a listener event, this status cannot record meta events such as "CLICK".
Parameters
[in]instanceThe ID of the mouse input instance
[in]pmouseThe mouse event
Returns
gFalse on an error (eg. invalid instance)

◆ ginputSetFingerMode()

void ginputSetFingerMode ( unsigned  instance,
gBool  on 
)

Should this device be in Pen mode or Finger mode.

Note
A touch device (and even theoritically a mouse) can operate in either pen or finger mode. In finger mode typically a touch device will be far more tolerant of movement and other inaccuracies. Each driver specifies its own tolerances for pen versus finger mode.
Parameters
[in]instanceThe ID of the mouse input instance
[in]onIf true then finger mode is turned on.

◆ ginputSetMouseDisplay()

void ginputSetMouseDisplay ( unsigned  instance,
GDisplay *  g 
)

Assign the display associated with the mouse.

Note
This only needs to be called if the mouse is associated with a display other than the current default display. It must be called before ginputGetMouse() if the new display is to be used during the calibration process. Other than calibration the display is used for range checking, and may also be used to display a mouse pointer.
Parameters
[in]instanceThe ID of the mouse input instance
[in]gThe GDisplay to which this mouse belongs

◆ LoadMouseCalibration()

gBool LoadMouseCalibration ( unsigned  instance,
void *  data,
gMemSize  sz 
)

Load a set of mouse calibration data.

Returns
A pointer to the data or NULL on failure
Parameters
[in]instanceThe mouse input instance number
[in]dataWhere the data should be placed
[in]szThe size in bytes of the data to retrieve.
Note
This routine is provided by the user application. It is only called if GINPUT_TOUCH_USER_CALIBRATION_LOAD has been set to GFXON in the users gfxconf.h file.

◆ SaveMouseCalibration()

gBool SaveMouseCalibration ( unsigned  instance,
const void *  data,
gMemSize  sz 
)

Save a set of mouse calibration data.

Returns
gTrue if the save operation was successful.
Parameters
[in]instanceThe mouse input instance number
[in]dataThe data to save
[in]szThe size in bytes of the data to retrieve.
Note
This routine is provided by the user application. It is only called if GINPUT_TOUCH_USER_CALIBRATION_SAVE has been set to GFXON in the users gfxconf.h file.