[weston,1/7] editor: Make editor multi-seat aware

Submitted by Derek Foreman on Dec. 5, 2014, 9:38 p.m.

Details

Message ID 1417815521-11304-2-git-send-email-derekf@osg.samsung.com
State Superseded
Headers show

Not browsing as part of any series.

Commit Message

Derek Foreman Dec. 5, 2014, 9:38 p.m.
With multi-seat, multiple entries can occur on the text inputs in the
editor.  Also, the panel shouldn't be hidden by the editor if either
text entry is still active.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
---
 clients/editor.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/clients/editor.c b/clients/editor.c
index db7be2a..6bbc104 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -72,6 +72,7 @@  struct text_entry {
 	uint32_t click_to_show;
 	char *preferred_language;
 	bool button_pressed;
+	struct text_entry *sibling;
 };
 
 struct editor {
@@ -473,7 +474,7 @@  text_input_enter(void *data,
 	if (surface != window_get_wl_surface(entry->window))
 		return;
 
-	entry->active = 1;
+	entry->active++;
 
 	text_entry_update(entry);
 	entry->reset_serial = entry->serial;
@@ -488,10 +489,10 @@  text_input_leave(void *data,
 	struct text_entry *entry = data;
 
 	text_entry_commit_and_reset(entry);
+	entry->active--;
 
-	entry->active = 0;
-
-	wl_text_input_hide_input_panel(text_input);
+	if (!entry->active && !entry->sibling->active)
+		wl_text_input_hide_input_panel(text_input);
 
 	widget_schedule_redraw(entry->widget);
 }
@@ -1375,6 +1376,9 @@  main(int argc, char *argv[])
 	editor.editor->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
 	editor.editor->click_to_show = click_to_show;
 
+	editor.entry->sibling = editor.editor;
+	editor.editor->sibling = editor.entry;
+
 	window_set_title(editor.window, "Text Editor");
 	window_set_key_handler(editor.window, key_handler);
 	window_set_keyboard_focus_handler(editor.window,

Comments

On Fri Dec 05 2014 at 10:47:03 PM Derek Foreman <derekf@osg.samsung.com>
wrote:

> With multi-seat, multiple entries can occur on the text inputs in the
> editor.  Also, the panel shouldn't be hidden by the editor if either
> text entry is still active.
>
> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
> ---
>  clients/editor.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/clients/editor.c b/clients/editor.c
> index db7be2a..6bbc104 100644
> --- a/clients/editor.c
> +++ b/clients/editor.c
> @@ -72,6 +72,7 @@ struct text_entry {
>         uint32_t click_to_show;
>         char *preferred_language;
>         bool button_pressed;
> +       struct text_entry *sibling;
>  };
>
>  struct editor {
> @@ -473,7 +474,7 @@ text_input_enter(void *data,
>         if (surface != window_get_wl_surface(entry->window))
>                 return;
>
> -       entry->active = 1;
> +       entry->active++;
>
>         text_entry_update(entry);
>         entry->reset_serial = entry->serial;
> @@ -488,10 +489,10 @@ text_input_leave(void *data,
>         struct text_entry *entry = data;
>
>         text_entry_commit_and_reset(entry);
> +       entry->active--;
>
> -       entry->active = 0;
> -
> -       wl_text_input_hide_input_panel(text_input);
> +       if (!entry->active && !entry->sibling->active)
> +               wl_text_input_hide_input_panel(text_input);
>
>
Increment/decrement active is right.

The sibling handling should be fixed inside the compositor instead (emit
hide_input_panel_signal in text_input_hide_input_panel() only when all
text_input's input panels are hidden)


>         widget_schedule_redraw(entry->widget);
>  }
> @@ -1375,6 +1376,9 @@ main(int argc, char *argv[])
>         editor.editor->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_
> NUMBER;
>         editor.editor->click_to_show = click_to_show;
>
> +       editor.entry->sibling = editor.editor;
> +       editor.editor->sibling = editor.entry;
> +
>         window_set_title(editor.window, "Text Editor");
>         window_set_key_handler(editor.window, key_handler);
>         window_set_keyboard_focus_handler(editor.window,
> --
> 2.1.3
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>