From 26ffa814d90ad97dc7474bc454e3776c48aa21d1 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 16 Jan 2013 21:26:43 +0100 Subject: [PATCH] text: Add content type support to text protocol Support content types in text protocol. Content is defined by a hint bitmask and a purpose field. Signed-off-by: Jan Arne Petersen --- protocol/input-method.xml | 4 ++++ protocol/text.xml | 52 ++++++++++++++++++++++++++++++++++++++++++++++- src/text-backend.c | 12 ++++++++++- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/protocol/input-method.xml b/protocol/input-method.xml index 03991f1..a57fabd 100644 --- a/protocol/input-method.xml +++ b/protocol/input-method.xml @@ -123,6 +123,10 @@ + + + + diff --git a/protocol/text.xml b/protocol/text.xml index bd74ee1..e657292 100644 --- a/protocol/text.xml +++ b/protocol/text.xml @@ -83,8 +83,58 @@ - + + + Content hint is a bitmask to allow to modify the behavior of the text input + + + + + + + + + + + + + + + + + + The content purpose allows to specify the primary purpose of a text input. + This allows an input method to show special purpose input panels with extra + characters or to disallow some characters. + + + + + + + + + + + + + + + + + + Sets the content purpose and content hint. While the purpose is the + basic purpose of an input field, the hint flags allow to modify some + of the behavior. + + When no content type is explicitly set, a normal content purpose with + default hints (auto completion, auto correction, auto capitalization) + should be assumed. + + + + Notify when text should be inserted into the editor widget. The text diff --git a/src/text-backend.c b/src/text-backend.c index cc8fa43..d074347 100644 --- a/src/text-backend.c +++ b/src/text-backend.c @@ -234,8 +234,18 @@ text_model_set_preedit(struct wl_client *client, static void text_model_set_content_type(struct wl_client *client, - struct wl_resource *resource) + struct wl_resource *resource, + uint32_t hint, + uint32_t purpose) { + struct text_model *text_model = resource->data; + struct input_method *input_method, *next; + + wl_list_for_each_safe(input_method, next, &text_model->input_methods, link) { + if (!input_method->context) + continue; + input_method_context_send_content_type(&input_method->context->resource, hint, purpose); + } } static const struct text_model_interface text_model_implementation = { -- 2.7.4