[Spice-devel] [PATCH spice-gtk 1/4] gtk: add spice_main_request_mouse_mode()

Victor Toso lists at victortoso.com
Thu May 5 08:51:22 UTC 2016


On Tue, Nov 10, 2015 at 11:05:09AM +0100, Victor Toso wrote:
> Hi,
> 
> On Mon, Nov 09, 2015 at 03:02:07PM +0100, Marc-André Lureau wrote:
> > Send a SpiceMsgcMainMouseModeRequest message to request a mouse mode.
> >
> > This allows to switch between client/absolute and server/relative mouse
> > modes.
> >
> > This is necessary for some applications that require pointer
> > re-positioning, which we can't provide through a remote protocol easily
> > with client pointer (no such hardware-level message exists afaik).
> 
> I've retested again in top of rhel7 server/qemu and upstream
> server/qemu. On rhel7, the mouse pointer barely moves and it goes back
> againt to its original position in top-left corner. On upstream, the
> mouse pointer does not move at all.
> 
> I did not lose my pointer this time (I could toggle back with
> Shift+F12).
> 
> All VMs has ps/2 device. The mouse pointer should keep moving, right?
> Some videos:
> http://people.freedesktop.org/~victortoso/videos/spice/
> 
> Cheers,
>   Victor Toso
> 
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> > ---
> >  doc/reference/spice-gtk-sections.txt |  1 +
> >  src/channel-main.c                   | 29 +++++++++++++++++++++++++++++
> >  src/channel-main.h                   |  2 ++
> >  src/map-file                         |  1 +
> >  src/spice-glib-sym-file              |  1 +
> >  5 files changed, 34 insertions(+)
> >
> > diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt
> > index d8c4c79..9628471 100644
> > --- a/doc/reference/spice-gtk-sections.txt
> > +++ b/doc/reference/spice-gtk-sections.txt
> > @@ -70,6 +70,7 @@ spice_main_update_display
> >  spice_main_update_display_enabled
> >  spice_main_send_monitor_config
> >  spice_main_agent_test_capability
> > +spice_main_request_mouse_mode
> >  spice_main_clipboard_selection_grab
> >  spice_main_clipboard_selection_notify
> >  spice_main_clipboard_selection_release
> > diff --git a/src/channel-main.c b/src/channel-main.c
> > index 0eb40b9..f4213d7 100644
> > --- a/src/channel-main.c
> > +++ b/src/channel-main.c
> > @@ -1610,6 +1610,35 @@ static void agent_stopped(SpiceMainChannel *channel)
> >      set_agent_connected(channel, FALSE);
> >  }
> >
> > +/**
> > + * spice_main_request_mouse_mode:
> > + * @channel: a %SpiceMainChannel
> > + * @mode: a SPICE_MOUSE_MODE
> > + *
> > + * Request a mouse mode to the server. The server may not be able to
> > + * change the mouse mode, but spice-gtk will try to request it
> > + * when possible.
> > + *
> > + * Since: 0.31

Now it is 0.32
Reviewed-by: Victor Toso <victortoso at redhat.com>

> > + **/
> > +void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode)
> > +{
> > +    SpiceMsgcMainMouseModeRequest req = {
> > +        .mode = mode,
> > +    };
> > +    SpiceMsgOut *out;
> > +
> > +    g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
> > +
> > +    if (spice_channel_get_read_only(SPICE_CHANNEL(channel)))
> > +        return;
> > +
> > +    CHANNEL_DEBUG(channel, "request mouse mode %d", mode);
> > +    out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST);
> > +    out->marshallers->msgc_main_mouse_mode_request(out->marshaller, &req);
> > +    spice_msg_out_send(out);
> > +}
> > +
> >  /* coroutine context */
> >  static void set_mouse_mode(SpiceMainChannel *channel, uint32_t supported, uint32_t current)
> >  {
> > diff --git a/src/channel-main.h b/src/channel-main.h
> > index 6b94c25..3fe8df1 100644
> > --- a/src/channel-main.h
> > +++ b/src/channel-main.h
> > @@ -98,6 +98,8 @@ gboolean spice_main_file_copy_finish(SpiceMainChannel *channel,
> >                                       GAsyncResult *result,
> >                                       GError **error);
> >
> > +void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode);
> > +
> >  #ifndef SPICE_DISABLE_DEPRECATED
> >  SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_grab)
> >  void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes);
> > diff --git a/src/map-file b/src/map-file
> > index 92a9883..495a802 100644
> > --- a/src/map-file
> > +++ b/src/map-file
> > @@ -72,6 +72,7 @@ spice_main_clipboard_selection_release;
> >  spice_main_clipboard_selection_request;
> >  spice_main_file_copy_async;
> >  spice_main_file_copy_finish;
> > +spice_main_request_mouse_mode;
> >  spice_main_send_monitor_config;
> >  spice_main_set_display;
> >  spice_main_set_display_enabled;
> > diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
> > index 3817a46..080f079 100644
> > --- a/src/spice-glib-sym-file
> > +++ b/src/spice-glib-sym-file
> > @@ -49,6 +49,7 @@ spice_main_clipboard_selection_release
> >  spice_main_clipboard_selection_request
> >  spice_main_file_copy_async
> >  spice_main_file_copy_finish
> > +spice_main_request_mouse_mode
> >  spice_main_send_monitor_config
> >  spice_main_set_display
> >  spice_main_set_display_enabled
> > -- 
> > 2.5.0
> > 
> > _______________________________________________
> > 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