diff options
author | Jan Arne Petersen <jpetersen@openismus.com> | 2012-09-09 23:08:40 +0200 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-09-12 16:38:00 -0400 |
commit | cb08f4d844e9b85744c54a4d6e9179f44a27e3fc (patch) | |
tree | 5bfc301a1bea6ebf950b7be440821fbc15af7ebe /clients/keyboard.c | |
parent | c1fbcb7c38f026cca8b14c1316a311c59a8d73e9 (diff) | |
download | weston-cb08f4d844e9b85744c54a4d6e9179f44a27e3fc.tar.gz weston-cb08f4d844e9b85744c54a4d6e9179f44a27e3fc.tar.bz2 weston-cb08f4d844e9b85744c54a4d6e9179f44a27e3fc.zip |
text: Fix set_surrounding_text request
Add cursor and anchor positions as arguments to the set_surrounding_text
request. The cursor and anchor positions are relative to the surrounded
text, so it does not make sense to have that separate. Remove the
separate set_cursor_index and set_selected_text requests. Also update
the corresponding event in input-method-context and add support for it
in the weston example keyboard.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Diffstat (limited to 'clients/keyboard.c')
-rw-r--r-- | clients/keyboard.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clients/keyboard.c b/clients/keyboard.c index 50ede542..c940c6fc 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -137,6 +137,20 @@ button_handler(struct widget *widget, } static void +input_method_context_surrounding_text(void *data, + struct input_method_context *context, + const char *text, + uint32_t cursor, + uint32_t anchor) +{ + fprintf(stderr, "Surrounding text updated: %s\n", text); +} + +static const struct input_method_context_listener input_method_context_listener = { + input_method_context_surrounding_text, +}; + +static void input_method_activate(void *data, struct input_method *input_method, struct input_method_context *context) @@ -147,6 +161,9 @@ input_method_activate(void *data, input_method_context_destroy(keyboard->context); keyboard->context = context; + input_method_context_add_listener(context, + &input_method_context_listener, + keyboard); } static void |