[PATCH 1/3] text: Add content type support to text protocol
Jan Arne Petersen
jpetersen at openismus.com
Mon Dec 3 06:15:15 PST 2012
From: Jan Arne Petersen <jpetersen at openismus.com>
Support content types in text protocol. Content is defined by a hint
bitmask and a purpose field.
Signed-off-by: Jan Arne Petersen <jpetersen at openismus.com>
---
protocol/input-method.xml | 4 ++++
protocol/text.xml | 38 ++++++++++++++++++++++++++++++++++++--
src/text-backend.c | 12 +++++++++++-
3 files changed, 51 insertions(+), 3 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 @@
<event name="reset">
<arg name="serial" type="uint"/>
</event>
+ <event name="content_type">
+ <arg name="hint" type="uint"/>
+ <arg name="purpose" type="uint"/>
+ </event>
</interface>
<interface name="input_method" version="1">
diff --git a/protocol/text.xml b/protocol/text.xml
index bd74ee1..448584a 100644
--- a/protocol/text.xml
+++ b/protocol/text.xml
@@ -83,8 +83,42 @@
<arg name="height" type="int"/>
</request>
<request name="set_preedit"/>
- <request name="set_content_type"/>
-
+ <enum name="content_hint">
+ <entry name="none" value="0x0"/>
+ <entry name="auto_complete" value="0x1"/>
+ <entry name="auto_correct" value="0x2"/>
+ <entry name="no_suggestions" value="0x4"/>
+ <entry name="lowercase" value="0x8"/>
+ <entry name="uppercase_chars" value="0x10"/>
+ <entry name="uppercase_words" value="0x20"/>
+ <entry name="uppercase_sentences" value="0x40"/>
+ <entry name="hidden_text" value="0x80"/>
+ <entry name="inhibit_osk" value="0x100"/>
+ </enum>
+ <enum name="content_purpose">
+ <entry name="normal" value="0"/>
+ <entry name="alpha" value="1"/>
+ <entry name="digits" value="2"/>
+ <entry name="number" value="3"/>
+ <entry name="phone" value="4"/>
+ <entry name="url" value="5"/>
+ <entry name="email" value="6"/>
+ <entry name="name" value="7"/>
+ <entry name="password" value="8"/>
+ <entry name="pin" value="9"/>
+ <entry name="date" value="10"/>
+ <entry name="time" value="11"/>
+ <entry name="datetime" value="12"/>
+ <entry name="day" value="13"/>
+ <entry name="month" value="14"/>
+ <entry name="year" value="15"/>
+ <entry name="hex" value="16"/>
+ <entry name="terminal" value="17"/>
+ </enum>
+ <request name="set_content_type">
+ <arg name="hint" type="uint"/>
+ <arg name="purpose" type="uint"/>
+ </request>
<event name="commit_string">
<description summary="commit">
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 = {
--
1.7.11.7
More information about the wayland-devel
mailing list