[Spice-commits] 5 commits - src/channel-display.c src/channel-main.c src/smartcard-manager.c src/smartcard-manager.h src/spice-audio.c src/spice-audio.h src/spice-channel.c src/spice-channel.h src/spice-session.c src/spice-session.h src/spice-util.h src/spice-widget.c src/spice-widget-cairo.c src/spice-widget-priv.h src/usb-device-manager.c src/usb-device-manager.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 9 17:36:44 UTC 2021


 src/channel-display.c    |    4 ++--
 src/channel-main.c       |   12 ++++++------
 src/smartcard-manager.c  |    2 ++
 src/smartcard-manager.h  |    2 +-
 src/spice-audio.c        |    2 ++
 src/spice-audio.h        |    2 +-
 src/spice-channel.c      |    2 ++
 src/spice-channel.h      |    2 +-
 src/spice-session.c      |    2 ++
 src/spice-session.h      |    2 +-
 src/spice-util.h         |    3 ++-
 src/spice-widget-cairo.c |    2 +-
 src/spice-widget-priv.h  |    2 +-
 src/spice-widget.c       |    4 ++--
 src/usb-device-manager.c |    2 ++
 src/usb-device-manager.h |    2 +-
 16 files changed, 29 insertions(+), 18 deletions(-)

New commits:
commit c83d09ba103c88f0690ad514c7786072fa0c3ca5
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Apr 9 16:42:56 2021 +0400

    Add clipboard function array annotations
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index 060b70c..fcf6252 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2883,7 +2883,7 @@ void spice_main_set_display(SpiceMainChannel *channel, int id,
 /**
  * spice_main_clipboard_grab:
  * @channel: a #SpiceMainChannel
- * @types: an array of #VD_AGENT_CLIPBOARD types available in the clipboard
+ * @types: (transfer none)(array length=ntypes): an array of #VD_AGENT_CLIPBOARD types available in the clipboard
  * @ntypes: the number of @types
  *
  * Grab the guest clipboard, with #VD_AGENT_CLIPBOARD @types.
@@ -2900,7 +2900,7 @@ void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int nt
  * spice_main_clipboard_selection_grab:
  * @channel: a #SpiceMainChannel
  * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*
- * @types: an array of #VD_AGENT_CLIPBOARD types available in the clipboard
+ * @types: (transfer none)(array length=ntypes): an array of #VD_AGENT_CLIPBOARD types available in the clipboard
  * @ntypes: the number of @types
  *
  * Grab the guest clipboard, with #VD_AGENT_CLIPBOARD @types.
@@ -2918,7 +2918,7 @@ void spice_main_clipboard_selection_grab(SpiceMainChannel *channel, guint select
  * spice_main_channel_clipboard_selection_grab:
  * @channel: a #SpiceMainChannel
  * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*
- * @types: an array of #VD_AGENT_CLIPBOARD types available in the clipboard
+ * @types: (transfer none)(array length=ntypes): an array of #VD_AGENT_CLIPBOARD types available in the clipboard
  * @ntypes: the number of @types
  *
  * Grab the guest clipboard, with #VD_AGENT_CLIPBOARD @types.
@@ -2993,7 +2993,7 @@ void spice_main_channel_clipboard_selection_release(SpiceMainChannel *channel, g
  * spice_main_clipboard_notify:
  * @channel: a #SpiceMainChannel
  * @type: a #VD_AGENT_CLIPBOARD type
- * @data: clipboard data
+ * @data: (array length=size): clipboard data
  * @size: data length in bytes
  *
  * Send the clipboard data to the guest.
@@ -3012,7 +3012,7 @@ void spice_main_clipboard_notify(SpiceMainChannel *channel,
  * @channel: a #SpiceMainChannel
  * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*
  * @type: a #VD_AGENT_CLIPBOARD type
- * @data: clipboard data
+ * @data: (array length=size): clipboard data
  * @size: data length in bytes
  *
  * Send the clipboard data to the guest.
@@ -3031,7 +3031,7 @@ void spice_main_clipboard_selection_notify(SpiceMainChannel *channel, guint sele
  * @channel: a #SpiceMainChannel
  * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*
  * @type: a #VD_AGENT_CLIPBOARD type
- * @data: clipboard data
+ * @data: (array length=size): clipboard data
  * @size: data length in bytes
  *
  * Send the clipboard data to the guest.
commit cce47d9410ba5dc4493dae8e1b5bcd608e09cf33
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Apr 9 16:09:53 2021 +0400

    Fix spice_display_channel_change_preferred_video_codec_types annotations
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/channel-display.c b/src/channel-display.c
index f52ef12..443504b 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -683,9 +683,9 @@ void spice_display_channel_change_preferred_video_codec_type(SpiceChannel *chann
 }
 
 /**
- * spice_display_channel_change_preferred_video_codecs_types:
+ * spice_display_channel_change_preferred_video_codec_types:
  * @channel: a #SpiceDisplayChannel
- * @codecs: an array of @ncodecs #SpiceVideoCodecType types
+ * @codecs: (array length=ncodecs): an array of @ncodecs #SpiceVideoCodecType types
  * @ncodecs: the number of codec types in the @codecs array
  * @err: #GError describing the reason why the change failed
  *
commit 84a88176b15d65cad05d2a10c22e50b74410f634
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Apr 9 13:33:08 2021 +0400

    Fix g-i class size binding
    
    gir fails to compute the size of the array, which results in invalid
    class size. Deprecate usage of SPICE_RESERVED_PADDING, which isn't that
    useful anyway.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/smartcard-manager.h b/src/smartcard-manager.h
index 3ee519e..b7a8b25 100644
--- a/src/smartcard-manager.h
+++ b/src/smartcard-manager.h
@@ -85,7 +85,7 @@ struct _SpiceSmartcardManagerClass
      * If adding fields to this struct, remove corresponding
      * amount of padding to avoid changing overall struct size
      */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
+    gpointer _spice_reserved[10];
 };
 
 GType spice_smartcard_manager_get_type(void);
