diff options
author | Jan Arne Petersen <jpetersen@openismus.com> | 2012-09-09 23:08:46 +0200 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-09-12 16:52:53 -0400 |
commit | c1e481efb145ef0a1fa6ecd30c2b75cddb636006 (patch) | |
tree | 70e4240eb958d7c75d6e0dd5658c14fad8ec9a3b /clients/keyboard.c | |
parent | ce8a4433f53feb2db8e9e9e0a06dda4e28156faf (diff) | |
download | weston-c1e481efb145ef0a1fa6ecd30c2b75cddb636006.tar.gz weston-c1e481efb145ef0a1fa6ecd30c2b75cddb636006.tar.bz2 weston-c1e481efb145ef0a1fa6ecd30c2b75cddb636006.zip |
text: Add reset requets to protocol
Add a reset request to the text_model interface and a reset event to the
input_method_context interface. Use it to reset the pre-edit buffers in
the example keyboard when the cursor is moved in the example editor
client.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Diffstat (limited to 'clients/keyboard.c')
-rw-r--r-- | clients/keyboard.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clients/keyboard.c b/clients/keyboard.c index 0cbf531c..c90c5b2d 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -303,8 +303,26 @@ input_method_context_surrounding_text(void *data, fprintf(stderr, "Surrounding text updated: %s\n", text); } +static void +input_method_context_reset(void *data, + struct input_method_context *context) +{ + struct virtual_keyboard *keyboard = data; + + fprintf(stderr, "Reset pre-edit buffer\n"); + + if (strlen(keyboard->preedit_string)) { + input_method_context_preedit_string(context, + "", + 0); + free(keyboard->preedit_string); + keyboard->preedit_string = strdup(""); + } +} + static const struct input_method_context_listener input_method_context_listener = { input_method_context_surrounding_text, + input_method_context_reset }; static void |