[PATCH v3 wayland-protocols] text: Create second version of text input protocol

2016-02-02 Thread Jan Arne Petersen
There were some shortcomings in the first version of the protocol which
makes it not really useful in real world applications. It is not really
possible to fix them in a compatible way so introduce a new v2 of the
protocol.

Fixes some shortcomings of the first version:

* Use only one wp_text_input per wl_seat (client side should be
  handled by client toolkit)
* Allow focus tracking without wl_keyboard present
* Improve update state handling
* Allow state requests
---
 unstable/text-input/text-input-unstable-v2.xml | 481 +
 1 file changed, 481 insertions(+)
 create mode 100644 unstable/text-input/text-input-unstable-v2.xml

diff --git a/unstable/text-input/text-input-unstable-v2.xml 
b/unstable/text-input/text-input-unstable-v2.xml
new file mode 100644
index 000..e7d2d50
--- /dev/null
+++ b/unstable/text-input/text-input-unstable-v2.xml
@@ -0,0 +1,481 @@
+
+
+
+  
+Copyright © 2012, 2013 Intel Corporation
+Copyright © 2015, 2016 Jan Arne Petersen
+
+Permission to use, copy, modify, distribute, and sell this
+software and its documentation for any purpose is hereby granted
+without fee, provided that the above copyright notice appear in
+all copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the name of
+the copyright holders not be used in advertising or publicity
+pertaining to distribution of the software without specific,
+written prior permission.  The copyright holders make no
+representations about the suitability of this software for any
+purpose.  It is provided "as is" without express or implied
+warranty.
+
+THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+THIS SOFTWARE.
+  
+
+  
+
+  The zwp_text_input_v2 interface repesents text input and input methods
+  associated with a seat. It provides enter/leave event to follow the
+  text input focus for a seat.
+
+  Requests are used to enable/disable the text-input object and set
+  state information like surrounding and selected text or the content type.
+  The information about entered text is sent to the text-input object via
+  the pre-edit and commit events. Using this interface removes the need
+  for applications to directly process hardware key events and compose text
+  out of them.
+
+  Text is UTF-8 encoded, indices and lengths are in bytes.
+
+  Serials are used to synchronize the state between the text input and
+  an input method. New serials are sent by the text input in the
+  update_state request and are used by the input method to indicate
+  the known text input state in evsents like preedit_string, commit_string,
+  and keysym. The text input can then ignore events from the input method
+  which are based on an outdated state (for example after a reset).
+
+
+
+  
+   Destroy the wp_text_input object. Also disables all surfaces enabled
+   through this wp_text_input object
+  
+
+
+
+  
+   Enable text input in a surface (usually when a text entry inside of it
+   has focus).
+
+   This can be called before or after a surface gets text (or keyboard)
+   focus via the enter event. Text input to a surface is only active
+   when it has the current text (or keyboard) focus and is enabled.
+  
+  
+
+
+
+  
+   Disable text input in a surface (typically when there is no focus on any
+   text entry inside the surface).
+  
+  
+
+
+
+  
+   Requests input panels (virtual keyboard) to show.
+
+   This should be used for example to show a virtual keyboard again
+   (with a tap) after it was closed by pressing on a close button on the
+   keyboard.
+  
+
+
+
+  
+   Requests input panels (virtual keyboard) to hide.
+  
+
+
+
+  
+   Sets the plain surrounding text around the input position. Text is
+   UTF-8 encoded. Cursor is the byte offset within the
+   surrounding text. Anchor is the byte offset of the
+   selection anchor within the surrounding text. If there is no selected
+   text anchor is the same as cursor.
+
+   Make sure to always send some text before and after the cursor
+   except when the cursor is at the beginning or end of text.
+
+   When there was a configure_surrounding_text event take the
+   before_cursor and after_cursor arguments into account for picking how
+   much surrounding 

Re: [PATCH v3 wayland-protocols] text: Create second version of text input protocol

2016-02-02 Thread Jan Arne Petersen
Hi Silvan,

