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

Hans de Goede hdegoede at redhat.com
Sun Mar 18 12:02:19 PDT 2012


ACK.

On 03/18/2012 06:42 PM, Marc-André Lureau wrote:
> 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) {


More information about the Spice-devel mailing list