[Spice-devel] [PATCH spice-gtk] Do not grab display widget

Marc-André Lureau marcandre.lureau at gmail.com
Sun Mar 18 10:42:35 PDT 2012


We used to gtk_grab_add() after mouse grab to limit the mouse events
to the display. But it isn't necessary if the display has its own
window, since gdk_pointer_grab() will be limited to it.

Note the widget has the keyboard focus & is focused, so this doesn't
affect keyboard events.

However, this allows application to keep global accelerators
functionning if they want to (like virt-viewer with custom key
bindings).
---
 gtk/spice-widget.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index fb40d1a..850fd5b 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -364,6 +364,7 @@ static void spice_display_init(SpiceDisplay *display)
                           GDK_KEY_PRESS_MASK);
     gtk_widget_set_double_buffered(widget, false);
     gtk_widget_set_can_focus(widget, true);
+    gtk_widget_set_has_window(widget, true);
 
     d->keycode_map = vnc_display_keymap_gdk2xtkbd_table(&d->keycode_maplen);
     d->grabseq = spice_grab_sequence_new_from_string("Control_L+Alt_L");
@@ -610,7 +611,6 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
         ClipCursor(&client_rect);
     }
 #endif
-    gtk_grab_add(GTK_WIDGET(display));
 
 #ifdef GDK_WINDOWING_X11
     if (status == GDK_GRAB_SUCCESS) {
-- 
1.7.7.6



More information about the Spice-devel mailing list