aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin/button.c
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2013-04-07 02:59:42 -0700
committerTectu <joel@unormal.org>2013-04-07 02:59:42 -0700
commit1d24b6977dd86d7fa68e5ddd451722430b371b78 (patch)
tree393c6669e4d683c84f53749e6ab189044d00f265 /src/gwin/button.c
parent05aebebb8bcaa6213076ebf5e191974bb5741d46 (diff)
parent5412fa559673f46cdec652068eaaddcbb6271779 (diff)
downloaduGFX-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.c20
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);