GINPUT mouse updated - first working version of newmouse.

Note: drivers to be ported.
Note: not tested well yet.
ugfx_release_2.6
inmarket 2014-09-26 16:32:00 +10:00
parent e7bc175ca0
commit 174e60c76d
3 changed files with 28 additions and 22 deletions

View File

@ -115,7 +115,7 @@ extern "C" {
* @notapi
* @{
*/
bool_t _gmouseInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance);
bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance);
void _gmousePostInitDriver(GDriver *g);
void _gmouseDeInitDriver(GDriver *g);
/** @} */

View File

@ -13,6 +13,11 @@
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
// Just to make code easier
#if !GFX_USE_GDISP
#define GDISP 0
#endif
// Local Settings
#define CALIBRATION_POLL_PERIOD 20 // milliseconds
#define CALIBRATION_MINPRESS_PERIOD 300 // milliseconds
@ -618,7 +623,7 @@ void _gmouseInit(void) {
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
if (!(dclist[i]->flags & GMOUSE_VFLG_DYNAMICONLY))
gdriverRegister(dclist[i]);
gdriverRegister(dclist[i], GDISP);
}
}
@ -628,7 +633,7 @@ void _gmouseInit(void) {
extern GDriverVMTList GMOUSEVMT_OnlyOne;
if (!(GMOUSEVMT_OnlyOne->flags & GMOUSE_VFLG_DYNAMICONLY))
gdriverRegister(GMOUSEVMT_OnlyOne);
gdriverRegister(GMOUSEVMT_OnlyOne, GDISP);
}
#endif
@ -638,20 +643,23 @@ void _gmouseDeinit(void) {
gtimerDeinit(&MouseTimer);
}
bool_t _gmouseInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance) {
bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance) {
#define m ((GMouse *)g)
(void) systeminstance;
// The initial display is passed in the parameter for mice
m->display = display;
#if !GINPUT_TOUCH_NOTOUCH
// Should this mouse start in finger mode? (according to the VMT)
if ((gmvmt(m)->d.flags & GMOUSE_VFLG_DEFAULTFINGER))
m->flags |= GMOUSE_FLG_FINGERMODE;
#endif
// Init the mouse
if (!gmvmt(m)->init((GMouse *)g, driverinstance))
return FALSE;
#if !GINPUT_TOUCH_NOTOUCH
// Should this mouse start in finger mode?
if ((gmvmt(m)->d.flags & GMOUSE_VFLG_DEFAULTFINGER))
m->flags |= GMOUSE_FLG_FINGERMODE;
#endif
// Ensure the Poll timer is started
if (!gtimerIsActive(&MouseTimer))
gtimerStart(&MouseTimer, MousePoll, 0, TRUE, GINPUT_MOUSE_POLL_PERIOD);
@ -664,10 +672,6 @@ bool_t _gmouseInitDriver(GDriver *g, unsigned driverinstance, unsigned systemins
void _gmousePostInitDriver(GDriver *g) {
#define m ((GMouse *)g)
// Make sure we have a valid mouse display
if (!m->display)
m->display = GDISP;
#if !GINPUT_TOUCH_NOCALIBRATE && !GINPUT_TOUCH_STARTRAW
if ((gmvmt(m)->d.flags & GMOUSE_VFLG_CALIBRATE)) {
GMouseCalibration *pc;
@ -784,14 +788,16 @@ bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) {
#endif
/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */
void ginputMouseWakeup(GMouse *m) {
m->flags |= GMOUSE_FLG_NEEDREAD;
void _gmouseWakeup(GMouse *m) {
if (m)
m->flags |= GMOUSE_FLG_NEEDREAD;
gtimerJab(&MouseTimer);
}
/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */
void ginputMouseWakeupI(GMouse *m) {
m->flags |= GMOUSE_FLG_NEEDREAD;
void _gmouseWakeupI(GMouse *m) {
if (m)
m->flags |= GMOUSE_FLG_NEEDREAD;
gtimerJabI(&MouseTimer);
}

View File

@ -46,10 +46,10 @@ typedef struct GEventMouse_t {
#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 GMETA_MOUSE_DOWN 0x0010 // Left mouse/touch has just gone down
#define GMETA_MOUSE_UP 0x0020 // Left mouse/touch has just gone up
#define GMETA_MOUSE_CLICK 0x0040 // Left mouse/touch has just gone through a click (short down - up cycle)
#define GMETA_MOUSE_CXTCLICK 0x0080 // 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