[PATCH 1/2] text: add assigned_seat event to the input_method interface

Jan Arne Petersen jpetersen at openismus.com
Mon Aug 13 01:10:50 PDT 2012


Hi Philipp,

I do not think it is a realistic scenario to have one virtual keyboard
surface forwarding the input to different entries depending on which
seat the touch/mouse-event comes from. We would rather have one virtual
keyboard surface per seat (on different outputs). For the demo keyboard
it would be ok to just react to input from all seats and forward to all
active text_models (as long as we do not have a virtual keyboard surface
per seat). I think that should both be possible with just the
input_method_context interface we talked about on Friday.

Best regards,
Jan Arne


On 08/11/2012 12:12 PM, Philipp Brüschweiler wrote:
> This event notifies the input method to which seat it is assigned. This
> is necessary to distinguish multiple input methods when multiple seats
> are used.
> ---
>  protocol/text.xml  |  4 ++++
>  src/text-backend.c | 23 +++++++++++++++++------
>  2 Dateien geändert, 21 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)
> 
> diff --git a/protocol/text.xml b/protocol/text.xml
> index e73cacb..8dbb9fb 100644
> --- a/protocol/text.xml
> +++ b/protocol/text.xml
> @@ -55,5 +55,9 @@
>        <arg name="text" type="string"/>
>        <arg name="index" type="uint"/>
>      </request>
> +
> +    <event name="assigned_seat">
> +      <arg name="seat" type="object" interface="wl_seat"/>
> +    </event>
>    </interface>
>  </protocol>
> diff --git a/src/text-backend.c b/src/text-backend.c
> index ddeec20..9c78018 100644
> --- a/src/text-backend.c
> +++ b/src/text-backend.c
> @@ -20,6 +20,7 @@
>   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> +#include <assert.h>
>  #include <stdlib.h>
>  
>  #include "compositor.h"
> @@ -44,6 +45,7 @@ struct input_method {
>  	struct wl_listener destroy_listener;
>  
>  	struct weston_compositor *ec;
> +	struct weston_seat *seat;
>  	struct text_model *model;
>  
>  	struct wl_list link;
> @@ -257,20 +259,28 @@ bind_input_method(struct wl_client *client,
>  {
>  	struct input_method *input_method = data;
>  	struct wl_resource *resource;
> +	struct wl_resource *seat_resource;
>  
>  	resource = wl_client_add_object(client, &input_method_interface,
>  					&input_method_implementation,
>  					id, input_method);
>  
> -	if (input_method->input_method_binding == NULL) {
> -		resource->destroy = unbind_input_method;
> -		input_method->input_method_binding = resource;
> +	if (input_method->input_method_binding != NULL) {
> +		wl_resource_post_error(resource,
> +				       WL_DISPLAY_ERROR_INVALID_OBJECT,
> +				       "interface object already bound");
> +		wl_resource_destroy(resource);
>  		return;
>  	}
>  
> -	wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
> -			       "interface object already bound");
> -	wl_resource_destroy(resource);
> +	resource->destroy = unbind_input_method;
> +	input_method->input_method_binding = resource;
> +
> +	seat_resource = wl_client_get_object_for_interface(client,
> +							   &wl_seat_interface,
> +							   input_method->seat);
> +	assert(seat_resource);
> +	input_method_send_assigned_seat(resource, seat_resource);
>  }
>  
>  static void
> @@ -325,6 +335,7 @@ input_method_create(struct weston_compositor *ec,
>  	input_method = calloc(1, sizeof *input_method);
>  
>  	input_method->ec = ec;
> +	input_method->seat = seat;
>  	input_method->model = NULL;
>  	input_method->focus_listener_initialized = 0;
>  
> 



More information about the wayland-devel mailing list