New mouse updates. Just need a driver now.
This commit is contained in:
parent
33200c1a97
commit
10dc968427
@ -210,6 +210,16 @@
|
||||
//#define GFX_USE_GINPUT FALSE
|
||||
|
||||
//#define GINPUT_NEED_MOUSE FALSE
|
||||
// #define GINPUT_TOUCH_STARTRAW FALSE
|
||||
// #define GINPUT_TOUCH_NOTOUCH FALSE
|
||||
// #define GINPUT_TOUCH_NOCALIBRATE FALSE
|
||||
// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
|
||||
// #define GINPUT_MOUSE_POLL_PERIOD 25
|
||||
// #define GINPUT_MOUSE_CLICK_TIME 300
|
||||
// #define GINPUT_TOUCH_CXTCLICK_TIME 700
|
||||
// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
|
||||
// #define GINPUT_TOUCH_USER_CALIBRATION_FREE FALSE
|
||||
// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
|
||||
//#define GINPUT_NEED_KEYBOARD FALSE
|
||||
//#define GINPUT_NEED_TOGGLE FALSE
|
||||
//#define GINPUT_NEED_DIAL FALSE
|
||||
|
@ -42,21 +42,17 @@ typedef struct GMouse {
|
||||
GDriver d; // The driver overheads and vmt
|
||||
GMouseReading r; // The current position and state
|
||||
uint16_t flags; // Flags
|
||||
#define GMOUSE_FLG_ACTIVE 0x0001 // Mouse is currently active
|
||||
#define GMOUSE_FLG_CLICK_TIMER 0x0002 // Currently timing a click event
|
||||
#define GMOUSE_FLG_INDELTA 0x0004 // Currently in a up/down transition test
|
||||
#define GMOUSE_FLG_CLIP 0x0008 // Clip reading to the display
|
||||
#define GMOUSE_FLG_CALIBRATE 0x0010 // Calibrate readings
|
||||
#define GMOUSE_FLG_CAL_INPROGRESS 0x0020 // Calibrate is currently in progress
|
||||
#define GMOUSE_FLG_CAL_SAVED 0x0040 // Calibration has been saved
|
||||
#define GMOUSE_FLG_FINGERMODE 0x0080 // Mouse is currently in finger mode
|
||||
#define GMOUSE_FLG_NEEDREAD 0x0100 // The mouse needs reading
|
||||
#define GMOUSE_FLG_CLICK_TIMER 0x0001 // Currently timing a click
|
||||
#define GMOUSE_FLG_INDELTA 0x0002 // Currently in a up/down transition test
|
||||
#define GMOUSE_FLG_CLIP 0x0004 // Clip reading to the display
|
||||
#define GMOUSE_FLG_CALIBRATE 0x0008 // Calibrate readings
|
||||
#define GMOUSE_FLG_IN_CAL 0x0010 // Currently in calibration routine
|
||||
#define GMOUSE_FLG_FINGERMODE 0x0020 // Mouse is currently in finger mode
|
||||
#define GMOUSE_FLG_NEEDREAD 0x0040 // The mouse needs reading
|
||||
point clickpos; // The position of the last click event
|
||||
systemticks_t clicktime; // The time of the last click event
|
||||
GDisplay * display; // The display the mouse is associated with
|
||||
#if !GINPUT_TOUCH_NOCALIBRATE
|
||||
GMouseCalibrationSaveRoutine fnsavecal; // The calibration load routine
|
||||
GMouseCalibrationLoadRoutine fnloadcal; // The calibration save routine
|
||||
GMouseCalibration caldata; // The calibration data
|
||||
#endif
|
||||
// Other driver specific fields may follow.
|
||||
@ -77,8 +73,10 @@ typedef struct GMouseVMT {
|
||||
#define GMOUSE_VFLG_CALIBRATE 0x0010 // This device requires calibration
|
||||
#define GMOUSE_VFLG_CAL_EXTREMES 0x0020 // Use edge to edge calibration
|
||||
#define GMOUSE_VFLG_CAL_TEST 0x0040 // Test the results of the calibration
|
||||
#define GMOUSE_VFLG_CAL_LOADFREE 0x0080 // Call gfxFree on the buffer returned by the VMT calload() routine.
|
||||
#define GMOUSE_VFLG_ONLY_DOWN 0x0100 // This device returns a valid position only when the mouse is down
|
||||
#define GMOUSE_VFLG_POORUPDOWN 0x0200 // Position readings during up/down are unreliable
|
||||
#define GMOUSE_VFLG_DYNAMICONLY 0x8000 // This mouse driver should not be statically initialized eg Win32
|
||||
coord_t z_max; // TOUCH: Maximum possible z value (fully touched)
|
||||
coord_t z_min; // TOUCH: Minimum possible z value (touch off screen). Note may also be > z_max
|
||||
coord_t z_touchon; // TOUCH: z values between z_max and this are a solid touch on
|
||||
@ -87,10 +85,11 @@ typedef struct GMouseVMT {
|
||||
GMouseJitter pen_jitter; // PEN MODE: Jitter settings
|
||||
GMouseJitter finger_jitter; // FINGER MODE: Jitter settings
|
||||
|
||||
bool_t (*init)(GMouse *m); // Required
|
||||
bool_t (*init)(GMouse *m, unsigned driverinstance); // Required
|
||||
void (*deinit)(GMouse *m); // Optional
|
||||
void (*get)(GMouse *m, GMouseReading *prd); // Required
|
||||
void (*calsave)(GMouse *m, void *buf, size_t sz); // Optional
|
||||
const char *(*calload)(GMouse *m); // Optional: Can return NULL if no data is saved. Buffer is automatically gfxFree()'d afterwards.
|
||||
const char *(*calload)(GMouse *m, size_t sz); // Optional: Can return NULL if no data is saved.
|
||||
} GMouseVMT;
|
||||
|
||||
#define gmvmt(m) ((const GMouseVMT const *)((m)->d.vmt))
|
||||
@ -99,9 +98,28 @@ typedef struct GMouseVMT {
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
// If we are not using multiple mice then hard-code the VMT name
|
||||
#if !defined(GINPUT_MOUSE_DRIVER_LIST)
|
||||
#undef GMOUSE_DRIVER_VMT
|
||||
#define GMOUSE_DRIVER_VMT GMOUSEVMT_OnlyOne
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* @brief Routines needed by the general driver VMT
|
||||
* @note These routines are provided by the high level code for
|
||||
* use in the GMouseVMT.d structure.
|
||||
*
|
||||
* @notapi
|
||||
* @{
|
||||
*/
|
||||
bool_t _gmouseInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance);
|
||||
void _gmousePostInitDriver(GDriver *g);
|
||||
void _gmouseDeInitDriver(GDriver *g);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Wakeup the high level code so that it attempts another read
|
||||
*
|
||||
@ -109,7 +127,7 @@ extern "C" {
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void ginputMouseWakeup(GMouse *m);
|
||||
void _gmouseWakeup(GMouse *m);
|
||||
|
||||
/**
|
||||
* @brief Wakeup the high level code so that it attempts another read
|
||||
@ -119,7 +137,7 @@ extern "C" {
|
||||
* @iclass
|
||||
* @notapi
|
||||
*/
|
||||
void ginputMouseWakeupI(GMouse *m);
|
||||
void _gmouseWakeupI(GMouse *m);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@
|
||||
*
|
||||
* @pre GFX_USE_GINPUT must be set to TRUE in your gfxconf.h
|
||||
* @pre GINPUT_NEED_MOUSE must be set to TRUE in your gfxconf.h
|
||||
*
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
@ -32,31 +32,29 @@
|
||||
|
||||
/* This type definition is also used by touch */
|
||||
typedef struct GEventMouse_t {
|
||||
GEventType type; // The type of this event (GEVENT_MOUSE or GEVENT_TOUCH)
|
||||
coord_t x, y, z; // The position of the mouse.
|
||||
// - For touch devices, Z is the current pressure if supported (otherwise 0)
|
||||
// - For mice, Z is the 3rd dimension if supported (otherwise 0)
|
||||
uint16_t current_buttons; // A bit is set if the button is down.
|
||||
// - For touch only bit 0 is relevant
|
||||
// - For mice the order of the buttons is (from 0 to n) left, right, middle, any other buttons
|
||||
// - Bit 15 being set indicates that an important mouse event has been missed.
|
||||
#define GINPUT_MOUSE_BTN_LEFT 0x0001
|
||||
#define GINPUT_MOUSE_BTN_RIGHT 0x0002
|
||||
#define GINPUT_MOUSE_BTN_MIDDLE 0x0004
|
||||
#define GINPUT_MOUSE_BTN_4 0x0008
|
||||
#define GINPUT_MISSED_MOUSE_EVENT 0x8000
|
||||
#define GINPUT_TOUCH_PRESSED GINPUT_MOUSE_BTN_LEFT
|
||||
uint16_t last_buttons; // The value of current_buttons on the last event
|
||||
enum GMouseMeta_e {
|
||||
GMETA_NONE = 0, // There is no meta event currently happening
|
||||
GMETA_MOUSE_DOWN = 1, // Button 0 has just gone down
|
||||
GMETA_MOUSE_UP = 2, // Button 0 has just gone up
|
||||
GMETA_MOUSE_CLICK = 4, // Button 0 has just gone through a short down - up cycle
|
||||
GMETA_MOUSE_CXTCLICK = 8 // For mice - The right button has just been depressed
|
||||
// For touch - a long press has just occurred
|
||||
} meta;
|
||||
GEventType type; // The type of this event (GEVENT_MOUSE or GEVENT_TOUCH)
|
||||
coord_t x, y, z; // The position of the mouse.
|
||||
// - For touch devices, Z is the current pressure if supported (values are device specific)
|
||||
// - For mice, Z is the 3rd dimension if supported (values are device specific)
|
||||
uint16_t buttons; // A bit is set if the button is down or a meta event has occurred.
|
||||
#define GINPUT_MOUSE_BTN_MASK 0x000F // The "button is down" mask
|
||||
#define GINPUT_MOUSE_BTN_LEFT 0x0001 // The left mouse button is currently down
|
||||
#define GINPUT_MOUSE_BTN_RIGHT 0x0002 // The right mouse button is currently down
|
||||
#define GINPUT_MOUSE_BTN_MIDDLE 0x0004 // The middle mouse button is currently down
|
||||
#define GINPUT_MOUSE_BTN_4 0x0008 // The 4th mouse button is currently down
|
||||
#define GINPUT_TOUCH_PRESSED 0x0001 // The touch surface is currently touched
|
||||
|
||||
#define GMETA_MASK 0x00F0 // The "button transition" mask
|
||||
#define GMETA_NONE 0x0000 // No "button transition" events
|
||||
#define GMETA_MOUSE_DOWN 0x0001 // Left mouse/touch has just gone down
|
||||
#define GMETA_MOUSE_UP 0x0002 // Left mouse/touch has just gone up
|
||||
#define GMETA_MOUSE_CLICK 0x0004 // Left mouse/touch has just gone through a click (short down - up cycle)
|
||||
#define GMETA_MOUSE_CXTCLICK 0x0008 // Right mouse has just been depressed or touch has gone through a long click
|
||||
|
||||
#define GINPUT_MISSED_MOUSE_EVENT 0x8000 // Oops - a mouse event has previously been missed
|
||||
|
||||
GDisplay * display; // The display this mouse is currently associated with.
|
||||
} GEventMouse;
|
||||
} GEventMouse;
|
||||
|
||||
// Mouse/Touch Listen Flags - passed to geventAddSourceToListener()
|
||||
#define GLISTEN_MOUSEMETA 0x0001 // Create events for meta events such as CLICK and CXTCLICK
|
||||
@ -68,12 +66,13 @@ typedef struct GEventMouse_t {
|
||||
#define GLISTEN_TOUCHUPMOVES GLISTEN_MOUSEUPMOVES
|
||||
#define GLISTEN_TOUCHNOFILTER GLISTEN_MOUSENOFILTER
|
||||
|
||||
#define GINPUT_MOUSE_NUM_PORTS 1 // The total number of mouse/touch inputs supported
|
||||
|
||||
// Event types for the mouse ginput source
|
||||
#define GEVENT_MOUSE (GEVENT_GINPUT_FIRST+0)
|
||||
#define GEVENT_TOUCH (GEVENT_GINPUT_FIRST+1)
|
||||
|
||||
// All mice
|
||||
#define GMOUSE_ALL_INSTANCES ((unsigned)-1)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
@ -83,16 +82,32 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Creates an instance of a mouse and returns the Source handler
|
||||
* @note HACK: if the instance is 9999, it is treated as instance 0 except
|
||||
* that no calibration will be performed!
|
||||
* @brief Get the Source handler for a mouse using the instance number
|
||||
*
|
||||
* @param[in] instance The ID of the mouse input instance (from 0 to 9999)
|
||||
* @param[in] instance The mouse instance number
|
||||
*
|
||||
* @return The source handle of the created instance
|
||||
* @return 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.
|
||||
*/
|
||||
GSourceHandle ginputGetMouse(uint16_t instance);
|
||||
|
||||
GSourceHandle ginputGetMouse(unsigned instance);
|
||||
|
||||
/**
|
||||
* @brief 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.
|
||||
*
|
||||
* @param[in] instance The ID of the mouse input instance
|
||||
* @param[in] on If true then finger mode is turned on.
|
||||
*/
|
||||
void ginputSetFingerMode(unsigned instance, bool_t on);
|
||||
|
||||
/**
|
||||
* @brief Assign the display associated with the mouse
|
||||
* @note This only needs to be called if the mouse is associated with a display
|
||||
@ -104,7 +119,7 @@ extern "C" {
|
||||
* @param[in] instance The ID of the mouse input instance
|
||||
* @param[in] g The GDisplay to which this mouse belongs
|
||||
*/
|
||||
void ginputSetMouseDisplay(uint16_t instance, GDisplay *g);
|
||||
void ginputSetMouseDisplay(unsigned instance, GDisplay *g);
|
||||
|
||||
/**
|
||||
* @brief Get the display currently associated with the mouse
|
||||
@ -112,7 +127,7 @@ extern "C" {
|
||||
*
|
||||
* @param[in] instance The ID of the mouse input instance
|
||||
*/
|
||||
GDisplay *ginputGetMouseDisplay(uint16_t instance);
|
||||
GDisplay *ginputGetMouseDisplay(unsigned instance);
|
||||
|
||||
/**
|
||||
* @brief Get the current mouse position and button status
|
||||
@ -124,7 +139,7 @@ extern "C" {
|
||||
*
|
||||
* @return FALSE on an error (eg. invalid instance)
|
||||
*/
|
||||
bool_t ginputGetMouseStatus(uint16_t instance, GEventMouse *pmouse);
|
||||
bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pmouse);
|
||||
|
||||
/**
|
||||
* @brief Performs a calibration
|
||||
@ -133,42 +148,37 @@ extern "C" {
|
||||
*
|
||||
* @return FALSE if the driver dosen't support a calibration of if the handle is invalid
|
||||
*/
|
||||
bool_t ginputCalibrateMouse(uint16_t instance);
|
||||
bool_t ginputCalibrateMouse(unsigned instance);
|
||||
|
||||
/* Set the routines to save and fetch calibration data.
|
||||
* This function should be called before first calling ginputGetMouse() for a particular instance
|
||||
* as the gdispGetMouse() routine may attempt to fetch calibration data and perform a startup calibration if there is no way to get it.
|
||||
* If this is called after gdispGetMouse() has been called and the driver requires calibration storage, it will immediately save the data is has already obtained.
|
||||
* The 'requireFree' parameter indicates if the fetch buffer must be free()'d to deallocate the buffer provided by the Fetch routine.
|
||||
*/
|
||||
typedef void (*GMouseCalibrationSaveRoutine)(uint16_t instance, const uint8_t *calbuf, size_t sz); // Save calibration data
|
||||
typedef const char * (*GMouseCalibrationLoadRoutine)(uint16_t instance); // Load calibration data (returns NULL if not data saved)
|
||||
/**
|
||||
* @brief Load a set of mouse calibration data
|
||||
* @return A pointer to the data or NULL on failure
|
||||
*
|
||||
* @param[in] instance The mouse input instance number
|
||||
* @param[in] sz The 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.
|
||||
* @note If GINPUT_TOUCH_USER_CALIBRATION_FREE has been set to TRUE in the users
|
||||
* gfxconf.h file then the buffer returned will be free'd using gfxFree().
|
||||
*/
|
||||
void *LoadMouseCalibration(unsigned instance, size_t sz);
|
||||
|
||||
/**
|
||||
* @brief Set the routines to store and restore calibration data
|
||||
/**
|
||||
* @brief Save a set of mouse calibration data
|
||||
* @return TRUE if the save operation was successful.
|
||||
*
|
||||
* @param[in] instance The mouse input instance number
|
||||
* @param[in] data The data to save
|
||||
* @param[in] sz The size in bytes of the data to retrieve.
|
||||
*
|
||||
* @details This function should be called before first calling ginputGetMouse() for a particular instance
|
||||
* as the gdispGetMouse() routine may attempt to fetch calibration data and perform a startup calibration if there is no way to get it.
|
||||
* If this is called after gdispGetMouse() has been called and the driver requires calibration storage, it will immediately save the
|
||||
* data is has already obtained.
|
||||
*
|
||||
* @param[in] instance The ID of the mouse input instance
|
||||
* @param[in] fnsave The routine to save the data
|
||||
* @param[in] fnload The routine to restore the data
|
||||
* @param[in] requireFree TRUE if the buffer returned by the load function must be freed by the mouse code.
|
||||
*/
|
||||
void ginputSetMouseCalibrationRoutines(uint16_t instance, GMouseCalibrationSaveRoutine fnsave, GMouseCalibrationLoadRoutine fnload, bool_t requireFree);
|
||||
* @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.
|
||||
*/
|
||||
bool_t SaveMouseCalibration(unsigned instance, const void *data, size_t sz);
|
||||
|
||||
/**
|
||||
* @brief Test if a particular mouse/touch instance requires routines to save it's alibration data
|
||||
* @note Not implemented yet
|
||||
*
|
||||
* @param[in] instance The ID of the mouse input instance
|
||||
*
|
||||
* @return TRUE if needed
|
||||
*/
|
||||
bool_t ginputRequireMouseCalibrationStorage(uint16_t instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -73,41 +73,97 @@
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Turn off touch mouse support.
|
||||
* @brief Start touch devices without loading or running calibration.
|
||||
* @details Defaults to FALSE
|
||||
* @note Touch device handling requires a lot of code. If your mouse doesn't require it
|
||||
* this can be turned off to save a lot of space.
|
||||
* @note This is used if you want to manually control the initial calibration
|
||||
* process. In practice this is only useful for a touch driver test program.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_NOTOUCH
|
||||
#define GINPUT_TOUCH_NOTOUCH FALSE
|
||||
#ifndef GINPUT_TOUCH_STARTRAW
|
||||
#define GINPUT_TOUCH_STARTRAW FALSE
|
||||
#endif
|
||||
/**
|
||||
* @brief Turn off the touch calibration GUI.
|
||||
* @details Defaults to FALSE
|
||||
* @note Turning off the calibration GUI just turns off the manual calibration
|
||||
* process. Readings may still be calibrated if calibration data
|
||||
* can be loaded.
|
||||
* @note Calibration requires a lot of code. If your device doesn't require it
|
||||
* using this option can save a lot of space.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_NOCALIBRATE_GUI
|
||||
#define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
|
||||
#endif
|
||||
/**
|
||||
* @brief Turn off calibration support.
|
||||
* @brief Turn off all touch calibration support.
|
||||
* @details Defaults to FALSE
|
||||
* @note Calibration requires a lot of code. If your mouse doesn't require it
|
||||
* this can be turned off to save a lot of space.
|
||||
* @note With this set to TRUE touch readings will not be calibrated.
|
||||
* @note This automatically turns off the calibration GUI too!
|
||||
* @note Calibration requires a lot of code. If your device doesn't require it
|
||||
* using this option can save a lot of space.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_NOCALIBRATE
|
||||
#define GINPUT_TOUCH_NOCALIBRATE FALSE
|
||||
#endif
|
||||
/**
|
||||
* @brief Turn off all touch support.
|
||||
* @details Defaults to FALSE
|
||||
* @note This automatically turns off all calibration and the calibration GUI too!
|
||||
* @note Touch device handling requires a lot of code. If your device doesn't require it
|
||||
* using this option can save a lot of space.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_NOTOUCH
|
||||
#define GINPUT_TOUCH_NOTOUCH FALSE
|
||||
#endif
|
||||
/**
|
||||
* @brief Milliseconds between mouse polls.
|
||||
* @details Defaults to 25 millseconds
|
||||
* @note How often mice should be polled. More often leads to smoother mouse movement
|
||||
* but increases CPU usage. If no mouse drivers need polling the poll is not
|
||||
* started.
|
||||
* but increases CPU usage.
|
||||
*/
|
||||
#ifndef GINPUT_MOUSE_POLL_PERIOD
|
||||
#define GINPUT_MOUSE_POLL_PERIOD 25
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Milliseconds separating a CLICK from a CXTCLICK.
|
||||
* @details Defaults to 700 millseconds
|
||||
* @note How long it takes for a click to turn into a CXTCLICK on a touch device.
|
||||
* @brief Maximum length of CLICK in milliseconds
|
||||
* @details Defaults to 300 millseconds
|
||||
* @note Mouse down to Mouse up times greater than this are not clicks.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_CLICK_TIME
|
||||
#define GINPUT_TOUCH_CLICK_TIME 700
|
||||
#ifndef GINPUT_MOUSE_CLICK_TIME
|
||||
#define GINPUT_MOUSE_CLICK_TIME 300
|
||||
#endif
|
||||
/**
|
||||
* @brief Milliseconds to generate a CXTCLICK on a touch device.
|
||||
* @details Defaults to 700 millseconds
|
||||
* @note If you hold the touch down for longer than this a CXTCLICK is generated
|
||||
* but only on a touch device.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_CXTCLICK_TIME
|
||||
#define GINPUT_TOUCH_CXTCLICK_TIME 700
|
||||
#endif
|
||||
/**
|
||||
* @brief There is a user supplied routine to load mouse calibration data
|
||||
* @details Defaults to FALSE
|
||||
* @note If TRUE the user must supply the @p LoadMouseCalibration() routine.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_USER_CALIBRATION_LOAD
|
||||
#define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
|
||||
#endif
|
||||
/**
|
||||
* @brief The buffer returned by the users @p LoadMouseCalibration() routine must be gfxFree()'d
|
||||
* by the mouse code.
|
||||
* @details Defaults to FALSE
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_USER_CALIBRATION_FREE
|
||||
#define GINPUT_TOUCH_USER_CALIBRATION_FREE FALSE
|
||||
#endif
|
||||
/**
|
||||
* @brief There is a user supplied routine to save mouse calibration data
|
||||
* @details Defaults to FALSE
|
||||
* @note If TRUE the user must supply the @p SaveMouseCalibration() routine.
|
||||
*/
|
||||
#ifndef GINPUT_TOUCH_USER_CALIBRATION_SAVE
|
||||
#define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
|
@ -31,6 +31,21 @@
|
||||
#undef GFX_USE_GTIMER
|
||||
#define GFX_USE_GTIMER TRUE
|
||||
#endif
|
||||
#if GINPUT_NEED_MOUSE
|
||||
#if GINPUT_TOUCH_NOTOUCH
|
||||
// No warning needed for this
|
||||
#undef GINPUT_TOUCH_NOCALIBRATE
|
||||
#define GINPUT_TOUCH_NOCALIBRATE TRUE
|
||||
#endif
|
||||
#if GINPUT_TOUCH_NOCALIBRATE
|
||||
// No warning needed for this
|
||||
#undef GINPUT_TOUCH_NOCALIBRATE_GUI
|
||||
#define GINPUT_TOUCH_NOCALIBRATE_GUI TRUE
|
||||
#endif
|
||||
#if !GINPUT_TOUCH_NOTOUCH && GINPUT_MOUSE_CLICK_TIME > GINPUT_TOUCH_CXTCLICK_TIME
|
||||
#error "GINPUT MOUSE: The GINPUT_MOUSE_CLICK_TIME must be <= GINPUT_TOUCH_CXTCLICK_TIME"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _GINPUT_RULES_H */
|
||||
|
@ -114,7 +114,7 @@ static void gwidgetEvent(void *param, GEvent *pe) {
|
||||
// Is the mouse currently captured by this widget?
|
||||
if ((h->flags & (GWIN_FLG_WIDGET|GWIN_FLG_MOUSECAPTURE)) == (GWIN_FLG_WIDGET|GWIN_FLG_MOUSECAPTURE)) {
|
||||
gh = h;
|
||||
if ((pme->last_buttons & ~pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) {
|
||||
if ((pme->buttons & GMETA_MOUSE_UP)) {
|
||||
gh->flags &= ~GWIN_FLG_MOUSECAPTURE;
|
||||
if (wvmt->MouseUp)
|
||||
wvmt->MouseUp(gw, pme->x - gh->x, pme->y - gh->y);
|
||||
@ -133,7 +133,7 @@ static void gwidgetEvent(void *param, GEvent *pe) {
|
||||
|
||||
// Process any mouse down over the highest order window if it is an enabled widget
|
||||
if (gh && (gh->flags & (GWIN_FLG_WIDGET|GWIN_FLG_SYSENABLED)) == (GWIN_FLG_WIDGET|GWIN_FLG_SYSENABLED)) {
|
||||
if ((~pme->last_buttons & pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) {
|
||||
if ((pme->buttons & GMETA_MOUSE_DOWN)) {
|
||||
gh->flags |= GWIN_FLG_MOUSECAPTURE;
|
||||
if (wvmt->MouseDown)
|
||||
wvmt->MouseDown(gw, pme->x - gh->x, pme->y - gh->y);
|
||||
@ -234,6 +234,7 @@ void _gwidgetInit(void)
|
||||
{
|
||||
geventListenerInit(&gl);
|
||||
geventRegisterCallback(&gl, gwidgetEvent, 0);
|
||||
geventAttachSource(&gl, ginputGetMouse(GMOUSE_ALL_INSTANCES), GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES);
|
||||
}
|
||||
|
||||
void _gwidgetDeinit(void)
|
||||
@ -427,13 +428,10 @@ bool_t gwinAttachListener(GListener *pl) {
|
||||
}
|
||||
|
||||
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
|
||||
bool_t gwinAttachMouse(uint16_t instance) {
|
||||
GSourceHandle gsh;
|
||||
|
||||
if (!(gsh = ginputGetMouse(instance)))
|
||||
return FALSE;
|
||||
|
||||
return geventAttachSource(&gl, gsh, GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES);
|
||||
bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance) {
|
||||
// This is now a NULL event because we automatically attach to all mice in the system.
|
||||
(void) instance;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -199,7 +199,7 @@ void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll);
|
||||
* @brief Get the current default style.
|
||||
*
|
||||
* @return The current default style.
|
||||
*
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
const GWidgetStyle *gwinGetDefaultStyle(void);
|
||||
@ -315,7 +315,7 @@ bool_t gwinAttachListener(GListener *pl);
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
bool_t gwinAttachMouse(uint16_t instance);
|
||||
bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance);
|
||||
#endif
|
||||
|
||||
#if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__)
|
||||
|
Loading…
Reference in New Issue
Block a user