diff options
author | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2020-04-09 10:44:45 +0200 |
---|---|---|
committer | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2020-04-09 10:44:45 +0200 |
commit | 655d7787133c0245a4d11219c7b1e123ea6f815c (patch) | |
tree | 46f718a79beac3fcb93778d3205efa0fa57eb7eb | |
parent | 917a0320c3d555e1995735fb11f8c64d81197b43 (diff) | |
download | nuk.lv2-655d7787133c0245a4d11219c7b1e123ea6f815c.tar.xz |
Squashed 'subprojects/nk_pugl/' changes from 655ae5d..fc44246
fc44246 fix shortcut keys.
git-subtree-dir: subprojects/nk_pugl
git-subtree-split: fc44246af37f21926dc7bf63c9a853a59d0f07dd
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | nk_pugl/nk_pugl.h | 15 |
2 files changed, 10 insertions, 7 deletions
@@ -1 +1 @@ -0.1.131 +0.1.133 diff --git a/nk_pugl/nk_pugl.h b/nk_pugl/nk_pugl.h index 52e0ee0..7f543ba 100644 --- a/nk_pugl/nk_pugl.h +++ b/nk_pugl/nk_pugl.h @@ -915,10 +915,14 @@ _nk_pugl_event_func(PuglView *view, const PuglEvent *e) { const PuglEventText *ev = (const PuglEventText *)e; - if(isprint(ev->character)) + const bool control = ev->state & PUGL_MOD_CTRL; + + const int ch = control ? ev->character | 0x60 : ev->character; + + if(isprint(ch)) { _nk_pugl_key_press(ctx, NK_KEY_TEXT_INSERT_MODE); - nk_input_unicode(ctx, ev->character); + nk_input_unicode(ctx, ch); } } break; @@ -1368,13 +1372,12 @@ nk_pugl_is_shortcut_pressed(struct nk_input *in, char letter, bool clear) if(control && (in->keyboard.text_len == 1) ) { - // unescape ASCII control chars + Control - const char ch = in->keyboard.text[0] | 0x60; - - if(isalpha(ch) && (ch == letter) ) // pass non-alpha characters through + if(in->keyboard.text[0] == letter) { if(clear) + { in->keyboard.text_len = 0; + } return true; // matching shortcut } |