aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@seriouslyembedded.com>2015-08-16 01:35:46 +0200
committerJoel Bodenmann <joel@seriouslyembedded.com>2015-08-16 01:35:46 +0200
commit63c5e4949f63470bd20d2bc35a9fcc0b50795910 (patch)
treebd01024e259592ffe847774093ae6505122dfce7 /src/gwin
parentbd353d37e3db2aea609600342d8657c67ea8e44d (diff)
downloaduGFX-63c5e4949f63470bd20d2bc35a9fcc0b50795910.tar.gz
uGFX-63c5e4949f63470bd20d2bc35a9fcc0b50795910.tar.bz2
uGFX-63c5e4949f63470bd20d2bc35a9fcc0b50795910.zip
Adding KEYUP events
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/gwin_textedit.c5
-rw-r--r--src/gwin/gwin_widget.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c
index 8d242ec7..99708a0a 100644
--- a/src/gwin/gwin_textedit.c
+++ b/src/gwin/gwin_textedit.c
@@ -67,6 +67,11 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char
#if GINPUT_NEED_KEYBOARD
static void _keyboardEvent(GWidgetObject* gw, GEventKeyboard* pke)
{
+ // Only react on KEYDOWN events. Ignore KEYUP events.
+ if (pke->keystate & GKEYSTATE_KEYUP) {
+ return;
+ }
+
// Is it a special key?
if (pke->keystate & GKEYSTATE_SPECIAL) {
// Arrow keys to move the cursor
diff --git a/src/gwin/gwin_widget.c b/src/gwin/gwin_widget.c
index f135b306..84168b09 100644
--- a/src/gwin/gwin_widget.c
+++ b/src/gwin/gwin_widget.c
@@ -151,6 +151,11 @@ static void gwidgetEvent(void *param, GEvent *pe) {
// If Tab key pressed then set focus to next widget
if (pke->bytecount == 1 && pke->c[0] == GKEY_TAB) {
+ // Only react on KEYDOWN events. Ignore KEYUP events.
+ if (pke->keystate & GKEYSTATE_KEYUP) {
+ break;
+ }
+
// Get the next widget
bool_t foundWidget = FALSE;
bool_t endOfListDetected = FALSE;
@@ -323,7 +328,7 @@ void _gwidgetInit(void)
geventAttachSource(&gl, ginputGetMouse(GMOUSE_ALL_INSTANCES), GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES);
#if GINPUT_NEED_KEYBOARD
- geventAttachSource(&gl, ginputGetKeyboard(GKEYBOARD_ALL_INSTANCES), 0);
+ geventAttachSource(&gl, ginputGetKeyboard(GKEYBOARD_ALL_INSTANCES), GLISTEN_KEYUP);
#endif
}