diff --git a/src/spice-audio.h b/src/spice-audio.h
index c033455..d6ecf64 100644
--- a/src/spice-audio.h
+++ b/src/spice-audio.h
@@ -95,7 +95,7 @@ struct _SpiceAudioClass {
                                               guint16 **volume,
                                               GError **error);
 
-    gchar _spice_reserved[SPICE_RESERVED_PADDING - 4 * sizeof(void *)];
+    gpointer _spice_reserved[6];
 };
 
 GType spice_audio_get_type(void);
diff --git a/src/spice-channel.h b/src/spice-channel.h
index ec4a356..1e163eb 100644
--- a/src/spice-channel.h
+++ b/src/spice-channel.h
@@ -119,7 +119,7 @@ struct _SpiceChannelClass
      * If adding fields to this struct, remove corresponding
      * amount of padding to avoid changing overall struct size
      */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING - 2 * sizeof(void *)];
+    gpointer _spice_reserved[8];
 };
 
 GType spice_channel_get_type(void);
diff --git a/src/spice-session.h b/src/spice-session.h
index 07c7b14..d54ad41 100644
--- a/src/spice-session.h
+++ b/src/spice-session.h
@@ -101,7 +101,7 @@ struct _SpiceSessionClass
      * If adding fields to this struct, remove corresponding
      * amount of padding to avoid changing overall struct size
      */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
+    gpointer  _spice_reserved[10];
 };
 
 GType spice_session_get_type(void);
diff --git a/src/spice-util.h b/src/spice-util.h
index fd1adc3..421b4b0 100644
--- a/src/spice-util.h
+++ b/src/spice-util.h
@@ -37,7 +37,8 @@ gchar* spice_uuid_to_string(const guint8 uuid[16]);
             g_debug(G_STRLOC " " fmt, ## __VA_ARGS__);          \
     } while (0)
 
-#define SPICE_RESERVED_PADDING (10 * sizeof(void*))
+
+#define SPICE_RESERVED_PADDING (10 * sizeof(void*)) GLIB_DEPRECATED_MACRO
 
 G_END_DECLS
 
diff --git a/src/usb-device-manager.h b/src/usb-device-manager.h
index d8d1cb8..4747dd4 100644
--- a/src/usb-device-manager.h
+++ b/src/usb-device-manager.h
@@ -93,7 +93,7 @@ struct _SpiceUsbDeviceManagerClass
      * If adding fields to this struct, remove corresponding
      * amount of padding to avoid changing overall struct size
      */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
+    gpointer _spice_reserved[10];
 };
 
 GType spice_usb_device_get_type(void);
commit 94717418e57abc979c2fe699487219879da624bb
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Apr 9 21:19:28 2021 +0400

    Add some ABI size checks for what we are modifying next
    
    We are about to modify the struct fields, let's make sure we don't break
    the ABI.
    
    Once check-abi is added to our CI, this shouldn't be needed, and can
    probably be reverted.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index 16cf88a..bb97ad7 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -43,6 +43,8 @@
  * guest using 3 certificates available to the client).
  */
 
