Add option GWIN_BUTTON_LAZY_RELEASE

Add option GWIN_BUTTON_LAZY_RELEASE. When set to true in gfxconf.h it
changes gwin button behaviour to not require the mouse/touch be over the
button when it is released.
ugfx_release_2.6
Andrew Hannam 2013-03-02 22:20:57 +10:00
parent 57435fb4c2
commit dddbb25930
3 changed files with 354 additions and 346 deletions

View File

@ -87,6 +87,7 @@
#define GEVENT_MAX_SOURCE_LISTENERS 32 #define GEVENT_MAX_SOURCE_LISTENERS 32
#define GTIMER_THREAD_WORKAREA_SIZE 512 #define GTIMER_THREAD_WORKAREA_SIZE 512
#define GADC_MAX_LOWSPEED_DEVICES 4 #define GADC_MAX_LOWSPEED_DEVICES 4
#define GWIN_BUTTON_LAZY_RELEASE FALSE
*/ */
/* Optional Low Level Driver Definitions */ /* Optional Low Level Driver Definitions */

View File

@ -62,9 +62,12 @@
/** /**
* @} * @}
* *
* @name GWIN Optional Sizing Parameters * @name GWIN Optional Parameters
* @{ * @{
*/ */
#ifndef GWIN_BUTTON_LAZY_RELEASE
#define GWIN_BUTTON_LAZY_RELEASE FALSE
#endif
/** @} */ /** @} */
#endif /* _GWIN_OPTIONS_H */ #endif /* _GWIN_OPTIONS_H */

View File

@ -87,12 +87,16 @@ static void gwinButtonCallback(void *param, GEvent *pe) {
gbw->state = GBTN_UP; gbw->state = GBTN_UP;
gwinButtonDraw((GHandle)param); gwinButtonDraw((GHandle)param);
// If the mouse up was over the button then create the event #if GWIN_BUTTON_LAZY_RELEASE
if (pme->x >= gbw->gwin.x && pme->x < gbw->gwin.x + gbw->gwin.width
&& pme->y >= gbw->gwin.y && pme->y < gbw->gwin.y + gbw->gwin.height)
break; break;
#else
// If the mouse up was over the button then create the event
if (pme->x >= gbw->gwin.x && pme->x < gbw->gwin.x + gbw->gwin.width
&& pme->y >= gbw->gwin.y && pme->y < gbw->gwin.y + gbw->gwin.height)
break;
return; return;
#endif
#endif #endif
#if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE #if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE