From 7ef8effca5278bb7fddf5cee5d4830ca9d8a80b8 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Thu, 18 Apr 2013 16:47:23 +0200 Subject: [PATCH] text: Order requests and events in a nice way Signed-off-by: Jan Arne Petersen --- clients/editor.c | 14 ++--- protocol/text.xml | 172 ++++++++++++++++++++++++++--------------------------- src/text-backend.c | 24 ++++---- tests/text-test.c | 14 ++--- 4 files changed, 112 insertions(+), 112 deletions(-) diff --git a/clients/editor.c b/clients/editor.c index 1696fca..c921c43 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -428,17 +428,17 @@ text_model_text_direction(void *data, } static const struct text_model_listener text_model_listener = { - text_model_commit_string, + text_model_enter, + text_model_leave, + text_model_modifiers_map, + text_model_input_panel_state, text_model_preedit_string, - text_model_delete_surrounding_text, - text_model_cursor_position, text_model_preedit_styling, text_model_preedit_cursor, - text_model_modifiers_map, + text_model_commit_string, + text_model_cursor_position, + text_model_delete_surrounding_text, text_model_keysym, - text_model_enter, - text_model_leave, - text_model_input_panel_state, text_model_language, text_model_text_direction }; diff --git a/protocol/text.xml b/protocol/text.xml index ea5bfe1..97ac8b4 100644 --- a/protocol/text.xml +++ b/protocol/text.xml @@ -37,17 +37,6 @@ removes the need for applications to directly process hardware key events and compose text out of them. - - - Sets the plain surrounding text around the input position. Cursor is the - byte index within the surrounding text. Anchor is the byte index of the - selection anchor within the surrounding text. If there is no selected - text anchor then it is the same as cursor. - - - - - Requests the model to be activated (typically when the text entry gets @@ -68,6 +57,16 @@ + + + Requests input panels (virtual keyboard) to show. + + + + + Requests input panels (virtual keyboard) to hide. + + Should be called by an editor widget when the input state should be @@ -76,11 +75,16 @@ - - - - - + + + Sets the plain surrounding text around the input position. Cursor is the + byte index within the surrounding text. Anchor is the byte index of the + selection anchor within the surrounding text. If there is no selected + text anchor then it is the same as cursor. + + + + @@ -136,21 +140,11 @@ - - - - - - - - - Requests input panels (virtual keyboard) to show. - - - - - Requests input panels (virtual keyboard) to hide. - + + + + + @@ -164,17 +158,39 @@ - - - Notify when text should be inserted into the editor widget. The text to - commit could be either just a single character after a key press or the - result of some composing (pre-edit). It also sets the new cursor - position (as byte index) relative to the beginning of inserted text. - - Any previously set composing text should be removed. + + + + + + + + + Notify the model when it is activated. Typically in response to an + activate request. - - + + + + + Notify the model when it is deactivated. Either in response to a + deactivate request or when the assigned surface lost focus or was + destroyed. + + + + + Transfer an array of 0-terminated modifiers names. The position in + the array is the index of the modifier as used in the modifiers + bitmask in the keysym event. + + + + + + Notify when the visibility state of the input panel changed. + + @@ -189,25 +205,6 @@ - - - Notify when the text around the current cursor position should be - deleted. Index is relative to the current cursor (as byte index). - Length is the length of deleted text (in bytes). - - - - - - - - Notify when the cursor or anchor position should be modified. It - should take effect after the next commit_string event. - - - - - @@ -243,13 +240,36 @@ - - - Transfer an array of 0-terminated modifiers names. The position in - the array is the index of the modifier as used in the modifiers - bitmask in the keysym event. + + + Notify when text should be inserted into the editor widget. The text to + commit could be either just a single character after a key press or the + result of some composing (pre-edit). It also sets the new cursor + position (as byte index) relative to the beginning of inserted text. + + Any previously set composing text should be removed. - + + + + + + Notify when the cursor or anchor position should be modified. It + should take effect after the next commit_string event. + + + + + + + + Notify when the text around the current cursor position should be + deleted. Index is relative to the current cursor (as byte index). + Length is the length of deleted text (in bytes). + + + + @@ -266,26 +286,6 @@ - - - Notify the model when it is activated. Typically in response to an - activate request. - - - - - - Notify the model when it is deactivated. Either in response to a - deactivate request or when the assigned surface lost focus or was - destroyed. - - - - - Notify when the visibility state of the input panel changed. - - - Sets the language of the input text. The "language" argument is a RFC-3066 diff --git a/src/text-backend.c b/src/text-backend.c index 7d1d7d7..c083683 100644 --- a/src/text-backend.c +++ b/src/text-backend.c @@ -219,12 +219,12 @@ text_model_reset(struct wl_client *client, } static void -text_model_set_micro_focus(struct wl_client *client, - struct wl_resource *resource, - int32_t x, - int32_t y, - int32_t width, - int32_t height) +text_model_set_cursor_rectangle(struct wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) { } @@ -317,17 +317,17 @@ text_model_set_preferred_language(struct wl_client *client, } static const struct text_model_interface text_model_implementation = { - text_model_set_surrounding_text, text_model_activate, text_model_deactivate, + text_model_show_input_panel, + text_model_hide_input_panel, text_model_reset, - text_model_set_micro_focus, + text_model_set_surrounding_text, text_model_set_content_type, - text_model_invoke_action, + text_model_set_cursor_rectangle, + text_model_set_preferred_language, text_model_commit_state, - text_model_show_input_panel, - text_model_hide_input_panel, - text_model_set_preferred_language + text_model_invoke_action }; static void text_model_factory_create_text_model(struct wl_client *client, diff --git a/tests/text-test.c b/tests/text-test.c index 41bf750..8983ac4 100644 --- a/tests/text-test.c +++ b/tests/text-test.c @@ -148,17 +148,17 @@ text_model_text_direction(void *data, } static const struct text_model_listener text_model_listener = { - text_model_commit_string, + text_model_enter, + text_model_leave, + text_model_modifiers_map, + text_model_input_panel_state, text_model_preedit_string, - text_model_delete_surrounding_text, - text_model_cursor_position, text_model_preedit_styling, text_model_preedit_cursor, - text_model_modifiers_map, + text_model_commit_string, + text_model_cursor_position, + text_model_delete_surrounding_text, text_model_keysym, - text_model_enter, - text_model_leave, - text_model_input_panel_state, text_model_language, text_model_text_direction }; -- 2.7.4