[PATCH 17/18] text: Only allow input-method started by weston to bind
Jan Arne Petersen
jpetersen at openismus.com
Mon Apr 8 02:54:16 PDT 2013
On 04/08/2013 01:51 AM, Yichao Yu wrote:
> Does this mean it is not possible to start a stand alone input method???
No. It just means that the compositor (weston) starts the stand alone
input method.
> On Sun, Apr 7, 2013 at 6:12 PM, Jan Arne Petersen
> <jpetersen at openismus.com <mailto:jpetersen at openismus.com>> wrote:
>
> From: Jan Arne Petersen <jpetersen at openismus.com
> <mailto:jpetersen at openismus.com>>
>
> Signed-off-by: Jan Arne Petersen <jpetersen at openismus.com
> <mailto:jpetersen at openismus.com>>
> ---
> src/text-backend.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/src/text-backend.c b/src/text-backend.c
> index 07a066c..53aa92c 100644
> --- a/src/text-backend.c
> +++ b/src/text-backend.c
> @@ -759,17 +759,24 @@ bind_input_method(struct wl_client *client,
> NULL,
> 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;
> + }
>
> - text_backend->input_method.binding = resource;
> + if (text_backend->input_method.client != client) {
> + wl_resource_post_error(resource,
> WL_DISPLAY_ERROR_INVALID_OBJECT,
> + "permission to bind
> desktop_shell denied");
> + 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;
> +
> + text_backend->input_method.binding = resource;
> }
>
> static void
> --
> 1.8.1.4
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> <mailto:wayland-devel at lists.freedesktop.org>
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
>
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
--
Jan Arne Petersen
Openismus GmbH
http://www.openismus.com
More information about the wayland-devel
mailing list