12 #include "../../gfx.h"
14 #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
22 #define CALIBRATION_POLL_PERIOD 20
23 #define CALIBRATION_MINPRESS_PERIOD 300
24 #define CALIBRATION_MAXPRESS_PERIOD 5000
26 #ifdef GINPUT_TOUCH_CALIBRATION_FONT1
27 #define CALIBRATION_FONT1 GINPUT_TOUCH_CALIBRATION_FONT1
29 #define CALIBRATION_FONT1 "* Double"
31 #ifdef GINPUT_TOUCH_CALIBRATION_FONT2
32 #define CALIBRATION_FONT2 GINPUT_TOUCH_CALIBRATION_FONT2
34 #define CALIBRATION_FONT2 "* Narrow"
36 #define CALIBRATION_BACKGROUND GFX_BLUE
38 #define CALIBRATION_CROSS_COLOR1 GFX_WHITE
39 #define CALIBRATION_CROSS_COLOR2 RGB2COLOR(184,158,131)
40 #define CALIBRATION_CROSS_INNERGAP 2
41 #define CALIBRATION_CROSS_RADIUS 15
43 #ifdef GINPUT_TOUCH_CALIBRATION_TITLE
44 #define CALIBRATION_TITLE GINPUT_TOUCH_CALIBRATION_TITLE
46 #define CALIBRATION_TITLE "Calibration"
48 #define CALIBRATION_TITLE_Y 5
49 #define CALIBRATION_TITLE_HEIGHT 30
50 #define CALIBRATION_TITLE_COLOR GFX_WHITE
51 #define CALIBRATION_TITLE_BACKGROUND GFX_BLUE
53 #ifdef GINPUT_TOUCH_CALIBRATION_ERROR
54 #define CALIBRATION_ERROR_TEXT GINPUT_TOUCH_CALIBRATION_ERROR
56 #define CALIBRATION_ERROR_TEXT "Calibration Failed!"
58 #define CALIBRATION_ERROR_DELAY 3000
59 #define CALIBRATION_ERROR_COLOR GFX_RED
60 #define CALIBRATION_ERROR_BACKGROUND GFX_YELLOW
61 #define CALIBRATION_ERROR_Y 35
62 #define CALIBRATION_ERROR_HEIGHT 40
68 static GTIMER_DECL(MouseTimer);
71 #if !GINPUT_TOUCH_NOCALIBRATE
74 static GFXINLINE void CalibrationTransform(GMouseReading *pt,
const GMouseCalibration *c) {
77 x = (
gCoord) (c->ax * pt->x + c->bx * pt->y + c->cx);
78 y = (
gCoord) (c->ay * pt->x + c->by * pt->y + c->cy);
85 static void SendMouseEvent(GSourceListener *psl, GMouse *m, GMouseReading *r) {
91 psl->srcflags |= ((r->buttons & GMETA_MASK)|GINPUT_MISSED_MOUSE_EVENT);
96 if (!(r->buttons & GMETA_MASK) && !psl->srcflags && !(psl->listenflags & GLISTEN_MOUSENOFILTER)
97 && r->x == m->r.x && r->y == m->r.y && (r->buttons & GINPUT_MOUSE_BTN_MASK) == (m->r.buttons & GINPUT_MOUSE_BTN_MASK))
101 if (!((r->buttons & GINPUT_MOUSE_BTN_LEFT) && (psl->listenflags & GLISTEN_MOUSEDOWNMOVES))
102 && !(!(r->buttons & GINPUT_MOUSE_BTN_LEFT) && (psl->listenflags & GLISTEN_MOUSEUPMOVES))
103 && !((r->buttons & GMETA_MASK) && (psl->listenflags & GLISTEN_MOUSEMETA)))
106 #if !GINPUT_TOUCH_NOTOUCH
107 pe->type = (gmvmt(m)->d.flags & GMOUSE_VFLG_TOUCH) ? GEVENT_TOUCH : GEVENT_MOUSE;
109 pe->type = GEVENT_MOUSE;
114 pe->buttons = r->buttons | psl->srcflags;
116 pe->display = m->display;
120 static void GetMouseReading(GMouse *m) {
125 m->flags &= ~GMOUSE_FLG_NEEDREAD;
126 if (!gmvmt(m)->get(m, &r))
133 r.buttons &= GINPUT_MOUSE_BTN_MASK;
135 #if !GINPUT_TOUCH_NOTOUCH
137 if ((gmvmt(m)->d.flags & GMOUSE_VFLG_TOUCH)) {
138 if (gmvmt(m)->z_min <= gmvmt(m)->z_max) {
139 if (r.z >= gmvmt(m)->z_touchon) r.buttons |= GINPUT_MOUSE_BTN_LEFT;
140 else if (r.z <= gmvmt(m)->z_touchoff) r.buttons &= ~GINPUT_MOUSE_BTN_LEFT;
143 if (r.z <= gmvmt(m)->z_touchon) r.buttons |= GINPUT_MOUSE_BTN_LEFT;
144 else if (r.z >= gmvmt(m)->z_touchoff) r.buttons &= ~GINPUT_MOUSE_BTN_LEFT;
150 if ((gmvmt(m)->d.flags & GMOUSE_VFLG_POORUPDOWN)) {
152 if ((m->flags & GMOUSE_FLG_INDELTA)) {
153 if (!((r.buttons ^ m->r.buttons) & GINPUT_MOUSE_BTN_LEFT)) {
155 m->flags &= ~GMOUSE_FLG_INDELTA;
159 m->flags &= ~GMOUSE_FLG_INDELTA;
162 }
else if (((r.buttons ^ m->r.buttons) & GINPUT_MOUSE_BTN_LEFT)) {
163 m->flags |= GMOUSE_FLG_INDELTA;
169 #if !GINPUT_TOUCH_NOCALIBRATE_GUI
171 if ((m->flags & GMOUSE_FLG_IN_CAL)) {
172 if ((r.buttons & GINPUT_MOUSE_BTN_LEFT)) {
176 m->r.buttons = r.buttons;
185 if ((gmvmt(m)->d.flags & GMOUSE_VFLG_ONLY_DOWN) && !(r.buttons & GINPUT_MOUSE_BTN_LEFT)) {
191 #if !GINPUT_TOUCH_NOCALIBRATE
193 if ((m->flags & GMOUSE_FLG_CALIBRATE))
194 CalibrationTransform(&r, &m->caldata);
205 #if GDISP_NEED_CONTROL
207 if (!(gmvmt(m)->d.flags & GMOUSE_VFLG_SELFROTATION)) {
234 if ((m->flags & GMOUSE_FLG_CLIP)) {
235 if (r.x < 0) r.x = 0;
236 else if (r.x >= w) r.x = w-1;
237 if (r.y < 0) r.y = 0;
238 else if (r.y >= h) r.y = h-1;
245 #if !GINPUT_TOUCH_NOTOUCH
247 const GMouseJitter *pj;
251 pj = (m->flags & GMOUSE_FLG_FINGERMODE) ? &gmvmt(m)->finger_jitter : &gmvmt(m)->pen_jitter;
255 diff = (gU32)(r.x - m->r.x) * (gU32)(r.x - m->r.x) + (gU32)(r.y - m->r.y) * (gU32)(r.y - m->r.y);
256 if (diff < (gU32)pj->move * (gU32)pj->move) {
263 if (pj->click > 0 && (m->flags & GMOUSE_FLG_CLICK_TIMER)) {
264 diff = (gU32)(r.x - m->clickpos.x) * (gU32)(r.x - m->clickpos.x) + (gU32)(r.y - m->clickpos.y) * (gU32)(r.y - m->clickpos.y);
265 if (diff > (gU32)pj->click * (gU32)pj->click)
266 m->flags &= ~GMOUSE_FLG_CLICK_TIMER;
276 dnbtns = r.buttons & ~m->r.buttons;
277 upbtns = ~r.buttons & m->r.buttons;
280 if ((dnbtns & GINPUT_MOUSE_BTN_LEFT))
281 r.buttons |= GMETA_MOUSE_DOWN;
284 if ((upbtns & GINPUT_MOUSE_BTN_LEFT))
285 r.buttons |= GMETA_MOUSE_UP;
288 if ((dnbtns & (GINPUT_MOUSE_BTN_LEFT|GINPUT_MOUSE_BTN_RIGHT))) {
292 m->flags |= GMOUSE_FLG_CLICK_TIMER;
296 if ((upbtns & (GINPUT_MOUSE_BTN_LEFT|GINPUT_MOUSE_BTN_RIGHT)) && (m->flags & GMOUSE_FLG_CLICK_TIMER)) {
297 m->flags &= ~GMOUSE_FLG_CLICK_TIMER;
302 if ((upbtns & GINPUT_MOUSE_BTN_RIGHT))
303 r.buttons |= GMETA_MOUSE_CXTCLICK;
304 if ((upbtns & GINPUT_MOUSE_BTN_LEFT))
305 r.buttons |= GMETA_MOUSE_CLICK;
308 #if !GINPUT_TOUCH_NOTOUCH
311 r.buttons |= GMETA_MOUSE_CXTCLICK;
318 GSourceListener *psl;
323 SendMouseEvent(psl, m, &r);
328 SendMouseEvent(psl, m, &r);
335 m->r.buttons = r.buttons;
338 static void MousePoll(
void *param) {
343 if (!(gmvmt(m)->d.flags & GMOUSE_VFLG_NOPOLL) || (m->flags & GMOUSE_FLG_NEEDREAD))
349 #if !GINPUT_TOUCH_NOCALIBRATE_GUI
350 #if !defined(GFX_USE_GDISP) || !GFX_USE_GDISP
351 #error "GINPUT: GFX_USE_GDISP must be defined when calibration is required"
354 static GFXINLINE void CalibrationCrossDraw(GMouse *m,
const gPoint *pp) {
355 gdispGDrawLine(m->display, pp->
x-CALIBRATION_CROSS_RADIUS, pp->
y, pp->
x-CALIBRATION_CROSS_INNERGAP, pp->
y, CALIBRATION_CROSS_COLOR1);
356 gdispGDrawLine(m->display, pp->
x+CALIBRATION_CROSS_INNERGAP, pp->
y, pp->
x+CALIBRATION_CROSS_RADIUS, pp->
y, CALIBRATION_CROSS_COLOR1);
357 gdispGDrawLine(m->display, pp->
x, pp->
y-CALIBRATION_CROSS_RADIUS, pp->
x, pp->
y-CALIBRATION_CROSS_INNERGAP, CALIBRATION_CROSS_COLOR1);
358 gdispGDrawLine(m->display, pp->
x, pp->
y+CALIBRATION_CROSS_INNERGAP, pp->
x, pp->
y+CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR1);
359 gdispGDrawLine(m->display, pp->
x-CALIBRATION_CROSS_RADIUS, pp->
y+CALIBRATION_CROSS_RADIUS, pp->
x-CALIBRATION_CROSS_RADIUS/2, pp->
y+CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR2);
360 gdispGDrawLine(m->display, pp->
x-CALIBRATION_CROSS_RADIUS, pp->
y+CALIBRATION_CROSS_RADIUS/2, pp->
x-CALIBRATION_CROSS_RADIUS, pp->
y+CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR2);
361 gdispGDrawLine(m->display, pp->
x-CALIBRATION_CROSS_RADIUS, pp->
y-CALIBRATION_CROSS_RADIUS, pp->
x-CALIBRATION_CROSS_RADIUS/2, pp->
y-CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR2);
362 gdispGDrawLine(m->display, pp->
x-CALIBRATION_CROSS_RADIUS, pp->
y-CALIBRATION_CROSS_RADIUS/2, pp->
x-CALIBRATION_CROSS_RADIUS, pp->
y-CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR2);
363 gdispGDrawLine(m->display, pp->
x+CALIBRATION_CROSS_RADIUS/2, pp->
y+CALIBRATION_CROSS_RADIUS, pp->
x+CALIBRATION_CROSS_RADIUS, pp->
y+CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR2);
364 gdispGDrawLine(m->display, pp->
x+CALIBRATION_CROSS_RADIUS, pp->
y+CALIBRATION_CROSS_RADIUS/2, pp->
x+CALIBRATION_CROSS_RADIUS, pp->
y+CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR2);
365 gdispGDrawLine(m->display, pp->
x+CALIBRATION_CROSS_RADIUS/2, pp->
y-CALIBRATION_CROSS_RADIUS, pp->
x+CALIBRATION_CROSS_RADIUS, pp->
y-CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_COLOR2);
366 gdispGDrawLine(m->display, pp->
x+CALIBRATION_CROSS_RADIUS, pp->
y-CALIBRATION_CROSS_RADIUS, pp->
x+CALIBRATION_CROSS_RADIUS, pp->
y-CALIBRATION_CROSS_RADIUS/2, CALIBRATION_CROSS_COLOR2);
369 static GFXINLINE void CalibrationCrossClear(GMouse *m,
const gPoint *pp) {
370 gdispGFillArea(m->display, pp->
x - CALIBRATION_CROSS_RADIUS, pp->
y - CALIBRATION_CROSS_RADIUS, CALIBRATION_CROSS_RADIUS*2+1, CALIBRATION_CROSS_RADIUS*2+1, CALIBRATION_BACKGROUND);
383 #if GDISP_NEED_CONTROL
384 if (!(gmvmt(m)->d.flags & GMOUSE_VFLG_SELFROTATION)) {
413 dx = (float)(points[0].x - points[2].x) * (float)(points[1].y - points[2].y)
414 - (float)(points[1].x - points[2].x) * (float)(points[0].y - points[2].y);
416 m->caldata.ax = ((float)(c0 - c2) * (float)(points[1].y - points[2].y)
417 - (float)(c1 - c2) * (float)(points[0].y - points[2].y)) / dx;
418 m->caldata.bx = ((float)(c1 - c2) * (float)(points[0].x - points[2].x)
419 - (float)(c0 - c2) * (float)(points[1].x - points[2].x)) / dx;
420 m->caldata.cx = (c0 * ((float)points[1].x * (
float)points[2].
y - (float)points[2].x * (
float)points[1].
y)
421 - c1 * ((
float)points[0].
x * (float)points[2].y - (
float)points[2].
x * (float)points[0].y)
422 + c2 * ((float)points[0].x * (
float)points[1].
y - (float)points[1].x * (
float)points[0].
y)) / dx;
429 #if GDISP_NEED_CONTROL
430 if (!(gmvmt(m)->d.flags & GMOUSE_VFLG_SELFROTATION)) {
455 m->caldata.ay = ((float)(c0 - c2) * (float)(points[1].y - points[2].y)
456 - (float)(c1 - c2) * (float)(points[0].y - points[2].y)) / dx;
457 m->caldata.by = ((float)(c1 - c2) * (float)(points[0].x - points[2].x)
458 - (float)(c0 - c2) * (float)(points[1].x - points[2].x)) / dx;
459 m->caldata.cy = (c0 * ((float)points[1].x * (
float)points[2].
y - (float)points[2].x * (
float)points[1].
y)
460 - c1 * ((
float)points[0].
x * (float)points[2].y - (
float)points[2].
x * (float)points[0].y)
461 + c2 * ((float)points[0].x * (
float)points[1].
y - (float)points[1].x * (
float)points[0].
y)) / dx;
464 static gU32 CalibrateMouse(GMouse *m) {
487 m->flags |= GMOUSE_FLG_IN_CAL;
490 if ((gmvmt(m)->d.flags & GMOUSE_VFLG_CAL_EXTREMES)) {
491 cross[0].
x = 0; cross[0].
y = 0;
492 cross[1].
x = w-1; cross[1].
y = 0;
493 cross[2].
x = w-1; cross[2].
y = h-1;
494 cross[3].
x = w/2; cross[3].
y = h/2;
496 cross[0].
x = w/4; cross[0].
y = h/4;
497 cross[1].
x = w-w/4; cross[1].
y = h/4;
498 cross[2].
x = w-w/4; cross[2].
y = h-h/4;
499 cross[3].
x = w/2; cross[3].
y = h/2;
506 0, CALIBRATION_TITLE_Y, w, CALIBRATION_TITLE_HEIGHT,
507 CALIBRATION_TITLE, font1, CALIBRATION_TITLE_COLOR, CALIBRATION_TITLE_BACKGROUND,
513 unsigned i, maxpoints;
515 maxpoints = (gmvmt(m)->d.flags & GMOUSE_VFLG_CAL_TEST) ? 4 : 3;
518 for(i = 0; i < maxpoints; i++) {
523 CalibrationCrossDraw(m, &cross[i]);
528 while(!(m->r.buttons & GINPUT_MOUSE_BTN_LEFT))
533 while((m->r.buttons & GINPUT_MOUSE_BTN_LEFT)) {
535 if (j < CALIBRATION_MAXPRESS_PERIOD/CALIBRATION_POLL_PERIOD) {
544 }
while(j < CALIBRATION_MINPRESS_PERIOD/CALIBRATION_POLL_PERIOD);
545 points[i].
x = px / j;
546 points[i].
y = py / j;
549 CalibrationCrossClear(m, &cross[i]);
554 CalibrationCalculate(m, cross, points);
561 if ((gmvmt(m)->d.flags & GMOUSE_VFLG_CAL_TEST)) {
562 const GMouseJitter *pj;
565 pj = (m->flags & GMOUSE_FLG_FINGERMODE) ? &gmvmt(m)->finger_jitter : &gmvmt(m)->pen_jitter;
568 CalibrationTransform((GMouseReading *)&points[3], &m->caldata);
571 #if GDISP_NEED_CONTROL
572 if (!(gmvmt(m)->d.flags & GMOUSE_VFLG_SELFROTATION)) {
580 points[3].
x = w - 1 - points[3].
y;
584 points[3].
x = w - 1 - points[3].
x;
585 points[3].
y = h - 1 - points[3].
y;
589 points[3].
y = h - 1 - points[3].
x;
599 err = (points[3].
x - cross[3].
x) * (points[3].x - cross[3].x) + (points[3].
y - cross[3].
y) * (points[3].y - cross[3].y);
600 if (err > (gU32)pj->calibrate * (gU32)pj->calibrate) {
604 0, CALIBRATION_ERROR_Y, w, CALIBRATION_ERROR_HEIGHT,
605 CALIBRATION_ERROR_TEXT, font2, CALIBRATION_ERROR_COLOR, CALIBRATION_ERROR_BACKGROUND,
618 m->flags &= ~GMOUSE_FLG_IN_CAL;
619 m->flags |= GMOUSE_FLG_CLIP;
623 m->flags |= GMOUSE_FLG_CALIBRATE;
625 #if GINPUT_TOUCH_USER_CALIBRATION_SAVE
628 if (gmvmt(m)->calsave)
629 gmvmt(m)->calsave(m, &m->caldata,
sizeof(GMouseCalibration));
647 void _gmouseInit(
void) {
649 #if defined(GINPUT_MOUSE_DRIVER_LIST)
652 typedef const GMouseVMT
const GMOUSEVMTLIST[1];
654 extern GMOUSEVMTLIST GINPUT_MOUSE_DRIVER_LIST;
655 static const GMouseVMT *
const dclist[] = {GINPUT_MOUSE_DRIVER_LIST};
657 for(i = 0; i <
sizeof(dclist)/
sizeof(dclist[0]); i++) {
658 if (!(dclist[i]->d.flags & GMOUSE_VFLG_DYNAMICONLY))
670 extern const GMouseVMT GMOUSEVMT_OnlyOne[1];
672 if (!(GMOUSEVMT_OnlyOne->d.flags & GMOUSE_VFLG_DYNAMICONLY))
679 void _gmouseDeinit(
void) {
683 gBool _gmouseInitDriver(
GDriver *g,
void *display,
unsigned driverinstance,
unsigned systeminstance) {
684 #define m ((GMouse *)g)
685 (void) systeminstance;
688 m->display = display;
690 #if !GINPUT_TOUCH_NOTOUCH
692 if ((gmvmt(m)->d.flags & GMOUSE_VFLG_DEFAULTFINGER))
693 m->flags |= GMOUSE_FLG_FINGERMODE;
697 if (!gmvmt(m)->init((GMouse *)g, driverinstance))
709 void _gmousePostInitDriver(
GDriver *g) {
710 #define m ((GMouse *)g)
712 #if !GINPUT_TOUCH_STARTRAW
713 m->flags |= GMOUSE_FLG_CLIP;
716 #if !GINPUT_TOUCH_NOCALIBRATE && !GINPUT_TOUCH_STARTRAW
717 if ((gmvmt(m)->d.flags & GMOUSE_VFLG_CALIBRATE)) {
718 #if GINPUT_TOUCH_USER_CALIBRATION_LOAD
720 m->flags |= GMOUSE_FLG_CALIBRATE;
723 if (gmvmt(m)->calload && gmvmt(m)->calload(m, &m->caldata,
sizeof(GMouseCalibration)))
724 m->flags |= GMOUSE_FLG_CALIBRATE;
725 #if !GINPUT_TOUCH_NOCALIBRATE_GUI
727 while (CalibrateMouse(m));
738 void _gmouseDeInitDriver(
GDriver *g) {
743 if (instance == GMOUSE_ALL_INSTANCES)
744 return (GSourceHandle)&MouseTimer;
754 m->display = g ? g :
GDISP;
776 #if !GINPUT_TOUCH_NOCALIBRATE_GUI
777 if ((m->flags & GMOUSE_FLG_IN_CAL))
781 #if !GINPUT_TOUCH_NOTOUCH
782 pe->type = (gmvmt(m)->d.flags & GMOUSE_VFLG_TOUCH) ? GEVENT_TOUCH : GEVENT_MOUSE;
784 pe->type = GEVENT_MOUSE;
789 pe->buttons = m->r.buttons;
790 pe->display = m->display;
794 #if !GINPUT_TOUCH_NOTOUCH
802 m->flags |= GMOUSE_FLG_FINGERMODE;
804 m->flags &= ~GMOUSE_FLG_FINGERMODE;
809 #if !GINPUT_TOUCH_NOCALIBRATE_GUI
818 if (!(gmvmt(m)->d.flags & GMOUSE_VFLG_CALIBRATE))
821 return CalibrateMouse(m);
826 void _gmouseWakeup(GMouse *m) {
828 m->flags |= GMOUSE_FLG_NEEDREAD;
833 void _gmouseWakeupI(GMouse *m) {
835 m->flags |= GMOUSE_FLG_NEEDREAD;
gFont gdispOpenFont(const char *name)
Find a font and return it.
void gdispGClear(GDisplay *g, gColor color)
Clear the display to the specified color.
void gdispGSetClip(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy)
Clip all drawing to the defined area.
GDisplay * GDISP
The default screen to use for the gdispXXXX calls.
void gdispCloseFont(gFont font)
Release a font after use.
const struct mf_font_s * gFont
The type of a font.
gOrientation gdispGGetOrientation(GDisplay *g)
Get the current display orientation.
gCoord gdispGGetWidth(GDisplay *g)
Get the display width in pixels.
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Fill an area with a color.
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color)
Draw a line.
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gColor bgColor, gJustify justify)
Draw a text string vertically centered within the specified box. The box background is filled with th...
#define GDISP_STARTUP_COLOR
Define the initial background color for all displays in the system.
gCoord gdispGGetHeight(GDisplay *g)
Get the display height in pixels.
gI16 gCoord
The type for a coordinate or length on the screen.
GDriver * gdriverRegister(const GDriverVMT *vmt, void *param)
Register a new driver instance.
GDriver * gdriverGetInstance(gU16 type, unsigned instance)
Get the driver for a particular instance of a type of device.
GDriver * gdriverGetNext(gU16 type, GDriver *driver)
Get the next driver for a type of device.
unsigned gdriverGetDriverInstanceNumber(GDriver *driver)
Get the instance number for a device.
GEvent * geventGetEventBuffer(GSourceListener *psl)
Get the event buffer from the GSourceListener.
void geventSendEvent(GSourceListener *psl)
Called by a source to indicate the listener's event buffer has been filled.
GSourceListener * geventGetSourceListener(GSourceHandle gsh, GSourceListener *lastlr)
Called by a source with a possible event to get a listener record.
#define GFXINLINE
Mark a function as inline.
#define GINPUT_TOUCH_CXTCLICK_TIME
Milliseconds to generate a CXTCLICK on a touch device.
#define GINPUT_MOUSE_CLICK_TIME
Maximum length of CLICK in milliseconds.
#define GINPUT_MOUSE_POLL_PERIOD
Milliseconds between mouse polls.
gTicks gfxSystemTicks(void)
Get the current operating system tick time.
gTicks gfxMillisecondsToTicks(gDelay ms)
Convert a given number of millseconds to a number of operating system ticks.
void gfxSleepMilliseconds(gDelay ms)
Put the current thread to sleep for the specified period in milliseconds.
void gtimerJabI(GTimer *pt)
Jab a timer causing the current period to immediate expire.
void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, gDelay millisec)
Set a timer going or alter its properties if it is already going.
void gtimerDeinit(GTimer *pt)
Deinitialise a timer.
gBool gtimerIsActive(GTimer *pt)
Test if a timer is currently active.
void gtimerJab(GTimer *pt)
Jab a timer causing the current period to immediate expire.
GDisplay * ginputGetMouseDisplay(unsigned instance)
Get the display currently associated with the mouse.
gBool ginputGetMouseStatus(unsigned instance, GEventMouse *pmouse)
Get the current mouse position and button status.
gBool SaveMouseCalibration(unsigned instance, const void *data, gMemSize sz)
Save a set of mouse calibration data.
void ginputSetMouseDisplay(unsigned instance, GDisplay *g)
Assign the display associated with the mouse.
gBool LoadMouseCalibration(unsigned instance, void *data, gMemSize sz)
Load a set of mouse calibration data.
GSourceHandle ginputGetMouse(unsigned instance)
Get the Source handler for a mouse using the instance number.
void ginputSetFingerMode(unsigned instance, gBool on)
Should this device be in Pen mode or Finger mode.
gU32 ginputCalibrateMouse(unsigned instance)
Performs a calibration.
gColor gwinGetDefaultBgColor(void)
Get the default background color for all new GWIN windows.
All runtime driver structures start with this structure.
Type for a 2D point on the screen.