diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-10-13 01:00:48 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-10-13 01:00:48 +1000 |
commit | 9d3fc8b36cb57fa23c0b838a54a8bc67328f9672 (patch) | |
tree | fee15031006a070adb49279540067e90aa6be934 /src/gwin/gwin_keyboard.c | |
parent | 92b000291826ca78c30f205c104ac330484b82c9 (diff) | |
parent | 10c7471149453cea6686aa6f61ec6dac0525c47b (diff) | |
download | uGFX-9d3fc8b36cb57fa23c0b838a54a8bc67328f9672.tar.gz uGFX-9d3fc8b36cb57fa23c0b838a54a8bc67328f9672.tar.bz2 uGFX-9d3fc8b36cb57fa23c0b838a54a8bc67328f9672.zip |
Merge branch 'master' into Keil
Diffstat (limited to 'src/gwin/gwin_keyboard.c')
-rw-r--r-- | src/gwin/gwin_keyboard.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gwin/gwin_keyboard.c b/src/gwin/gwin_keyboard.c index e9f5f860..70771d9b 100644 --- a/src/gwin/gwin_keyboard.c +++ b/src/gwin/gwin_keyboard.c @@ -30,6 +30,8 @@ typedef uint32_t utf32; // A character code - note this is not UTF-32 but a representation of the UTF-8 code stream for a single character. typedef uint32_t ucode; +static GSourceHandle AllKeyboards; + // Get the length of a UTF-8 string static int UTF8StrLen(const utf8 *s) { int len; @@ -164,6 +166,11 @@ static void SendKeyboardEventToListener(GSourceListener *psl, GKeyboardObject *g static void SendKeyboardEvent(GKeyboardObject *gk) { GSourceListener *psl; + // Send to the "All Keyboards" source listeners + psl = 0; + while ((psl = geventGetSourceListener(AllKeyboards, psl))) + SendKeyboardEventToListener(psl, gk); + // Send to the keyboard specific source listeners psl = 0; while ((psl = geventGetSourceListener((GSourceHandle)gk, psl))) @@ -313,6 +320,11 @@ static const gwidgetVMT keyboardVMT = { KeyMouseMove, // Process mouse move events }, #endif + #if GINPUT_NEED_KEYBOARD || GWIN_NEED_KEYBOARD + { + 0 // Process keyboard events + }, + #endif #if GINPUT_NEED_TOGGLE { 0, // No toggle roles @@ -339,6 +351,10 @@ GHandle gwinGKeyboardCreate(GDisplay *g, GKeyboardObject *gk, const GWidgetInit gk->keytable = &GWIN_KEYBOARD_DEFAULT_LAYOUT; gk->keyset = gk->keytable->ksets[0]; gk->lastkeyrow = gk->lastkeycol = gk->keyrow = gk->keycol = GKEY_BAD_ROWCOL; + + if (!AllKeyboards) + AllKeyboards = ginputGetKeyboard(GKEYBOARD_ALL_INSTANCES); + gwinSetVisible((GHandle)gk, pInit->g.show); return (GHandle)gk; } @@ -468,4 +484,12 @@ void gwinKeyboardDraw_Normal(GWidgetObject *gw, void *param) { #undef gk } +#if !(GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD) + GSourceHandle ginputGetKeyboard(unsigned instance) { + if (instance == GKEYBOARD_ALL_INSTANCES) + return (GSourceHandle)&AllKeyboards; + return 0; + } +#endif + #endif /* GFX_USE_GWIN && GWIN_NEED_KEYBOARD */ |