diff options
author | quou <quou@disroot.org> | 2025-01-14 21:46:01 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2025-01-14 21:46:01 +1100 |
commit | 274c2ba0eac94a00f942f7f6a78b2b9a1d0759a3 (patch) | |
tree | 3267ce089f72925f59c947989dfe1b94c0b9af2a /app.cpp | |
parent | 7e3ad9c377eacffc8d1eef677a604796c8979c1a (diff) |
text input
Diffstat (limited to 'app.cpp')
-rw-r--r-- | app.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -218,13 +218,29 @@ struct App_Internal { break; } break; - case KeyPress: + case KeyPress: { + char buf[2][32] = { "", "" }; + char* c; + int l = 0; sym = XLookupKeysym(&e.xkey, 0); key = key_from_xkey(sym); app->key_states[key] |= key_state_pressed | key_state_just_pressed; - break; + XLookupString( + &e.xkey, + buf[0], + sizeof buf[0], + 0, + 0 + ); + for (c = buf[0]; *c; c++) + if (*c >= ' ' && *c <= '~') + buf[1][l++] = *c; + buf[1][l++] = 0; + if (l) + app->on_text_input(buf[1]); + } break; case KeyRelease: sym = XLookupKeysym(&e.xkey, 0); key = key_from_xkey(sym); |