On 02/02/16 13:23, Silvan Jegen wrote:
> Hi
> 
> Please find some comments and spelling corrections below.
> 
> 
>> There were some shortcomings in the first version of the protocol which
>> makes it not really useful in real world applications. It is not really
>> possible to fix them in a compatible way so introduce a new v2 of the
>> protocol.
>>
>> Fixes some shortcomings of the first version:
>>
>> * Use only one wp_text_input per wl_seat (client side should be
>>   handled by client toolkit)
>> * Allow focus tracking without wl_keyboard present
>> * Improve update state handling
>> * Allow state requests
>> ---
>>  unstable/text-input/text-input-unstable-v2.xml | 481 
>> +
>>  1 file changed, 481 insertions(+)
>>  create mode 100644 unstable/text-input/text-input-unstable-v2.xml
>>
>> diff --git a/unstable/text-input/text-input-unstable-v2.xml 
>> b/unstable/text-input/text-input-unstable-v2.xml
>> new file mode 100644
>> index 000..2fc5e7d
>> --- /dev/null
>> +++ b/unstable/text-input/text-input-unstable-v2.xml
>> @@ -0,0 +1,481 @@
>> +
>> +
>> +
>> +  
>> +Copyright © 2012, 2013 Intel Corporation
>> +Copyright © 2015, 2016 Jan Arne Petersen
>> +
>> +Permission to use, copy, modify, distribute, and sell this
>> +software and its documentation for any purpose is hereby granted
>> +without fee, provided that the above copyright notice appear in
>> +all copies and that both that copyright notice and this permission
>> +notice appear in supporting documentation, and that the name of
>> +the copyright holders not be used in advertising or publicity
>> +pertaining to distribution of the software without specific,
>> +written prior permission.  The copyright holders make no
>> +representations about the suitability of this software for any
>> +purpose.  It is provided "as is" without express or implied
>> +warranty.
>> +
>> +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
>> +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
>> +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
>> +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
>> +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
>> +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
>> +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
>> +THIS SOFTWARE.
>> +  
>> +
>> +  
>> +
>> +  The zwp_text_input_v2 interface represents text input and input 
>> methods
> 
> s/repesents/represents/

fixed

>> +  associated with a seat. It provides enter/leave event to follow the
> 
> s/event/events/


fixed

>> +  text input focus for a seat.
>> +
>> +  Requests are used to enable/disable the text-input object and set
>> +  state information like surrounding and selected text or the content 
>> type.
>> +  The information about entered text is sent to the text-input object 
>> via
> 
> "about the entered text" may sound more natural.

fixed

>> +  the pre-edit and commit events. Using this interface removes the need
>> +  for applications to directly process hardware key events and compose 
>> text
>> +  out of them.
>> +
>> +  Text is UTF-8 encoded, indices and lengths are in bytes.
> 
> This seems problematic to me when dealing with multi-byte encoded
> Unicode points. The behavior should be better defined in that case.
> Please see comments further below.

From v4:

"Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices
have to always point to the first byte of an UTF-8 encoded code point.
Lengths are not allowed to contain just a part of an UTF-8 encoded code
point."

The protocol is usually not used by application developers directly but
by a toolkit which has to convert from toolkit strings/indices/lengths
to the protocol string/index/length format and back. Which seems to be
quite easy with above protocol definition. We could also use Unicode
characters for index/length should not make much a difference.

>> +  Serials are used to synchronize the state between the text input and
>> +  an input method. New serials are sent by the text input in the
>> +  update_state request and are used by the input method to indicate
>> +  the known text input state in evsents like preedit_string, 
>> commit_string,
> 
> s/evsents/events/

fixed

>> +  and keysym. The text input can then ignore events from the input 
>> method
>> +  which are based on an outdated state (for example after a reset).
>> +
>> +
>> +
>> +  
>> +   Destroy the wp_text_input object. Also disables all surfaces enabled
>> +   through this wp_text_input object
>> +  
>> +
>> +
>> +
>> +  
>> +   Enable text input in a surface (usually when a text entry inside of 
>> it
>> +   has focus).
>> +
>> +   This can be called before or after a surface gets 

