summaryrefslogtreecommitdiff
path: root/clients/keyboard.c
diff options
context:
space:
mode:
authorJan Arne Petersen <jpetersen@openismus.com>2013-01-16 21:26:38 +0100
committerKristian Høgsberg <krh@bitplanet.net>2013-02-15 16:55:27 -0500
commit4653531e7a846abc5fee89a74f5edf3e1835fc5e (patch)
treee02dd3f3a89082bf4075b3628501b9d882d06318 /clients/keyboard.c
parent18639f8d4a28b4471516080c7af68926eaeb62e2 (diff)
downloadweston-4653531e7a846abc5fee89a74f5edf3e1835fc5e.tar.gz
text: add pre-edit styling support to protocol
Also add a separate preedit-cursor event and add a commit argument to preedit-string to allow to support commit on reset. Fix editor and keyboard example to adapt to the protocol changes. Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Diffstat (limited to 'clients/keyboard.c')
-rw-r--r--clients/keyboard.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/clients/keyboard.c b/clients/keyboard.c
index ff356171..a32cf60a 100644
--- a/clients/keyboard.c
+++ b/clients/keyboard.c
@@ -226,9 +226,11 @@ virtual_keyboard_commit_preedit(struct virtual_keyboard *keyboard)
strlen(keyboard->preedit_string) == 0)
return;
+ input_method_context_preedit_cursor(keyboard->context,
+ 0);
input_method_context_preedit_string(keyboard->context,
"",
- 0);
+ "");
input_method_context_commit_string(keyboard->context,
keyboard->preedit_string,
strlen(keyboard->preedit_string));
@@ -250,9 +252,11 @@ keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct key *
keyboard->keyboard->preedit_string = strcat(keyboard->keyboard->preedit_string,
label);
+ input_method_context_preedit_cursor(keyboard->keyboard->context,
+ strlen(keyboard->keyboard->preedit_string));
input_method_context_preedit_string(keyboard->keyboard->context,
keyboard->keyboard->preedit_string,
- strlen(keyboard->keyboard->preedit_string));
+ keyboard->keyboard->preedit_string);
break;
case keytype_backspace:
if (state != WL_POINTER_BUTTON_STATE_PRESSED)
@@ -263,9 +267,11 @@ keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct key *
-1, 1);
} else {
keyboard->keyboard->preedit_string[strlen(keyboard->keyboard->preedit_string) - 1] = '\0';
+ input_method_context_preedit_cursor(keyboard->keyboard->context,
+ strlen(keyboard->keyboard->preedit_string));
input_method_context_preedit_string(keyboard->keyboard->context,
keyboard->keyboard->preedit_string,
- strlen(keyboard->keyboard->preedit_string));
+ keyboard->keyboard->preedit_string);
}
break;
case keytype_enter:
@@ -386,9 +392,11 @@ input_method_context_reset(void *data,
fprintf(stderr, "Reset pre-edit buffer\n");
if (strlen(keyboard->preedit_string)) {
+ input_method_context_preedit_cursor(context,
+ 0);
input_method_context_preedit_string(context,
"",
- 0);
+ "");
free(keyboard->preedit_string);
keyboard->preedit_string = strdup("");
}