+G_STATIC_ASSERT(sizeof(SpiceSmartcardManagerClass) == sizeof(GObjectClass) + 14 * sizeof(gpointer));
+
 struct _SpiceSmartcardManagerPrivate {
     guint monitor_id;
 
diff --git a/src/spice-audio.c b/src/spice-audio.c
index 43ece99..8a5714e 100644
--- a/src/spice-audio.c
+++ b/src/spice-audio.c
@@ -42,6 +42,8 @@
 #include "spice-audio-priv.h"
 #include "spice-gstaudio.h"
 
+G_STATIC_ASSERT(sizeof(SpiceAudioClass) == sizeof(GObjectClass) + 11 * sizeof(gpointer));
+
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(SpiceAudio, spice_audio, G_TYPE_OBJECT)
 
 enum {
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 3ccf452..ab38571 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -46,6 +46,8 @@
 
 #include "gio-coroutine.h"
 
+G_STATIC_ASSERT(sizeof(SpiceChannelClass) == sizeof(GObjectClass) + 19 * sizeof(gpointer));
+
 static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg);
 static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out);
 static void spice_channel_send_link(SpiceChannel *channel);
diff --git a/src/spice-session.c b/src/spice-session.c
index ed38182..d6ec344 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -34,6 +34,8 @@
 #include "channel-playback-priv.h"
 #include "spice-audio-priv.h"
 
+G_STATIC_ASSERT(sizeof(SpiceSessionClass) == sizeof(GObjectClass) + 12 * sizeof(gpointer));
+
 #if !defined(SOL_TCP) && defined(IPPROTO_TCP)
 #define SOL_TCP IPPROTO_TCP
 #endif
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 471f134..738eba5 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -67,6 +67,8 @@
  * spice_usb_device_manager_get() which ensures this 1:1 relation.
  */
 
+G_STATIC_ASSERT(sizeof(SpiceUsbDeviceManagerClass) == sizeof(GObjectClass) + 14 * sizeof(gpointer));
+
 enum {
     PROP_0,
     PROP_SESSION,
commit a36184001c894f25409392173e5f32c537b8b835
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Feb 12 00:27:33 2021 +0400

    Rename spice_cairo_is_scaled -> allow_scaling
    
    As it is just a getter for allow_scaling.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/spice-widget-cairo.c b/src/spice-widget-cairo.c
index 4d25c08..fec6363 100644
--- a/src/spice-widget-cairo.c
+++ b/src/spice-widget-cairo.c
@@ -141,7 +141,7 @@ void spice_cairo_draw_event(SpiceDisplay *display, cairo_t *cr)
 }
 
 G_GNUC_INTERNAL
-gboolean spice_cairo_is_scaled(SpiceDisplay *display)
+gboolean spice_allow_scaling(SpiceDisplay *display)
 {
     SpiceDisplayPrivate *d = display->priv;
     return d->allow_scaling;
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index a9883d6..2c68716 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -158,7 +158,7 @@ struct _SpiceDisplayPrivate {
 int      spice_cairo_image_create                 (SpiceDisplay *display);
 void     spice_cairo_image_destroy                (SpiceDisplay *display);
 void     spice_cairo_draw_event                   (SpiceDisplay *display, cairo_t *cr);
-gboolean spice_cairo_is_scaled                    (SpiceDisplay *display);
+gboolean spice_allow_scaling                      (SpiceDisplay *display);
 void     spice_display_get_scaling           (SpiceDisplay *display, double *s, int *x, int *y, int *w, int *h);
 gboolean spice_egl_init                      (SpiceDisplay *display, GError **err);
 gboolean spice_egl_realize_display           (SpiceDisplay *display, GdkWindow *win,
diff --git a/src/spice-widget.c b/src/spice-widget.c
index b618b76..50824bf 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1364,7 +1364,7 @@ static void recalc_geometry(GtkWidget *widget)
     gint scale_factor, height_mm = 0, width_mm = 0;
     bool has_display_mm = false;
 
-    if (spice_cairo_is_scaled(display))
+    if (spice_allow_scaling(display))
         zoom = (gdouble)d->zoom_level / 100;
 
     scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
@@ -3137,7 +3137,7 @@ void spice_display_get_scaling(SpiceDisplay *display,
         wh = fbh;
     }
 
-    if (!spice_cairo_is_scaled(display)) {
+    if (!spice_allow_scaling(display)) {
         s = 1.0;
         x = 0;
         y = 0;


More information about the Spice-commits mailing list