aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ginput/toggle.c14
-rw-r--r--src/gwin/button.c39
2 files changed, 24 insertions, 29 deletions
diff --git a/src/ginput/toggle.c b/src/ginput/toggle.c
index a49ebfd3..890ac1dc 100644
--- a/src/ginput/toggle.c
+++ b/src/ginput/toggle.c
@@ -34,10 +34,6 @@
#include "lld/ginput/toggle.h"
-#ifndef GINPUT_TOGGLE_POLL_PERIOD
- #define GINPUT_TOGGLE_POLL_PERIOD 250
-#endif
-
#define GINPUT_TOGGLE_ISON 0x01
#define GINPUT_TOGGLE_INVERT 0x02
@@ -157,5 +153,15 @@ bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) {
return TRUE;
}
+/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */
+void ginputToggleWakeup(void) {
+ gtimerJab(&ToggleTimer);
+}
+
+/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */
+void ginputToggleWakeupI(void) {
+ gtimerJabI(&ToggleTimer);
+}
+
#endif /* GINPUT_NEED_TOGGLE */
/** @} */
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 */
/** @} */