version 2.8
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 TRUE in your gfxconf.h
GINPUT_NEED_MOUSE must be set to TRUE 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, bool_t 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...
 
bool_t ginputGetMouseStatus (unsigned instance, GEventMouse *pmouse)
 Get the current mouse position and button status. More...
 
uint32_t ginputCalibrateMouse (unsigned instance)
 Performs a calibration. More...
 
bool_t LoadMouseCalibration (unsigned instance, void *data, size_t sz)
 Load a set of mouse calibration data. More...
 
bool_t SaveMouseCalibration (unsigned instance, const void *data, size_t sz)
 Save a set of mouse calibration data. More...
 

Function Documentation

uint32_t 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.
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.
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
bool_t 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
FALSE on an error (eg. invalid instance)
void ginputSetFingerMode ( unsigned  instance,
bool_t  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.
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
bool_t LoadMouseCalibration ( unsigned  instance,
void *  data,
size_t  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 TRUE in the users gfxconf.h file.
bool_t SaveMouseCalibration ( unsigned  instance,
const void *  data,
size_t  sz 
)

Save a set of mouse calibration data.

Returns
TRUE 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 TRUE in the users gfxconf.h file.