[PATCH 3/5] text-backend: implement keyboard release

Jan Arne Petersen janarne at gmail.com
Tue Jul 5 19:59:31 UTC 2016


On Wed, Jun 8, 2016 at 5:40 PM Arnaud Vrac <avrac at freebox.fr> wrote:

> The input method implementation only exposes a wl_keyboard object with
> version 1, which does not include a destructor. The input method has no
> way to notify the server that the object has been destroyed.
>
> Implement version 3 of wl_keyboard which adds the release destructor to
> fix this.
> ---
>  src/text-backend.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/src/text-backend.c b/src/text-backend.c
> index 5a09f12..aa19ae9 100644
> --- a/src/text-backend.c
> +++ b/src/text-backend.c
> @@ -664,6 +664,16 @@ static const struct weston_keyboard_grab_interface
> input_method_context_grab = {
>  };
>
>  static void
> +keyboard_release(struct wl_client *client, struct wl_resource *resource)
> +{
> +       wl_resource_destroy(resource);
> +}
> +
> +static const struct wl_keyboard_interface keyboard_interface = {
> +       keyboard_release
> +};
> +
> +static void
>  input_method_context_grab_keyboard(struct wl_client *client,
>                                    struct wl_resource *resource,
>                                    uint32_t id)
> @@ -674,8 +684,9 @@ input_method_context_grab_keyboard(struct wl_client
> *client,
>         struct weston_seat *seat = context->input_method->seat;
>         struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
>
> -       cr = wl_resource_create(client, &wl_keyboard_interface, 1, id);
> -       wl_resource_set_implementation(cr, NULL, context, unbind_keyboard);
> +       cr = wl_resource_create(client, &wl_keyboard_interface, 3, id);
> +       wl_resource_set_implementation(cr, &keyboard_interface,
> +                                      context, unbind_keyboard);
>
>         context->keyboard = cr;
>
> --
> 2.7.4
>
>
In an update to the input-method protocol we need to remove the wl_keyboard
from the protocol anyways (
https://bugs.freedesktop.org/show_bug.cgi?id=84034). But that should be
fine for now.

Reviewed-by: Jan Arne Petersen <janarne at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160705/65dcaa5a/attachment-0001.html>


More information about the wayland-devel mailing list