Re: [Qemu-devel] [PATCH 5/5] gtk: Fix accelerators being triggered twice with gtk3

2014-04-28 Thread Gerd Hoffmann
On Fr, 2014-04-25 at 16:46 -0400, Cole Robinson wrote:
> On 04/25/2014 05:11 AM, Gerd Hoffmann wrote:
> > On Do, 2014-04-24 at 13:35 -0400, Cole Robinson wrote:
> >> When keyboard focus is grabbed, current qemu wants to pass every
> >> keypress to the VM, unless the user is pressing a UI accelerator.
> >>
> >> That's exactly how things work without any of the fancy handling. Drop
> >> the special handling, which seems to trigger accelerators twice on gtk3.
> > 
> > Is this tested on gtk2?
> > 
> 
> Yes, sorry, I should have mentioned that all patches were tested with gtk2.24
> and gtk3.10.

Ok, good, picked up the patch.

Was just wondering why the code is there in the first place, suspected
there could be a gtk2/3 difference in behavior, and just wanted to
double-check.

thanks,
  Gerd





Re: [Qemu-devel] [PATCH 5/5] gtk: Fix accelerators being triggered twice with gtk3

2014-04-25 Thread Cole Robinson
On 04/25/2014 05:11 AM, Gerd Hoffmann wrote:
> On Do, 2014-04-24 at 13:35 -0400, Cole Robinson wrote:
>> When keyboard focus is grabbed, current qemu wants to pass every
>> keypress to the VM, unless the user is pressing a UI accelerator.
>>
>> That's exactly how things work without any of the fancy handling. Drop
>> the special handling, which seems to trigger accelerators twice on gtk3.
> 
> Is this tested on gtk2?
> 

Yes, sorry, I should have mentioned that all patches were tested with gtk2.24
and gtk3.10.

Thanks,
Cole




Re: [Qemu-devel] [PATCH 5/5] gtk: Fix accelerators being triggered twice with gtk3

2014-04-25 Thread Gerd Hoffmann
On Do, 2014-04-24 at 13:35 -0400, Cole Robinson wrote:
> When keyboard focus is grabbed, current qemu wants to pass every
> keypress to the VM, unless the user is pressing a UI accelerator.
> 
> That's exactly how things work without any of the fancy handling. Drop
> the special handling, which seems to trigger accelerators twice on gtk3.

Is this tested on gtk2?

cheers,
  Gerd





[Qemu-devel] [PATCH 5/5] gtk: Fix accelerators being triggered twice with gtk3

2014-04-24 Thread Cole Robinson
When keyboard focus is grabbed, current qemu wants to pass every
keypress to the VM, unless the user is pressing a UI accelerator.

That's exactly how things work without any of the fancy handling. Drop
the special handling, which seems to trigger accelerators twice on gtk3.

Signed-off-by: Cole Robinson 
---
 ui/gtk.c | 22 --
 1 file changed, 22 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 45a61da..93896ed 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -99,8 +99,6 @@ static inline void gdk_drawable_get_size(GdkWindow *w, gint 
*ww, gint *wh)
 #endif
 
 #define HOTKEY_MODIFIERS(GDK_CONTROL_MASK | GDK_MOD1_MASK)
-#define IGNORE_MODIFIER_MASK \
-(GDK_MODIFIER_MASK & ~(GDK_LOCK_MASK | GDK_MOD2_MASK))
 
 static const int modifier_keycode[] = {
 /* shift, control, alt keys, meta keys, both left & right */
@@ -485,24 +483,6 @@ static void gd_mouse_mode_change(Notifier *notify, void 
*data)
 
 /** GTK Events **/
 
-static gboolean gd_window_key_event(GtkWidget *widget, GdkEventKey *key, void 
*opaque)
-{
-GtkDisplayState *s = opaque;
-gboolean handled = FALSE;
-
-if (!gd_is_grab_active(s) ||
-(key->state & IGNORE_MODIFIER_MASK) == HOTKEY_MODIFIERS) {
-handled = gtk_window_activate_key(GTK_WINDOW(widget), key);
-}
-if (handled) {
-gtk_release_modifiers(s);
-} else {
-handled = gtk_window_propagate_key_event(GTK_WINDOW(widget), key);
-}
-
-return handled;
-}
-
 static gboolean gd_window_close(GtkWidget *widget, GdkEvent *event,
 void *opaque)
 {
@@ -1286,8 +1266,6 @@ static void gd_connect_signals(GtkDisplayState *s)
 g_signal_connect(s->show_tabs_item, "activate",
  G_CALLBACK(gd_menu_show_tabs), s);
 
-g_signal_connect(s->window, "key-press-event",
- G_CALLBACK(gd_window_key_event), s);
 g_signal_connect(s->window, "delete-event",
  G_CALLBACK(gd_window_close), s);
 
-- 
1.9.0