diff options
author | Tectu <joel@unormal.org> | 2013-04-07 02:59:42 -0700 |
---|---|---|
committer | Tectu <joel@unormal.org> | 2013-04-07 02:59:42 -0700 |
commit | 1d24b6977dd86d7fa68e5ddd451722430b371b78 (patch) | |
tree | 393c6669e4d683c84f53749e6ab189044d00f265 /src/gwin/button.c | |
parent | 05aebebb8bcaa6213076ebf5e191974bb5741d46 (diff) | |
parent | 5412fa559673f46cdec652068eaaddcbb6271779 (diff) | |
download | uGFX-1d24b6977dd86d7fa68e5ddd451722430b371b78.tar.gz uGFX-1d24b6977dd86d7fa68e5ddd451722430b371b78.tar.bz2 uGFX-1d24b6977dd86d7fa68e5ddd451722430b371b78.zip |
Merge pull request #63 from inmarket/master
GINPUT Dial. Simplify input -> GWIN widget assignment
Diffstat (limited to 'src/gwin/button.c')
-rw-r--r-- | src/gwin/button.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gwin/button.c b/src/gwin/button.c index bec738b4..74fe3080 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -68,7 +68,7 @@ static void gwinButtonCallback(void *param, GEvent *pe) { #define pbe ((GEventGWinButton *)pe) switch (pe->type) { - #if defined(GINPUT_NEED_MOUSE) && GINPUT_NEED_MOUSE + #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE case GEVENT_MOUSE: case GEVENT_TOUCH: // Ignore anything other than the primary mouse button going up or down @@ -108,7 +108,7 @@ static void gwinButtonCallback(void *param, GEvent *pe) { #endif #endif - #if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE + #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE case GEVENT_TOGGLE: // State has changed - update the button gbw->state = pxe->on ? GBTN_DOWN : GBTN_UP; @@ -375,18 +375,22 @@ void gwinButtonDraw_Square(GHandle gh, bool_t isdown, const char *txt, const GBu } #endif -#if defined(GINPUT_NEED_MOUSE) && GINPUT_NEED_MOUSE - bool_t gwinAttachButtonMouseSource(GHandle gh, GSourceHandle gsh) { - if (gh->type != GW_BUTTON) +#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE + bool_t gwinAttachButtonMouse(GHandle gh, uint16_t instance) { + GSourceHandle gsh; + + if (gh->type != GW_BUTTON || !(gsh = ginputGetMouse(instance))) return FALSE; return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_MOUSEMETA); } #endif -#if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE - bool_t gwinAttachButtonToggleSource(GHandle gh, GSourceHandle gsh) { - if (gh->type != GW_BUTTON) +#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE + bool_t gwinAttachButtonToggle(GHandle gh, uint16_t instance) { + GSourceHandle gsh; + + if (gh->type != GW_BUTTON || !(gsh = ginputGetToggle(instance))) return FALSE; return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_TOGGLE_OFF|GLISTEN_TOGGLE_ON); |