On Sat, 2017-06-24 at 16:03 -0500, Joshua Watt wrote:
> If the --click-to-show option is specified, clicking an input field
> will toggle
> the input panel visiblity
> 
> Signed-off-by: Joshua Watt <jpewhac...@gmail.com>
> ---
>  clients/editor.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/clients/editor.c b/clients/editor.c
> index b63c562..78d10d2 100644
> --- a/clients/editor.c
> +++ b/clients/editor.c
> @@ -49,6 +49,7 @@ struct text_entry {
>       struct window *window;
>       char *text;
>       int active;
> +     bool panel_visible;
>       uint32_t cursor;
>       uint32_t anchor;
>       struct {
> @@ -499,8 +500,10 @@ text_input_leave(void *data,
>       text_entry_commit_and_reset(entry);
>       entry->active--;
>  
> -     if (!entry->active)
> +     if (!entry->active) {
>               zwp_text_input_v1_hide_input_panel(text_input);
> +             entry->panel_visible = false;
> +     }
>  
>       widget_schedule_redraw(entry->widget);
>  }
> @@ -699,6 +702,7 @@ text_entry_create(struct editor *editor, const
> char *text)
>       entry->window = editor->window;
>       entry->text = strdup(text);
>       entry->active = 0;
> +     entry->panel_visible = false;
>       entry->cursor = strlen(text);
>       entry->anchor = entry->cursor;
>       entry->text_input =
> @@ -787,7 +791,12 @@ text_entry_activate(struct text_entry *entry,
>       struct wl_surface *surface = window_get_wl_surface(entry-
> >window);
>  
>       if (entry->click_to_show && entry->active) {
> -             zwp_text_input_v1_show_input_panel(entry-
> >text_input);
> +             entry->panel_visible = !entry->panel_visible;
> +
> +             if (entry->panel_visible)
> +                     zwp_text_input_v1_show_input_panel(entry-
> >text_input);
> +             else
> +                     zwp_text_input_v1_hide_input_panel(entry-
> >text_input);
>  
>               return;
>       }

Could someone please Ack and commit this (or give more feedback)?
Thanks
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to