[PATCH 1/5] text-backend: send event when the input panel visiblity changes

Jan Arne Petersen janarne at gmail.com
Tue Jul 5 19:55:06 UTC 2016


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

> Without this the input method state will not stay in sync with the
> client state.
> ---
>  src/text-backend.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/src/text-backend.c b/src/text-backend.c
> index 0c000ba..c32ec04 100644
> --- a/src/text-backend.c
> +++ b/src/text-backend.c
> @@ -121,6 +121,16 @@ static void
>  input_method_init_seat(struct weston_seat *seat);
>
>  static void
> +text_input_set_input_panel_visible(struct text_input *text_input, bool
> visible)
> +{
> +       if (text_input->input_panel_visible == visible)
> +               return;
> +
> +       text_input->input_panel_visible = visible;
> +       zwp_text_input_v1_send_input_panel_state(text_input->resource,
> visible);
> +}
> +
> +static void
>  deactivate_input_method(struct input_method *input_method)
>  {
>         struct text_input *text_input = input_method->input;
> @@ -140,7 +150,7 @@ deactivate_input_method(struct input_method
> *input_method)
>         if (wl_list_empty(&text_input->input_methods) &&
>             text_input->input_panel_visible) {
>                 wl_signal_emit(&ec->hide_input_panel_signal, ec);
> -               text_input->input_panel_visible = false;
> +               text_input_set_input_panel_visible(text_input, false);
>                 text_input->manager->current_panel = NULL;
>         }
>         zwp_text_input_v1_send_leave(text_input->resource);
> @@ -207,7 +217,7 @@ text_input_activate(struct wl_client *client,
>         current = text_input->manager->current_panel;
>
>         if (current && current != text_input) {
> -               current->input_panel_visible = false;
> +               text_input_set_input_panel_visible(current, false);
>                 wl_signal_emit(&ec->hide_input_panel_signal, ec);
>                 text_input->manager->current_panel = NULL;
>         }
> @@ -331,7 +341,7 @@ text_input_show_input_panel(struct wl_client *client,
>         struct text_input *text_input =
> wl_resource_get_user_data(resource);
>         struct weston_compositor *ec = text_input->ec;
>
> -       text_input->input_panel_visible = true;
> +       text_input_set_input_panel_visible(text_input, true);
>
>         if (!wl_list_empty(&text_input->input_methods)) {
>                 wl_signal_emit(&ec->show_input_panel_signal,
> @@ -348,7 +358,7 @@ text_input_hide_input_panel(struct wl_client *client,
>         struct text_input *text_input =
> wl_resource_get_user_data(resource);
>         struct weston_compositor *ec = text_input->ec;
>
> -       text_input->input_panel_visible = false;
> +       text_input_set_input_panel_visible(text_input, false);
>
>         if (!wl_list_empty(&text_input->input_methods) &&
>             text_input == text_input->manager->current_panel) {
> --
> 2.7.4
>
>
Yes that is definitely correct like this.

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/7f45cfcc/attachment.html>


More information about the wayland-devel mailing list