[Spice-devel] [PATCH spice-gtk 10/11] Ignore the first mouse click when taking the grab

Hans de Goede hdegoede at redhat.com
Thu Dec 8 07:38:13 PST 2011


p.s.

On 12/08/2011 03:12 PM, Marc-André Lureau wrote:
> ---
>   gtk/spice-widget.c |   16 ++++++++++------
>   1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> index 1fa54c3..08aa5a9 100644
> --- a/gtk/spice-widget.c
> +++ b/gtk/spice-widget.c
> @@ -1144,12 +1144,16 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
>       }
>
>       gtk_widget_grab_focus(widget);
> -    if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER)
> -        try_mouse_grab(display);
> -    else /* allow to drag and drop between windows/displays:
> -            FIXME: should be multiple widget grab, but how?
> -            or should now the position of the other widgets?..
> -         */
> +    if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
> +        if (!d->mouse_grab_active) {
> +            try_mouse_grab(display);
> +            return true;
> +        }
> +    } else
> +        /* allow to drag and drop between windows/displays:
> +           FIXME: should be multiple widget grab, but how?
> +           or should now the position of the other widgets?..
> +        */
>           gdk_pointer_ungrab(GDK_CURRENT_TIME);
>

Hmm, this pointer ungrab seems weird, as soon as mouse_mode changes
to something other then SERVER, which can only happen in mouse_update(),
we do a try_mouse_ungrab, which already does a gdk_pointer_ungrab(),
so I believe that this bit can go away, or it should be under the

if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {

Block, but then when do we re-grab? Note that as we don't support multiple
displays without the agent anyways this is a bit of a mute point. So I suggest
simply dropping the else (in a separate patch).

Regards,

Hans



More information about the Spice-devel mailing list