Re: [PATCH v3 wayland-protocols] text: Create second version of text input protocol

2016-02-02 Thread Silvan Jegen
Hi

Please find some comments and spelling corrections below.


> There were some shortcomings in the first version of the protocol which
> makes it not really useful in real world applications. It is not really
> possible to fix them in a compatible way so introduce a new v2 of the
> protocol.
>
> Fixes some shortcomings of the first version:
>
> * Use only one wp_text_input per wl_seat (client side should be
>   handled by client toolkit)
> * Allow focus tracking without wl_keyboard present
> * Improve update state handling
> * Allow state requests
> ---
>  unstable/text-input/text-input-unstable-v2.xml | 481 
> +
>  1 file changed, 481 insertions(+)
>  create mode 100644 unstable/text-input/text-input-unstable-v2.xml
>
> diff --git a/unstable/text-input/text-input-unstable-v2.xml 
> b/unstable/text-input/text-input-unstable-v2.xml
> new file mode 100644
> index 000..2fc5e7d
> --- /dev/null
> +++ b/unstable/text-input/text-input-unstable-v2.xml
> @@ -0,0 +1,481 @@
> +
> +
> +
> +  
> +Copyright © 2012, 2013 Intel Corporation
> +Copyright © 2015, 2016 Jan Arne Petersen
> +
> +Permission to use, copy, modify, distribute, and sell this
> +software and its documentation for any purpose is hereby granted
> +without fee, provided that the above copyright notice appear in
> +all copies and that both that copyright notice and this permission
> +notice appear in supporting documentation, and that the name of
> +the copyright holders not be used in advertising or publicity
> +pertaining to distribution of the software without specific,
> +written prior permission.  The copyright holders make no
> +representations about the suitability of this software for any
> +purpose.  It is provided "as is" without express or implied
> +warranty.
> +
> +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
> +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
> +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
> +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
> +THIS SOFTWARE.
> +  
> +
> +  
> +
> +  The zwp_text_input_v2 interface represents text input and input methods

s/repesents/represents/


> +  associated with a seat. It provides enter/leave event to follow the

s/event/events/


> +  text input focus for a seat.
> +
> +  Requests are used to enable/disable the text-input object and set
> +  state information like surrounding and selected text or the content 
> type.
> +  The information about entered text is sent to the text-input object via

"about the entered text" may sound more natural.

> +  the pre-edit and commit events. Using this interface removes the need
> +  for applications to directly process hardware key events and compose 
> text
> +  out of them.
> +
> +  Text is UTF-8 encoded, indices and lengths are in bytes.

This seems problematic to me when dealing with multi-byte encoded
Unicode points. The behavior should be better defined in that case.
Please see comments further below.


> +  Serials are used to synchronize the state between the text input and
> +  an input method. New serials are sent by the text input in the
> +  update_state request and are used by the input method to indicate
> +  the known text input state in evsents like preedit_string, 
> commit_string,

s/evsents/events/

> +  and keysym. The text input can then ignore events from the input method
> +  which are based on an outdated state (for example after a reset).
> +
> +
> +
> +  
> +   Destroy the wp_text_input object. Also disables all surfaces enabled
> +   through this wp_text_input object
> +  
> +
> +
> +
> +  
> +   Enable text input in a surface (usually when a text entry inside of it
> +   has focus).
> +
> +   This can be called before or after a surface gets text (or keyboard)
> +   focus via the enter event. Text input to a surface is only active
> +   when it has the current text (or keyboard) focus and is enabled.
> +  
> +  
> +
> +
> +
> +  
> +   Disable text input in a surface (typically when there is no focus on 
> any
> +   text entry inside the surface).
> +  
> +  
> +
> +
> +
> +  
> +   Requests input panels (virtual keyboard) to show.
> +
> +   This should be used for example to show a virtual keyboard again
> +   (with a tap) after it was closed by pressing on a close button on the
> +   keyboard.
> +  
> +
> +
> +
> +  
> +   Requests input panels (virtual keyboard) to hide.
> +  
> +
> +
> +
> +  

There is a description