[Spice-commits] 4 commits - gtk/channel-playback.h gtk/channel-record.h gtk/Makefile.am gtk/spice-audio.c gtk/spice-audio.h gtk/spice-channel.h gtk/spice-session.c gtk/spice-util.h gtk/spice-widget.c gtk/usb-device-manager.h spice-common

Marc-André Lureau elmarco at kemper.freedesktop.org
Mon May 21 11:21:53 PDT 2012


 gtk/Makefile.am          |    4 ++--
 gtk/channel-playback.h   |    6 +-----
 gtk/channel-record.h     |    6 +-----
 gtk/spice-audio.c        |   10 +++++-----
 gtk/spice-audio.h        |    5 +++--
 gtk/spice-channel.h      |   16 ++++++++--------
 gtk/spice-session.c      |    8 ++++++--
 gtk/spice-util.h         |    2 +-
 gtk/spice-widget.c       |   23 ++++++++++++++++-------
 gtk/usb-device-manager.h |    2 +-
 spice-common             |    2 +-
 11 files changed, 45 insertions(+), 39 deletions(-)

New commits:
commit 4e419a1223fa4a44c02e76fa4972db3d6518c839
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri May 18 15:27:03 2012 +0200

    Reset grab-sequence on match
    
    This avoids triggering the grab event on consecutive
    matches, such as ctrl+alt (match) then ctrl+alt+foo
    (match again) that would prevent the longer combination
    from being sent.

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 86d5f3e..0abd4c6 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -941,11 +941,7 @@ static gboolean check_for_grab_key(SpiceDisplay *display, int type, int keyval)
     if (!d->grabseq->nkeysyms)
         return FALSE;
 
-    if (type == GDK_KEY_RELEASE) {
-        /* Any key release resets the whole grab sequence */
-        memset(d->activeseq, 0, sizeof(gboolean) * d->grabseq->nkeysyms);
-        return FALSE;
-    } else {
+    if (type == GDK_KEY_PRESS) {
         /* Record the new key press */
         for (i = 0 ; i < d->grabseq->nkeysyms ; i++)
             if (d->grabseq->keysyms[i] == keyval)
@@ -956,8 +952,17 @@ static gboolean check_for_grab_key(SpiceDisplay *display, int type, int keyval)
             if (d->activeseq[i] == FALSE)
                 return FALSE;
 
+        /* resets the whole grab sequence on success */
+        memset(d->activeseq, 0, sizeof(gboolean) * d->grabseq->nkeysyms);
         return TRUE;
-    }
+    } else if (type == GDK_KEY_RELEASE) {
+        /* Any key release resets the whole grab sequence */
+        memset(d->activeseq, 0, sizeof(gboolean) * d->grabseq->nkeysyms);
+        return FALSE;
+    } else
+        g_warn_if_reached();
+
+    return FALSE;
 }
 
 static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
@@ -999,6 +1004,7 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
         send_key(display, scancode, 0);
         break;
     default:
+        g_warn_if_reached();
         break;
     }
 
commit a18782415967fbc036608ccbba6005819ad7f58c
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu May 17 23:41:37 2012 +0200

    If grab sequence is matched, still send modifier keys
    
    If the last key pressed from the grab sequence is a modifier
    key, let send it to the guest too.
    
    This solves the issue of default grab-sequence being ctrl+alt
    and preventing ctrl+alt+del from working.

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index e6c252d..86d5f3e 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -980,7 +980,10 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
                 try_mouse_grab(display);
         }
 
-        return true;
+        // that's the last key pressed from the grab sequence
+        // let send it to the remote if it's a modifier key
+        if (!key->is_modifier)
+            return true;
     }
 
     if (!d->inputs)
commit 524277aab259fa07e9cd83288cfd1b9ac838b7e6
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu May 17 16:09:59 2012 +0200

    Running out of reserved space, break ABI
    
    The change abc56811de978ad336a651924a21b920cfe677f0 actually added
    a field in a public struct while changing overall struct size, the
    fields were also reorder, all of this breaks ABI.
    
    However, we are running out of free space in SpiceChannelClass
    struct. And since the SPICE_RESERVED_PADDING was 44 bytes, that is
    quite limited on 64bits (only 5 pointers fit).
    
    I propose we break ABI during this cycle. This means that programs
    using spice-gtk will need to be recompiled to use the new library.
    (the old library should be parallel installable though). This let us:
    - use a better SPICE_RESERVED_PADDING based on pointer size, since
      it is what is usually added for virtual methods
    - reset the amount taken from the padding in the various struct
    - reorder fields a little
    - add some missing "priv" pointers
    - whatever I am missing that we can still change before next release
    
    Please comment if I am missing something, or correct me

diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 7b29e61..0327d65 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -91,7 +91,7 @@ AM_CPPFLAGS =					\
 
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
 SPICE_GTK_LDFLAGS_COMMON =		\
-	-version-info 3:0:2		\
+	-version-info 4:0:0		\
 	-no-undefined			\
 	$(VERSION_LDFLAGS)		\
 	$(NULL)
@@ -158,7 +158,7 @@ nodist_libspice_client_gtkinclude_HEADERS =	\
 	$(NULL)
 
 libspice_client_glib_2_0_la_LDFLAGS =	\
-	-version-info 7:0:6		\
+	-version-info 8:0:0		\
 	-no-undefined			\
 	$(VERSION_LDFLAGS)		\
 	$(NULL)
diff --git a/gtk/channel-playback.h b/gtk/channel-playback.h
index 6341cac..9cf68cf 100644
--- a/gtk/channel-playback.h
+++ b/gtk/channel-playback.h
@@ -65,11 +65,7 @@ struct _SpicePlaybackChannelClass {
     void (*playback_stop)(SpicePlaybackChannel *channel);
 
     /*< private >*/
-    /*
-     * If adding fields to this struct, remove corresponding
-     * amount of padding to avoid changing overall struct size
-     */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
+    /* Do not add fields to this struct */
 };
 
 GType           spice_playback_channel_get_type(void);
diff --git a/gtk/channel-record.h b/gtk/channel-record.h
index 73bdb76..20a9ad3 100644
--- a/gtk/channel-record.h
+++ b/gtk/channel-record.h
@@ -65,11 +65,7 @@ struct _SpiceRecordChannelClass {
     void (*record_stop)(SpiceRecordChannel *channel);
 
     /*< private >*/
-    /*
-     * If adding fields to this struct, remove corresponding
-     * amount of padding to avoid changing overall struct size
-     */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
+    /* Do not add fields to this struct */
 };
 
 GType	        spice_record_channel_get_type(void);
diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
index 30c2920..6cf8f01 100644
--- a/gtk/spice-audio.c
+++ b/gtk/spice-audio.c
@@ -67,7 +67,7 @@ enum {
 static void spice_audio_finalize(GObject *gobject)
 {
     SpiceAudio *self = SPICE_AUDIO(gobject);
-    SpiceAudioPrivate *priv = SPICE_AUDIO_GET_PRIVATE(self);
+    SpiceAudioPrivate *priv = self->priv;
 
     if (priv->main_context) {
         g_main_context_unref(priv->main_context);
@@ -84,7 +84,7 @@ static void spice_audio_get_property(GObject *gobject,
                                      GParamSpec *pspec)
 {
     SpiceAudio *self = SPICE_AUDIO(gobject);
-    SpiceAudioPrivate *priv = SPICE_AUDIO_GET_PRIVATE(self);
+    SpiceAudioPrivate *priv = self->priv;
 
     switch (prop_id) {
     case PROP_SESSION:
@@ -105,7 +105,7 @@ static void spice_audio_set_property(GObject *gobject,
                                      GParamSpec *pspec)
 {
     SpiceAudio *self = SPICE_AUDIO(gobject);
-    SpiceAudioPrivate *priv = SPICE_AUDIO_GET_PRIVATE(self);
+    SpiceAudioPrivate *priv = self->priv;
 
     switch (prop_id) {
     case PROP_SESSION:
@@ -152,9 +152,9 @@ static void spice_audio_class_init(SpiceAudioClass *klass)
     g_type_class_add_private(klass, sizeof(SpiceAudioPrivate));
 }
 
-static void spice_audio_init(SpiceAudio *self G_GNUC_UNUSED)
+static void spice_audio_init(SpiceAudio *self)
 {
-    /* FIXME: self->priv = SPICE_AUDIO_GET_PRIVATE(audio) when ABI break */
+    self->priv = SPICE_AUDIO_GET_PRIVATE(self);
 }
 
 static void connect_channel(SpiceAudio *self, SpiceChannel *channel)
diff --git a/gtk/spice-audio.h b/gtk/spice-audio.h
index 732fea1..ebc4946 100644
--- a/gtk/spice-audio.h
+++ b/gtk/spice-audio.h
@@ -52,7 +52,8 @@ typedef struct _SpiceAudioPrivate SpiceAudioPrivate;
  */
 struct _SpiceAudio {
     GObject parent;
-    /* FIXME: break ABI!! SpiceAudioPrivate *priv; */
+
+    SpiceAudioPrivate *priv;
 };
 
 /**
@@ -67,7 +68,7 @@ struct _SpiceAudioClass {
     /*< private >*/
     gboolean (*connect_channel)(SpiceAudio *audio, SpiceChannel *channel);
 
-    gchar _spice_reserved[SPICE_RESERVED_PADDING - sizeof(void*)];
+    gchar _spice_reserved[SPICE_RESERVED_PADDING];
 };
 
 GType spice_audio_get_type(void);
diff --git a/gtk/spice-channel.h b/gtk/spice-channel.h
index f722c99..982b73b 100644
--- a/gtk/spice-channel.h
+++ b/gtk/spice-channel.h
@@ -72,29 +72,29 @@ struct _SpiceChannelClass
 {
     GObjectClass parent_class;
 
+    /*< public >*/
+    /* signals, main context */
+    void (*channel_event)(SpiceChannel *channel, SpiceChannelEvent event);
+    void (*open_fd)(SpiceChannel *channel, int with_tls);
+
     /*< private >*/
     /* virtual methods, coroutine context */
     void (*handle_msg)(SpiceChannel *channel, SpiceMsgIn *msg);
     void (*channel_up)(SpiceChannel *channel);
     void (*iterate_write)(SpiceChannel *channel);
     void (*iterate_read)(SpiceChannel *channel);
-    void (*channel_reset_capabilities)(SpiceChannel *channel);
-
-    /*< public >*/
-    /* signals, main context */
-    void (*channel_event)(SpiceChannel *channel, SpiceChannelEvent event);
-    void (*open_fd)(SpiceChannel *channel, int with_tls);
 
     /*< private >*/
     /* virtual method, any context */
     void (*channel_disconnect)(SpiceChannel *channel);
-
     void (*channel_reset)(SpiceChannel *channel, gboolean migrating);
+    void (*channel_reset_capabilities)(SpiceChannel *channel);
+
     /*
      * If adding fields to this struct, remove corresponding
      * amount of padding to avoid changing overall struct size
      */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING - 5 * sizeof(void*)];
+    gchar _spice_reserved[SPICE_RESERVED_PADDING];
 };
 
 GType spice_channel_get_type(void);
diff --git a/gtk/spice-util.h b/gtk/spice-util.h
index 5bd24d3..7a617f4 100644
--- a/gtk/spice-util.h
+++ b/gtk/spice-util.h
@@ -37,7 +37,7 @@ gulong spice_g_signal_connect_object(gpointer instance,
             g_debug(G_STRLOC " " fmt, ## __VA_ARGS__);          \
     } while (0)
 
-#define SPICE_RESERVED_PADDING 44
+#define SPICE_RESERVED_PADDING (10 * sizeof(void*))
 
 #ifndef SPICE_NO_DEPRECATED
 #define SPICE_DEPRECATED_FOR(f) \
diff --git a/gtk/usb-device-manager.h b/gtk/usb-device-manager.h
index ba917da..df138ee 100644
--- a/gtk/usb-device-manager.h
+++ b/gtk/usb-device-manager.h
@@ -82,7 +82,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 - sizeof(void*)];
+    gchar _spice_reserved[SPICE_RESERVED_PADDING];
 };
 
 GType spice_usb_device_get_type(void);
commit dbde50a6468cabf2b9093b030726a20312b267bb
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu May 17 14:40:45 2012 +0200

    session: correctly set and unset ssl-verify flags
    
    If no cert-subject or pubkey is provided, we should unset the corresponding flags.

diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index b3c66ce..17b1fe8 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -519,13 +519,17 @@ static void spice_session_set_property(GObject      *gobject,
             g_byte_array_unref(s->pubkey);
         s->pubkey = g_value_dup_boxed(value);
         if (s->pubkey)
-            s->verify = SPICE_SESSION_VERIFY_PUBKEY;
+            s->verify |= SPICE_SESSION_VERIFY_PUBKEY;
+        else
+            s->verify &= ~SPICE_SESSION_VERIFY_PUBKEY;
 	break;
     case PROP_CERT_SUBJECT:
         g_free(s->cert_subject);
         s->cert_subject = g_value_dup_string(value);
         if (s->cert_subject)
-            s->verify = SPICE_SESSION_VERIFY_SUBJECT;
+            s->verify |= SPICE_SESSION_VERIFY_SUBJECT;
+        else
+            s->verify &= ~SPICE_SESSION_VERIFY_SUBJECT;
         break;
     case PROP_VERIFY:
         s->verify = g_value_get_flags(value);
diff --git a/spice-common b/spice-common
index 22fc0b0..5f44094 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 22fc0b0145876b90385c1c88923bcd72a6380812
+Subproject commit 5f4409494066b5f59df58d6207fdbb0441aa9e90


More information about the Spice-commits mailing list