All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change
@ 2014-07-08 18:28 John Snow
  2014-07-11 11:19 ` Markus Armbruster
  2014-07-17 13:21 ` Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: John Snow @ 2014-07-08 18:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: jsnow, aliguori, stefanha, kraxel

(Resending for correct email addresses via MAINTAINERS ...)

In the GTK UI, after changing focus to the qemu monitor Notebook Page,
when restoring focus to the virtual machine page, the keyboard focus is lost
to a hidden GTK widget. Focus can only be restored to the virtual machine by
pressing "tab" or any of the four directional arrow keys.

Clicking in the window or grabbing/ungrabbing input does not restore keyboard
focus to the child widget.

This patch adjusts the Notebook page switching callback to automatically
steal keyboard focus on the Page switch event, so that keyboard input
does not appear to break or disappear after tabbing to the QEMU monitor.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 ui/gtk.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index b02fcd6..2345d7e 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -992,13 +992,16 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque)
 {
     GtkDisplayState *s = opaque;
     VirtualConsole *vc = gd_vc_find_by_menu(s);
+    GtkNotebook *nb = GTK_NOTEBOOK(s->notebook);
+    GtkWidget *child;
     gint page;
 
     gtk_release_modifiers(s);
     if (vc) {
-        page = gtk_notebook_page_num(GTK_NOTEBOOK(s->notebook),
-                                     vc->tab_item);
-        gtk_notebook_set_current_page(GTK_NOTEBOOK(s->notebook), page);
+        page = gtk_notebook_page_num(nb, vc->tab_item);
+        gtk_notebook_set_current_page(nb, page);
+        child = gtk_notebook_get_nth_page(nb, page);
+        gtk_widget_grab_focus(child);
     }
 }
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change
  2014-07-08 18:28 [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change John Snow
@ 2014-07-11 11:19 ` Markus Armbruster
  2014-07-17 13:21 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2014-07-11 11:19 UTC (permalink / raw)
  To: John Snow; +Cc: stefanha, qemu-devel, aliguori, kraxel

John Snow <jsnow@redhat.com> writes:

> (Resending for correct email addresses via MAINTAINERS ...)

The note above...

> In the GTK UI, after changing focus to the qemu monitor Notebook Page,
> when restoring focus to the virtual machine page, the keyboard focus is lost
> to a hidden GTK widget. Focus can only be restored to the virtual machine by
> pressing "tab" or any of the four directional arrow keys.
>
> Clicking in the window or grabbing/ungrabbing input does not restore keyboard
> focus to the child widget.
>
> This patch adjusts the Notebook page switching callback to automatically
> steal keyboard focus on the Page switch event, so that keyboard input
> does not appear to break or disappear after tabbing to the QEMU monitor.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---

... should go here next time.

>  ui/gtk.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
[...]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change
  2014-07-08 18:28 [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change John Snow
  2014-07-11 11:19 ` Markus Armbruster
@ 2014-07-17 13:21 ` Stefan Hajnoczi
  2014-07-17 13:38   ` Gerd Hoffmann
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-07-17 13:21 UTC (permalink / raw)
  To: John Snow; +Cc: stefanha, qemu-devel, aliguori, kraxel

[-- Attachment #1: Type: text/plain, Size: 1808 bytes --]

On Tue, Jul 08, 2014 at 02:28:57PM -0400, John Snow wrote:
> (Resending for correct email addresses via MAINTAINERS ...)
> 
> In the GTK UI, after changing focus to the qemu monitor Notebook Page,
> when restoring focus to the virtual machine page, the keyboard focus is lost
> to a hidden GTK widget. Focus can only be restored to the virtual machine by
> pressing "tab" or any of the four directional arrow keys.
> 
> Clicking in the window or grabbing/ungrabbing input does not restore keyboard
> focus to the child widget.
> 
> This patch adjusts the Notebook page switching callback to automatically
> steal keyboard focus on the Page switch event, so that keyboard input
> does not appear to break or disappear after tabbing to the QEMU monitor.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  ui/gtk.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index b02fcd6..2345d7e 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -992,13 +992,16 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque)
>  {
>      GtkDisplayState *s = opaque;
>      VirtualConsole *vc = gd_vc_find_by_menu(s);
> +    GtkNotebook *nb = GTK_NOTEBOOK(s->notebook);
> +    GtkWidget *child;
>      gint page;
>  
>      gtk_release_modifiers(s);
>      if (vc) {
> -        page = gtk_notebook_page_num(GTK_NOTEBOOK(s->notebook),
> -                                     vc->tab_item);
> -        gtk_notebook_set_current_page(GTK_NOTEBOOK(s->notebook), page);
> +        page = gtk_notebook_page_num(nb, vc->tab_item);
> +        gtk_notebook_set_current_page(nb, page);
> +        child = gtk_notebook_get_nth_page(nb, page);
> +        gtk_widget_grab_focus(child);
>      }
>  }
>  
> -- 
> 1.9.3

Ping?

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change
  2014-07-17 13:21 ` Stefan Hajnoczi
@ 2014-07-17 13:38   ` Gerd Hoffmann
  0 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-07-17 13:38 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: stefanha, John Snow, qemu-devel, aliguori

On Do, 2014-07-17 at 14:21 +0100, Stefan Hajnoczi wrote:
> On Tue, Jul 08, 2014 at 02:28:57PM -0400, John Snow wrote:
> > (Resending for correct email addresses via MAINTAINERS ...)
> > 
> > In the GTK UI, after changing focus to the qemu monitor Notebook Page,
> > when restoring focus to the virtual machine page, the keyboard focus is lost
> > to a hidden GTK widget. Focus can only be restored to the virtual machine by
> > pressing "tab" or any of the four directional arrow keys.

> Ping?

commit e72b59fa93b68635f42cdb1b1134f60dd4040d7b

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-17 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-08 18:28 [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change John Snow
2014-07-11 11:19 ` Markus Armbruster
2014-07-17 13:21 ` Stefan Hajnoczi
2014-07-17 13:38   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.