[Spice-commits] 3 commits - gtk/channel-display.c gtk/spice-gtk-session.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Tue Apr 15 06:59:17 PDT 2014


 gtk/channel-display.c   |    6 ++++++
 gtk/spice-gtk-session.c |   20 ++++++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit a7e80610e8a7b616b3e502a39052921fb9b51825
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Apr 4 17:46:33 2014 +0200

    display: signal primary-destroy when clearing all surfaces
    
    When destroying the primary surface, we need to signal it, since
    listeners might be referencing the data pointer. Currently, this only
    happens during channel finalize().
    
    This could help with rhbz#1082555.

diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 96fd764..ff9f85c 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -807,12 +807,18 @@ static display_surface *find_surface(SpiceDisplayChannelPrivate *c, guint32 surf
     return g_hash_table_lookup(c->surfaces, GINT_TO_POINTER(surface_id));
 }
 
+/* main or coroutine context */
 static void clear_surfaces(SpiceChannel *channel, gboolean keep_primary)
 {
     SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv;
     GHashTableIter iter;
     display_surface *surface;
 
+    if (!keep_primary) {
+        c->primary = NULL;
+        emit_main_context(channel, SPICE_DISPLAY_PRIMARY_DESTROY);
+    }
+
     g_hash_table_iter_init(&iter, c->surfaces);
     while (g_hash_table_iter_next(&iter, NULL, (gpointer*)&surface)) {
 
commit 3d8deef5f365be5078654bfdb916aba2d0025342
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Apr 4 12:40:36 2014 +0200

    gtk-session: always sync modifiers for client events
    
    The channel state is not synchronous.
    
    It may happen that we want to set and unset quickly a modifier, but the
    guest modifier state hasn't been updated yet, and will still be seen as
    unset, preventing the last unset change.

diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index a83d648..6dc7c93 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -157,32 +157,35 @@ static guint32 get_keyboard_lock_modifiers(void)
 }
 
 static void spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSession *self,
-                                                                  SpiceInputsChannel* inputs)
+                                                                  SpiceInputsChannel* inputs,
+                                                                  gboolean force)
 {
     gint guest_modifiers = 0, client_modifiers = 0;
 
     g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(inputs));
 
     g_object_get(inputs, "key-modifiers", &guest_modifiers, NULL);
-
     client_modifiers = get_keyboard_lock_modifiers();
-    CHANNEL_DEBUG(inputs, "client_modifiers:0x%x, guest_modifiers:0x%x",
-                  client_modifiers, guest_modifiers);
 
-    if (client_modifiers != guest_modifiers)
+    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);
+    }
 }
 
 static void keymap_modifiers_changed(GdkKeymap *keymap, gpointer data)
 {
     SpiceGtkSession *self = data;
+
     spice_gtk_session_sync_keyboard_modifiers(self);
 }
 
 static void guest_modifiers_changed(SpiceInputsChannel *inputs, gpointer data)
 {
     SpiceGtkSession *self = data;
-    spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs);
+
+    spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs, FALSE);
 }
 
 static void spice_gtk_session_init(SpiceGtkSession *self)
@@ -966,7 +969,7 @@ static void channel_new(SpiceSession *session, SpiceChannel *channel,
     if (SPICE_IS_INPUTS_CHANNEL(channel)) {
         spice_g_signal_connect_object(channel, "inputs-modifiers",
                                       G_CALLBACK(guest_modifiers_changed), self, 0);
-        spice_gtk_session_sync_keyboard_modifiers_for_channel(self, SPICE_INPUTS_CHANNEL(channel));
+        spice_gtk_session_sync_keyboard_modifiers_for_channel(self, SPICE_INPUTS_CHANNEL(channel), TRUE);
     }
 }
 
@@ -1133,7 +1136,7 @@ void spice_gtk_session_sync_keyboard_modifiers(SpiceGtkSession *self)
     for (l = channels; l != NULL; l = l->next) {
         if (SPICE_IS_INPUTS_CHANNEL(l->data)) {
             SpiceInputsChannel *inputs = SPICE_INPUTS_CHANNEL(l->data);
-            spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs);
+            spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs, TRUE);
         }
     }
 }
commit d961e53da9eee07a4d52301a8330f485843900ce
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Apr 4 12:13:01 2014 +0200

    gtk-session: s/g_debug/CHANNEL_DEBUG

diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index bc54b7e..a83d648 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -42,6 +42,7 @@
 #include "spice-gtk-session-priv.h"
 #include "spice-session-priv.h"
 #include "spice-util-priv.h"
+#include "spice-channel-priv.h"
 
 #define CLIPBOARD_LAST (VD_AGENT_CLIPBOARD_SELECTION_SECONDARY + 1)
 
@@ -165,8 +166,8 @@ static void spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSessio
     g_object_get(inputs, "key-modifiers", &guest_modifiers, NULL);
 
     client_modifiers = get_keyboard_lock_modifiers();
-    g_debug("%s: input:%p client_modifiers:0x%x, guest_modifiers:0x%x",
-            G_STRFUNC, inputs, client_modifiers, guest_modifiers);
+    CHANNEL_DEBUG(inputs, "client_modifiers:0x%x, guest_modifiers:0x%x",
+                  client_modifiers, guest_modifiers);
 
     if (client_modifiers != guest_modifiers)
         spice_inputs_set_key_locks(inputs, client_modifiers);


More information about the Spice-commits mailing list