Allow a mouse driver to not return any results when it is polled.
This commit is contained in:
parent
f552ba62af
commit
bd041926b4
@ -57,7 +57,7 @@ static bool_t init_board(GMouse *m, unsigned driverinstance) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||
(void) m;
|
||||
|
||||
@ -89,6 +89,7 @@ static void read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
palClearPad(GPIOB, GPIOB_DRIVEA);
|
||||
palClearPad(GPIOB, GPIOB_DRIVEB);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* _LLD_GMOUSE_MCU_BOARD_H */
|
||||
|
@ -73,7 +73,7 @@ static bool_t init_board(GMouse *m, unsigned driverinstance) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
static bool_t read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||
uint16_t val1, val2;
|
||||
(void) m;
|
||||
@ -130,6 +130,7 @@ static void read_xyz(GMouse *m, GMouseReading *prd) {
|
||||
// Set up for reading z again. We know it will be 20ms before we get called again so don't worry about settling time
|
||||
setup_z();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* _LLD_GMOUSE_MCU_BOARD_H */
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define CMD_Y 0x91
|
||||
#define CMD_ENABLE_IRQ 0x80
|
||||
|
||||
static void MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||
static bool_t MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||
{
|
||||
(void)m;
|
||||
|
||||
@ -42,6 +42,7 @@ static void MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||
|
||||
release_bus(m);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||
|
@ -56,7 +56,7 @@ static bool_t MouseInit(GMouse* m, unsigned driverinstance) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||
static bool_t MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||
{
|
||||
// Assume not touched.
|
||||
pdr->buttons = 0;
|
||||
@ -80,6 +80,7 @@ static void MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||
}
|
||||
|
||||
release_bus(m);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||
|
@ -69,7 +69,7 @@
|
||||
|
||||
// Forward definitions
|
||||
static bool_t Win32MouseInit(GMouse *m, unsigned driverinstance);
|
||||
static void Win32MouseRead(GMouse *m, GMouseReading *prd);
|
||||
static bool_t Win32MouseRead(GMouse *m, GMouseReading *prd);
|
||||
|
||||
const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||
{
|
||||
@ -1169,7 +1169,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
(void) driverinstance;
|
||||
return TRUE;
|
||||
}
|
||||
static void Win32MouseRead(GMouse *m, GMouseReading *pt) {
|
||||
static bool_t Win32MouseRead(GMouse *m, GMouseReading *pt) {
|
||||
GDisplay * g;
|
||||
winPriv * priv;
|
||||
|
||||
@ -1207,6 +1207,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* GINPUT_NEED_MOUSE */
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
// Forward definitions
|
||||
static bool_t XMouseInit(GMouse *m, unsigned driverinstance);
|
||||
static void XMouseRead(GMouse *m, GMouseReading *prd);
|
||||
static bool_t XMouseRead(GMouse *m, GMouseReading *prd);
|
||||
|
||||
const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||
{
|
||||
@ -364,7 +364,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
|
||||
(void) driverinstance;
|
||||
return TRUE;
|
||||
}
|
||||
static void XMouseRead(GMouse *m, GMouseReading *pt) {
|
||||
static bool_t XMouseRead(GMouse *m, GMouseReading *pt) {
|
||||
xPriv * priv;
|
||||
|
||||
priv = m->display->priv;
|
||||
@ -372,6 +372,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
|
||||
pt->y = priv->mousey;
|
||||
pt->z = (priv->buttons & GINPUT_MOUSE_BTN_LEFT) ? 1 : 0;
|
||||
pt->buttons = priv->buttons;
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* GINPUT_NEED_MOUSE */
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
// Forward definitions
|
||||
static bool_t NMouseInit(GMouse *m, unsigned driverinstance);
|
||||
static void NMouseRead(GMouse *m, GMouseReading *prd);
|
||||
static bool_t NMouseRead(GMouse *m, GMouseReading *prd);
|
||||
|
||||
const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||
{
|
||||
@ -710,7 +710,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
(void) driverinstance;
|
||||
return TRUE;
|
||||
}
|
||||
static void NMouseRead(GMouse *m, GMouseReading *pt) {
|
||||
static bool_t NMouseRead(GMouse *m, GMouseReading *pt) {
|
||||
GDisplay * g;
|
||||
netPriv * priv;
|
||||
|
||||
@ -721,6 +721,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
pt->y = priv->mousey;
|
||||
pt->z = (priv->mousebuttons & GINPUT_MOUSE_BTN_LEFT) ? 1 : 0;
|
||||
pt->buttons = priv->mousebuttons;
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* GINPUT_NEED_MOUSE */
|
||||
|
||||
|
@ -86,10 +86,10 @@ typedef struct GMouseVMT {
|
||||
GMouseJitter pen_jitter; // PEN MODE: Jitter settings
|
||||
GMouseJitter finger_jitter; // FINGER MODE: Jitter settings
|
||||
|
||||
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
|
||||
bool_t (*init)(GMouse *m, unsigned driverinstance); // Required
|
||||
void (*deinit)(GMouse *m); // Optional
|
||||
bool_t (*get)(GMouse *m, GMouseReading *prd); // Required
|
||||
void (*calsave)(GMouse *m, void *buf, size_t sz); // Optional
|
||||
const char *(*calload)(GMouse *m, size_t sz); // Optional: Can return NULL if no data is saved.
|
||||
} GMouseVMT;
|
||||
|
||||
|
@ -78,7 +78,7 @@ static void SendMouseEvent(GSourceListener *psl, GMouse *m, GMouseReading *r) {
|
||||
|
||||
// Send the event only if we are listening for it
|
||||
if (!((r->buttons & GINPUT_MOUSE_BTN_LEFT) && (psl->listenflags & GLISTEN_MOUSEDOWNMOVES))
|
||||
&& !((r->buttons & GINPUT_MOUSE_BTN_LEFT) && (psl->listenflags & GLISTEN_MOUSEUPMOVES))
|
||||
&& !(!(r->buttons & GINPUT_MOUSE_BTN_LEFT) && (psl->listenflags & GLISTEN_MOUSEUPMOVES))
|
||||
&& !((r->buttons & GMETA_MASK) && (psl->listenflags & GLISTEN_MOUSEMETA)))
|
||||
return;
|
||||
|
||||
@ -102,7 +102,8 @@ static void GetMouseReading(GMouse *m) {
|
||||
// Step 1 - Get the Raw Reading
|
||||
{
|
||||
m->flags &= ~GMOUSE_FLG_NEEDREAD;
|
||||
gmvmt(m)->get(m, &r);
|
||||
if (!gmvmt(m)->get(m, &r))
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 2 - Handle touch and button 0 debouncing
|
||||
|
Loading…
Reference in New Issue
Block a user