diff options
author | inmarket <inmarket@ugfx.org> | 2016-08-24 17:48:41 +1000 |
---|---|---|
committer | inmarket <inmarket@ugfx.org> | 2016-08-24 17:48:41 +1000 |
commit | 8603afd3098b5fdb640cb214bda209137fe192ee (patch) | |
tree | fade878ced28b4c4e93e8894a5886658067d71fc /src/gwin/gwin_button.c | |
parent | ea0419c29bc4aed1b60662d781d94382dcb8e336 (diff) | |
download | uGFX-8603afd3098b5fdb640cb214bda209137fe192ee.tar.gz uGFX-8603afd3098b5fdb640cb214bda209137fe192ee.tar.bz2 uGFX-8603afd3098b5fdb640cb214bda209137fe192ee.zip |
Fix keyboard handling for gwin checkbox and button
Diffstat (limited to 'src/gwin/gwin_button.c')
-rw-r--r-- | src/gwin/gwin_button.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gwin/gwin_button.c b/src/gwin/gwin_button.c index 41c736e6..f4be41a1 100644 --- a/src/gwin/gwin_button.c +++ b/src/gwin/gwin_button.c @@ -53,15 +53,15 @@ // ENTER and SPACE keys to press the button if (pke->c[0] == GKEY_ENTER || pke->c[0] == GKEY_SPACE) { - // Press or release event? - if (pke->keystate & GKEYSTATE_KEYUP) { - gw->g.flags &= ~GBUTTON_FLG_PRESSED; - } else { - gw->g.flags |= GBUTTON_FLG_PRESSED; - } + // Some keyboards (eg the virtual keyboard) can't send keyup events. + // Even for those that do we may not be listening for them. + // We should really process on a keydown and then set a timer to display + // the button release but that requires an extra timer and lots of + // complication. Instead we cheat by not providing user feedback of the keypress. + if (!(pke->keystate & GKEYSTATE_KEYUP)) + _gwinSendEvent(&gw->g, GEVENT_GWIN_BUTTON); } - _gwinUpdate((GHandle)gw); } #endif |