diff options
author | Tectu <joel@unormal.org> | 2012-12-02 03:05:21 -0800 |
---|---|---|
committer | Tectu <joel@unormal.org> | 2012-12-02 03:05:21 -0800 |
commit | 24e75d96e14a668ead91797bc7cb4e7d3097b3ea (patch) | |
tree | c15ea2d56eb73f3664680ea045f7146d9ba19d2b /src/gwin/button.c | |
parent | ef13b27a790568338f3784e13c9e4a125c16222f (diff) | |
parent | 74e94d39b9b66adeaf8bcbb8789d79110102bb15 (diff) | |
download | uGFX-24e75d96e14a668ead91797bc7cb4e7d3097b3ea.tar.gz uGFX-24e75d96e14a668ead91797bc7cb4e7d3097b3ea.tar.bz2 uGFX-24e75d96e14a668ead91797bc7cb4e7d3097b3ea.zip |
Merge pull request #25 from inmarket/master
Bug fixes + new driver + extend touch demo
Diffstat (limited to 'src/gwin/button.c')
-rw-r--r-- | src/gwin/button.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/src/gwin/button.c b/src/gwin/button.c index fce82a20..4e1e45f5 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -297,34 +297,23 @@ void gwinButtonDraw(GHandle gh) { #undef gbw
}
-// Attach a source to this button. Sources recognised: Mouse, Touch and Toggle - others are ignored (returns false).
-bool_t gwinAttachButtonSource(GHandle gh, GSourceHandle gsh, GEventType type) {
- #define gbw ((GButtonObject *)gh)
- unsigned flags;
+#if defined(GINPUT_NEED_MOUSE) && GINPUT_NEED_MOUSE
+ bool_t gwinAttachButtonMouseSource(GHandle gh, GSourceHandle gsh) {
+ if (gh->type != GW_BUTTON)
+ return FALSE;
- switch (type) {
- #if defined(GINPUT_NEED_MOUSE) && GINPUT_NEED_MOUSE
- case GEVENT_MOUSE:
- flags = 0;
- break;
- #endif
- #if defined(GINPUT_NEED_TOUCH) && GINPUT_NEED_TOUCH
- case GEVENT_TOUCH:
- flags = 0;
- break;
- #endif
- #if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE
- case GEVENT_TOGGLE:
- flags = GLISTEN_TOGGLE_OFF|GLISTEN_TOGGLE_ON;
- break;
- #endif
- default:
- return FALSE;
+ return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_MOUSEMETA);
}
- return geventAttachSource(&gbw->listener, gsh, flags);
+#endif
- #undef gbw
-}
+#if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE
+ bool_t gwinAttachButtonToggleSource(GHandle gh, GSourceHandle gsh) {
+ if (gh->type != GW_BUTTON)
+ return FALSE;
+
+ return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_TOGGLE_OFF|GLISTEN_TOGGLE_ON);
+ }
+#endif
#endif /* GFX_USE_GWIN && GWIN_NEED_BUTTON */
/** @} */
|