[Spice-devel] [PATCH] spice-widget: Add spice_display_mouse_grab()
Marc-André Lureau
mlureau at redhat.com
Wed Aug 28 03:50:52 PDT 2013
----- Mensaje original -----
> On 08/27/2013 07:50 PM, Marc-André Lureau wrote:
> > Hi
> >
> > ----- Mensaje original -----
> >> Similarly to spice_display_mouse_ungrab(), this is intedned to be used
> >> from outside code to force the display to grab the mouse (and
> >> keyboard).
> >
> > That sounds reasonable, although we probably want the function to return
> > whether it succeeded.
> >
>
> I wasn't going to plug this in since try_mouse_ungrab is void and I'd
> have to either duplicate the code or re-make the function. No problem
> though if you want that to return the result.
It is void because it's internal, and results in internal warnings. If you
expose it as an API it should no longer be void.
>
> > What should happen if you try to grab with mouse in client mode? fail
> > silentely? warn?
> >
>
> I was thinking that silent fail is OK since the caller can check the
> mode etc. to know whether this makes sense at all. However if
> try_mouse_ungrab is redone (or there is other function which returns
> non-void) than this can be changed to one of the return codes and left
> up to the caller whether it wants to ignore it or not.
Yes, success return value should be left to caller to decide what to do.
The problem is by nature, this function can't or shouldn't be called if
the mouse is in client mode. (ie 99% of the time it is in this mode, and
we need no mouse grabs)
>
> I forgot to mention why I sent this patch. We wanted to control this
> behavior in virt-manager, but it looks like we'll copy the behavior from
> virt-viewer and won't grab the mouse when not needed. I'll see whether
> we'll need this at all and will send a v2 in case nobody beats me to it
> and we need it at last.
Then you probably don't need it, unless you have a more complicated use
case, in which case it would be nice to describe it.
> [...]
> >> @@ -83,7 +83,8 @@ static gboolean gtk_widget_get_realized(GtkWidget
> >> *widget)
> >> * focused if the properties #SpiceDisplay:grab-keyboard and
> >> * #SpiceDisplay:grab-mouse are #TRUE respectively. It can be
> >> * ungrabbed with spice_display_mouse_ungrab(), and by setting a key
> >> - * combination with spice_display_set_grab_keys().
> >> + * combination with spice_display_set_grab_keys(). The grab can be
> >> + * also forcefully initiated using spice_display_mouse_ungrab().
> >> *
>
> And yes, this should've been s/grab/ungrab as Christophe pointed out.
>
> Thanks,
> Martin
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list