[PATCH v2 1/3] text: Add content type support to text protocol

Pekka Vuorela pvuorela at iki.fi
Mon Dec 10 10:36:38 PST 2012


On 10.12.2012 12:19, Jan Arne Petersen wrote:
> From: Jan Arne Petersen <jpetersen at openismus.com>
>
> --- a/protocol/text.xml
> +++ b/protocol/text.xml
> @@ -83,8 +83,58 @@
>         <arg name="height" type="int"/>
>       </request>
>       <request name="set_preedit"/>
> -    <request name="set_content_type"/>
> +    <enum name="content_hint">
> +      <description summary="content hint">
> +        Content hint is a bitmask to allow to modify the behavior of the text input
> +      </description>
> +      <entry name="none" value="0x0" summary="no special behaviour"/>
> +      <entry name="default" value="0x7" summary="auto completion, cotrrection and capitalization"/>

Correction.

> +      <entry name="password" value="0xc" summary="hidden and sensitive text"/>
> +      <entry name="auto_completion" value="0x1" summary="suggest word completions"/>
> +      <entry name="auto_correction" value="0x2" summary="suggest word corrections"/>
> +      <entry name="auto_capitalization" value="0x4" summary="switch to upercase letters at the end of a sentence"/>

Uppercase. I'd phrase as "at the start of a sentence" since it's 
convenient on empty text fields, too.

> +      <entry name="lowercase" value="0x8" summary="prefer lowercase letters"/>
> +      <entry name="uppercase" value="0x10" summary="prefer upercase letters"/>

Uppercase.

> +      <entry name="titlecase" value="0x20" summary="switch to upercase letters at the end of a word"/>

Uppercase :)

With this name I could even understand why Gtk+ included it (if the 
motivation was the same).

However, titles are not universally done with uppercase first character 
on each word. With Finnish I'd capitalize only the first character in a 
title and even English is not too consistent with the casing:
http://en.wikipedia.org/wiki/Letter_case#Headings_and_publication_titles

If you think this is worthwhile keeping, I'd remove any restriction how 
casing should be done.

> +      <entry name="hidden_text" value="0x40" summary="characters should be hidden"/>
> +      <entry name="sensitive_data" value="0x80" summary="typed text should not be stored"/>
> +      <entry name="multiline" value="0x200" summary="the text input is multiline"/>
> +    </enum>
> +    <enum name="content_purpose">
> +      <description summary="content purpose">
> +        The content purpose allows to specify the primary purpose of a text input.
>
> +        This allows an input method to show special purpose input panels or to
> +        disallow some characters.
> +      </description>
> +      <entry name="normal" value="0" summary="default input, allowing all characters"/>
> +      <entry name="latin" value="1" summary="allow just latin characters"/>

Nice that you added this, but I'd still move on to content_hint part as 
a flag. Otherwise not possible to indicate latin-only alphabets, digits, 
numbers, phone number, url, email or passwords.

> +      <entry name="alpha" value="2" summary="allow only alphabetic characters"/>
> +      <entry name="digits" value="3" summary="allow only digits"/>
> +      <entry name="number" value="4" summary="input a number (including decimal dot and sign)"/>

Rather decimal separator as it might not be a dot.

> +      <entry name="phone" value="5" summary="input a ohone number"/>

Phone.

> +      <entry name="url" value="6" summary="input an URL"/>
> +      <entry name="email" value="7" summary="input an email address"/>
> +      <entry name="name" value="8" summary="input a name of a person"/>
> +      <entry name="password" value="9" summary="input a password (combine with password or sensistive_data hint)"/>

Sensitive.

> +      <entry name="date" value="10" summary="input a date"/>
> +      <entry name="time" value="11" summary="input a time"/>
> +      <entry name="datetime" value="12" summary="input a date and time"/>
> +      <entry name="terminal" value="13" summary="input for a terminal, show special control keys on a virtual keyboard"/>

Is that a requirement?



More information about the wayland-devel mailing list