[Spice-devel] [PATCH spice-gtk 4/5] InputsChannel: Fix introspection method bindings

Marc-André Lureau marcandre.lureau at redhat.com
Tue Sep 19 10:33:18 UTC 2017



----- Original Message -----
> Signed-off-by: Matthew Francis <mjay.francis at gmail.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>

> ---
>  doc/reference/spice-gtk-sections.txt |   8 ++
>  src/channel-inputs.c                 | 146
>  ++++++++++++++++++++++++++++++++++-
>  src/channel-inputs.h                 |  34 ++++++--
>  src/map-file                         |   8 ++
>  src/spice-glib-sym-file              |   8 ++
>  src/spice-gtk-session.c              |   2 +-
>  src/spice-widget.c                   |  44 +++++------
>  7 files changed, 217 insertions(+), 33 deletions(-)
> 
> diff --git a/doc/reference/spice-gtk-sections.txt
> b/doc/reference/spice-gtk-sections.txt
> index 538e07c..0f5ec10 100644
> --- a/doc/reference/spice-gtk-sections.txt
> +++ b/doc/reference/spice-gtk-sections.txt
> @@ -237,13 +237,21 @@ SpiceInputsChannelClass
>  SpiceInputsLock
>  <SUBSECTION>
>  spice_inputs_motion
> +spice_inputs_channel_motion
>  spice_inputs_position
> +spice_inputs_channel_position
>  spice_inputs_button_press
> +spice_inputs_channel_button_press
>  spice_inputs_button_release
> +spice_inputs_channel_button_release
>  spice_inputs_key_press
> +spice_inputs_channel_key_press
>  spice_inputs_key_press_and_release
> +spice_inputs_channel_key_press_and_release
>  spice_inputs_key_release
> +spice_inputs_channel_key_release
>  spice_inputs_set_key_locks
> +spice_inputs_channel_set_key_locks
>  <SUBSECTION Standard>
>  SPICE_TYPE_INPUTS_LOCK
>  spice_inputs_lock_get_type
> diff --git a/src/channel-inputs.c b/src/channel-inputs.c
> index 7572bff..75bf1ff 100644
> --- a/src/channel-inputs.c
> +++ b/src/channel-inputs.c
> @@ -284,10 +284,29 @@ static void channel_set_handlers(SpiceChannelClass
> *klass)
>   * @button_state: SPICE_MOUSE_BUTTON_MASK flags
>   *
>   * Change mouse position (used in SPICE_MOUSE_MODE_CLIENT).
> + *
> + * Deprecated: 0.35: use spice_inputs_channel_motion() instead.
>   **/
>  void spice_inputs_motion(SpiceInputsChannel *channel, gint dx, gint dy,
>                           gint button_state)
>  {
> +    spice_inputs_channel_motion(channel, dx, dy, button_state);
> +}
> +
> +/**
> + * spice_inputs_channel_motion:
> + * @channel: a #SpiceInputsChannel
> + * @dx: delta X mouse coordinates
> + * @dy: delta Y mouse coordinates
> + * @button_state: SPICE_MOUSE_BUTTON_MASK flags
> + *
> + * Change mouse position (used in SPICE_MOUSE_MODE_CLIENT).
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_motion(SpiceInputsChannel *channel, gint dx, gint
> dy,
> +                                 gint button_state)
> +{
>      SpiceInputsChannelPrivate *c;
>  
>      g_return_if_fail(channel != NULL);
> @@ -317,10 +336,30 @@ void spice_inputs_motion(SpiceInputsChannel *channel,
> gint dx, gint dy,
>   * @button_state: SPICE_MOUSE_BUTTON_MASK flags
>   *
>   * Change mouse position (used in SPICE_MOUSE_MODE_CLIENT).
> + *
> + * Deprecated: 0.35: use spice_inputs_channel_position() instead.
>   **/
>  void spice_inputs_position(SpiceInputsChannel *channel, gint x, gint y,
>                             gint display, gint button_state)
>  {
> +    spice_inputs_channel_position(channel, x, y, display, button_state);
> +}
> +
> +/**
> + * spice_inputs_channel_position:
> + * @channel: a #SpiceInputsChannel
> + * @x: X mouse coordinates
> + * @y: Y mouse coordinates
> + * @display: display channel id
> + * @button_state: SPICE_MOUSE_BUTTON_MASK flags
> + *
> + * Change mouse position (used in SPICE_MOUSE_MODE_CLIENT).
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_position(SpiceInputsChannel *channel, gint x, gint
> y,
> +                                   gint display, gint button_state)
> +{
>      SpiceInputsChannelPrivate *c;
>  
>      g_return_if_fail(channel != NULL);
> @@ -348,10 +387,28 @@ void spice_inputs_position(SpiceInputsChannel *channel,
> gint x, gint y,
>   * @button_state: SPICE_MOUSE_BUTTON_MASK flags
>   *
>   * Press a mouse button.
> + *
> + * Deprecated: 0.35: use spice_inputs_channel_button_press() instead.
>   **/
>  void spice_inputs_button_press(SpiceInputsChannel *channel, gint button,
>                                 gint button_state)
>  {
> +    spice_inputs_channel_button_press(channel, button, button_state);
> +}
> +
> +/**
> + * spice_inputs_channel_button_press:
> + * @channel: a #SpiceInputsChannel
> + * @button: a SPICE_MOUSE_BUTTON
> + * @button_state: SPICE_MOUSE_BUTTON_MASK flags
> + *
> + * Press a mouse button.
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_button_press(SpiceInputsChannel *channel, gint
> button,
> +                                       gint button_state)
> +{
>      SpiceInputsChannelPrivate *c;
>      SpiceMsgcMousePress press;
>      SpiceMsgOut *msg;
> @@ -395,10 +452,28 @@ void spice_inputs_button_press(SpiceInputsChannel
> *channel, gint button,
>   * @button_state: SPICE_MOUSE_BUTTON_MASK flags
>   *
>   * Release a button.
> + *
> + * Deprecated: 0.35: use spice_inputs_channel_button_release() instead.
>   **/
>  void spice_inputs_button_release(SpiceInputsChannel *channel, gint button,
>                                   gint button_state)
>  {
> +    spice_inputs_channel_button_release(channel, button, button_state);
> +}
> +
> +/**
> + * spice_inputs_channel_button_release:
> + * @channel: a #SpiceInputsChannel
> + * @button: a SPICE_MOUSE_BUTTON
> + * @button_state: SPICE_MOUSE_BUTTON_MASK flags
> + *
> + * Release a button.
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_button_release(SpiceInputsChannel *channel, gint
> button,
> +                                         gint button_state)
> +{
>      SpiceInputsChannelPrivate *c;
>      SpiceMsgcMouseRelease release;
>      SpiceMsgOut *msg;
> @@ -442,9 +517,26 @@ void spice_inputs_button_release(SpiceInputsChannel
> *channel, gint button,
>   *            prefix, drop the prefix and OR the scancode with %0x100.
>   *
>   * Press a key.
> + *
> + * Deprecated: 0.35: use spice_inputs_channel_key_press() instead.
>   **/
>  void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode)
>  {
> +    spice_inputs_channel_key_press(channel, scancode);
> +}
> +
> +/**
> + * spice_inputs_channel_key_press:
> + * @channel: a #SpiceInputsChannel
> + * @scancode: a PC XT (set 1) key scancode.  For scancodes with an %0xe0
> + *            prefix, drop the prefix and OR the scancode with %0x100.
> + *
> + * Press a key.
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_key_press(SpiceInputsChannel *channel, guint
> scancode)
> +{
>      SpiceMsgcKeyDown down;
>      SpiceMsgOut *msg;
>  
> @@ -468,9 +560,26 @@ void spice_inputs_key_press(SpiceInputsChannel *channel,
> guint scancode)
>   *            prefix, drop the prefix and OR the scancode with %0x100.
>   *
>   * Release a key.
> + *
> + * Deprecated: 0.35: use spice_inputs_channel_key_release() instead.
>   **/
>  void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode)
>  {
> +    spice_inputs_channel_key_release(channel, scancode);
> +}
> +
> +/**
> + * spice_inputs_channel_key_release:
> + * @channel: a #SpiceInputsChannel
> + * @scancode: a PC XT (set 1) key scancode.  For scancodes with an %0xe0
> + *            prefix, drop the prefix and OR the scancode with %0x100.
> + *
> + * Release a key.
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_key_release(SpiceInputsChannel *channel, guint
> scancode)
> +{
>      SpiceMsgcKeyUp up;
>      SpiceMsgOut *msg;
>  
> @@ -496,9 +605,26 @@ void spice_inputs_key_release(SpiceInputsChannel
> *channel, guint scancode)
>   * Press and release a key event atomically (in the same message).
>   *
>   * Since: 0.13
> + *
> + * Deprecated: 0.35
>   **/
>  void spice_inputs_key_press_and_release(SpiceInputsChannel *input_channel,
>  guint scancode)
>  {
> +    spice_inputs_channel_key_press_and_release(input_channel, scancode);
> +}
> +
> +/**
> + * spice_inputs_channel_key_press_and_release:
> + * @channel: a #SpiceInputsChannel
> + * @scancode: a PC XT (set 1) key scancode.  For scancodes with an %0xe0
> + *            prefix, drop the prefix and OR the scancode with %0x100.
> + *
> + * Press and release a key event atomically (in the same message).
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_key_press_and_release(SpiceInputsChannel
> *input_channel, guint scancode)
> +{
>      SpiceChannel *channel = SPICE_CHANNEL(input_channel);
>  
>      g_return_if_fail(channel != NULL);
> @@ -531,8 +657,8 @@ void
> spice_inputs_key_press_and_release(SpiceInputsChannel *input_channel, guint
>          spice_msg_out_send(msg);
>      } else {
>          CHANNEL_DEBUG(channel, "The server doesn't support atomic press and
>          release");
> -        spice_inputs_key_press(input_channel, scancode);
> -        spice_inputs_key_release(input_channel, scancode);
> +        spice_inputs_channel_key_press(input_channel, scancode);
> +        spice_inputs_channel_key_release(input_channel, scancode);
>      }
>  }
>  
> @@ -566,9 +692,25 @@ static SpiceMsgOut* set_key_locks(SpiceInputsChannel
> *channel, guint locks)
>   * @locks: #SpiceInputsLock modifiers flags
>   *
>   * Set the keyboard locks on the guest (Caps, Num, Scroll..)
> + *
> + * Deprecated: 0.35: use spice_inputs_channel_set_key_locks() instead.
>   **/
>  void spice_inputs_set_key_locks(SpiceInputsChannel *channel, guint locks)
>  {
> +    spice_inputs_channel_set_key_locks(channel, locks);
> +}
> +
> +/**
> + * spice_inputs_channel_set_key_locks:
> + * @channel: a #SpiceInputsChannel
> + * @locks: #SpiceInputsLock modifiers flags
> + *
> + * Set the keyboard locks on the guest (Caps, Num, Scroll..)
> + *
> + * Since: 0.35
> + **/
> +void spice_inputs_channel_set_key_locks(SpiceInputsChannel *channel, guint
> locks)
> +{
>      SpiceMsgOut *msg;
>  
>      if (spice_channel_get_read_only(SPICE_CHANNEL(channel)))
> diff --git a/src/channel-inputs.h b/src/channel-inputs.h
> index 5123c47..fa78235 100644
> --- a/src/channel-inputs.h
> +++ b/src/channel-inputs.h
> @@ -83,18 +83,36 @@ struct _SpiceInputsChannelClass {
>  
>  GType spice_inputs_channel_get_type(void);
>  
> -void spice_inputs_motion(SpiceInputsChannel *channel, gint dx, gint dy,
> -                         gint button_state);
> -void spice_inputs_position(SpiceInputsChannel *channel, gint x, gint y,
> -                           gint display, gint button_state);
> -void spice_inputs_button_press(SpiceInputsChannel *channel, gint button,
> -                               gint button_state);
> -void spice_inputs_button_release(SpiceInputsChannel *channel, gint button,
> -                                 gint button_state);
> +void spice_inputs_channel_motion(SpiceInputsChannel *channel, gint dx, gint
> dy, gint button_state);
> +void spice_inputs_channel_position(SpiceInputsChannel *channel, gint x, gint
> y, gint display,
> +                                   gint button_state);
> +void spice_inputs_channel_button_press(SpiceInputsChannel *channel, gint
> button, gint button_state);
> +void spice_inputs_channel_button_release(SpiceInputsChannel *channel, gint
> button,
> +                                         gint button_state);
> +void spice_inputs_channel_key_press(SpiceInputsChannel *channel, guint
> scancode);
> +void spice_inputs_channel_key_release(SpiceInputsChannel *channel, guint
> scancode);
> +void spice_inputs_channel_set_key_locks(SpiceInputsChannel *channel, guint
> locks);
> +void spice_inputs_channel_key_press_and_release(SpiceInputsChannel *channel,
> guint scancode);
> +
> +#ifndef SPICE_DISABLE_DEPRECATED
> +G_DEPRECATED_FOR(spice_inputs_channel_motion)
> +void spice_inputs_motion(SpiceInputsChannel *channel, gint dx, gint dy, gint
> button_state);
> +G_DEPRECATED_FOR(spice_inputs_channel_position)
> +void spice_inputs_position(SpiceInputsChannel *channel, gint x, gint y, gint
> display,
> +                           gint button_state);
> +G_DEPRECATED_FOR(spice_inputs_channel_button_press)
> +void spice_inputs_button_press(SpiceInputsChannel *channel, gint button,
> gint button_state);
> +G_DEPRECATED_FOR(spice_inputs_channel_button_release)
> +void spice_inputs_button_release(SpiceInputsChannel *channel, gint button,
> gint button_state);
> +G_DEPRECATED_FOR(spice_inputs_channel_key_press)
>  void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode);
> +G_DEPRECATED_FOR(spice_inputs_channel_key_release)
>  void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode);
> +G_DEPRECATED_FOR(spice_inputs_channel_set_key_locks)
>  void spice_inputs_set_key_locks(SpiceInputsChannel *channel, guint locks);
> +G_DEPRECATED_FOR(spice_inputs_channel_key_press_and_release)
>  void spice_inputs_key_press_and_release(SpiceInputsChannel *channel, guint
>  scancode);
> +#endif
>  
>  G_END_DECLS
>  
> diff --git a/src/map-file b/src/map-file
> index 23bcaa5..14e8ac6 100644
> --- a/src/map-file
> +++ b/src/map-file
> @@ -63,7 +63,15 @@ spice_gtk_session_get_type;
>  spice_gtk_session_paste_from_guest;
>  spice_inputs_button_press;
>  spice_inputs_button_release;
> +spice_inputs_channel_button_press;
> +spice_inputs_channel_button_release;
>  spice_inputs_channel_get_type;
> +spice_inputs_channel_key_press;
> +spice_inputs_channel_key_press_and_release;
> +spice_inputs_channel_key_release;
> +spice_inputs_channel_motion;
> +spice_inputs_channel_position;
> +spice_inputs_channel_set_key_locks;
>  spice_inputs_key_press;
>  spice_inputs_key_press_and_release;
>  spice_inputs_key_release;
> diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
> index 10cc245..38e87e0 100644
> --- a/src/spice-glib-sym-file
> +++ b/src/spice-glib-sym-file
> @@ -42,7 +42,15 @@ spice_gl_scanout_get_type
>  spice_g_signal_connect_object
>  spice_inputs_button_press
>  spice_inputs_button_release
> +spice_inputs_channel_button_press
> +spice_inputs_channel_button_release
>  spice_inputs_channel_get_type
> +spice_inputs_channel_key_press
> +spice_inputs_channel_key_press_and_release
> +spice_inputs_channel_key_release
> +spice_inputs_channel_motion
> +spice_inputs_channel_position
> +spice_inputs_channel_set_key_locks
>  spice_inputs_key_press
>  spice_inputs_key_press_and_release
>  spice_inputs_key_release
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index e338ce6..6a53bf5 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -201,7 +201,7 @@ static void
> spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSessio
>      if (force || client_modifiers != guest_modifiers) {
>          CHANNEL_DEBUG(inputs, "client_modifiers:0x%x, guest_modifiers:0x%x",
>                        client_modifiers, guest_modifiers);
> -        spice_inputs_set_key_locks(inputs, client_modifiers);
> +        spice_inputs_channel_set_key_locks(inputs, client_modifiers);
>      }
>  }
>  
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 714ca88..22d25c9 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1381,7 +1381,7 @@ static void key_press_and_release(SpiceDisplay
> *display)
>      if (d->key_delayed_scancode == 0)
>          return;
>  
> -    spice_inputs_key_press_and_release(d->inputs, d->key_delayed_scancode);
> +    spice_inputs_channel_key_press_and_release(d->inputs,
> d->key_delayed_scancode);
>      d->key_delayed_scancode = 0;
>  
>      if (d->key_delayed_id) {
> @@ -1398,7 +1398,7 @@ static gboolean key_press_delayed(gpointer data)
>      if (d->key_delayed_scancode == 0)
>          return FALSE;
>  
> -    spice_inputs_key_press(d->inputs, d->key_delayed_scancode);
> +    spice_inputs_channel_key_press(d->inputs, d->key_delayed_scancode);
>      d->key_delayed_scancode = 0;
>  
>      if (d->key_delayed_id) {
> @@ -1419,11 +1419,11 @@ static bool send_pause(SpiceDisplay *display,
> GdkEventType type)
>       * 0x45 is the NumLock.
>       */
>      if (type == GDK_KEY_PRESS) {
> -        spice_inputs_key_press(inputs, 0x21d);
> -        spice_inputs_key_press(inputs, 0x45);
> +        spice_inputs_channel_key_press(inputs, 0x21d);
> +        spice_inputs_channel_key_press(inputs, 0x45);
>      } else {
> -        spice_inputs_key_release(inputs, 0x21d);
> -        spice_inputs_key_release(inputs, 0x45);
> +        spice_inputs_channel_key_release(inputs, 0x21d);
> +        spice_inputs_channel_key_release(inputs, 0x45);
>      }
>      return true;
>  }
> @@ -1458,7 +1458,7 @@ static void send_key(SpiceDisplay *display, int
> scancode, SendKeyType type, gboo
>              d->key_delayed_id = g_timeout_add(d->keypress_delay,
>              key_press_delayed, display);
>              d->key_delayed_scancode = scancode;
>          } else
> -            spice_inputs_key_press(d->inputs, scancode);
> +            spice_inputs_channel_key_press(d->inputs, scancode);
>  
>          d->key_state[i] |= m;
>          break;
> @@ -1472,7 +1472,7 @@ static void send_key(SpiceDisplay *display, int
> scancode, SendKeyType type, gboo
>          else {
>              /* ensure delayed key is pressed before other key are released
>              */
>              key_press_delayed(display);
> -            spice_inputs_key_release(d->inputs, scancode);
> +            spice_inputs_channel_key_release(d->inputs, scancode);
>          }
>  
>          d->key_state[i] &= ~m;
> @@ -1989,8 +1989,8 @@ static gboolean motion_event(GtkWidget *widget,
> GdkEventMotion *motion)
>      case SPICE_MOUSE_MODE_CLIENT:
>          if (x >= 0 && x < d->area.width &&
>              y >= 0 && y < d->area.height) {
> -            spice_inputs_position(d->inputs, x, y, get_display_id(display),
> -                                  button_mask_gdk_to_spice(motion->state));
> +            spice_inputs_channel_position(d->inputs, x, y,
> get_display_id(display),
> +
> button_mask_gdk_to_spice(motion->state));
>          }
>          break;
>      case SPICE_MOUSE_MODE_SERVER:
> @@ -1998,8 +1998,8 @@ static gboolean motion_event(GtkWidget *widget,
> GdkEventMotion *motion)
>              gint dx = d->mouse_last_x != -1 ? x - d->mouse_last_x : 0;
>              gint dy = d->mouse_last_y != -1 ? y - d->mouse_last_y : 0;
>  
> -            spice_inputs_motion(d->inputs, dx, dy,
> -                                button_mask_gdk_to_spice(motion->state));
> +            spice_inputs_channel_motion(d->inputs, dx, dy,
> +
> button_mask_gdk_to_spice(motion->state));
>  
>              d->mouse_last_x = x;
>              d->mouse_last_y = y;
> @@ -2036,10 +2036,10 @@ static gboolean scroll_event(GtkWidget *widget,
> GdkEventScroll *scroll)
>          return true;
>      }
>  
> -    spice_inputs_button_press(d->inputs, button,
> -                              button_mask_gdk_to_spice(scroll->state));
> -    spice_inputs_button_release(d->inputs, button,
> -                                button_mask_gdk_to_spice(scroll->state));
> +    spice_inputs_channel_button_press(d->inputs, button,
> +
> button_mask_gdk_to_spice(scroll->state));
> +    spice_inputs_channel_button_release(d->inputs, button,
> +
> button_mask_gdk_to_spice(scroll->state));
>      return true;
>  }
>  
> @@ -2091,14 +2091,14 @@ static gboolean button_event(GtkWidget *widget,
> GdkEventButton *button)
>  
>      switch (button->type) {
>      case GDK_BUTTON_PRESS:
> -        spice_inputs_button_press(d->inputs,
> -                                  button_gdk_to_spice(button->button),
> -                                  button_mask_gdk_to_spice(button->state));
> +        spice_inputs_channel_button_press(d->inputs,
> +
> button_gdk_to_spice(button->button),
> +
> button_mask_gdk_to_spice(button->state));
>          break;
>      case GDK_BUTTON_RELEASE:
> -        spice_inputs_button_release(d->inputs,
> -                                    button_gdk_to_spice(button->button),
> -
> button_mask_gdk_to_spice(button->state));
> +        spice_inputs_channel_button_release(d->inputs,
> +
> button_gdk_to_spice(button->button),
> +
> button_mask_gdk_to_spice(button->state));
>          break;
>      default:
>          break;
> --
> 2.7.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list