[Spice-devel] [PATCH] spice-widget: Add spice_display_mouse_grab()

Martin Kletzander mkletzan at redhat.com
Wed Aug 28 02:45:33 PDT 2013


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.

> 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.

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.

[...]
>> @@ -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



More information about the Spice-devel mailing list