[Spice-commits] 4 commits - gtk/channel-main.c gtk/controller gtk/spice-gtk-session.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Thu Mar 21 12:19:57 PDT 2013


 gtk/channel-main.c          |    8 ++++++--
 gtk/controller/win32-util.c |    3 +--
 gtk/spice-gtk-session.c     |   22 ++++++++++------------
 3 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit be078a0d0b531096e59667d729db01309e97646e
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Mar 21 19:28:41 2013 +0100

    gtk-session: remove clipboard timeout
    
    A large clipboard may take longer than 7s on slow networks. Since the
    Gtk+ API forces us to use an inner main-loop, exit it asap, if agent
    is disconnected for instance.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=752483

diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index 555085b..47c7d36 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -552,7 +552,6 @@ typedef struct
     GMainLoop *loop;
     GtkSelectionData *selection_data;
     guint info;
-    gulong timeout_handler;
     guint selection;
 } RunInfo;
 
@@ -574,16 +573,12 @@ static void clipboard_got_from_guest(SpiceMainChannel *main, guint selection,
         g_main_loop_quit (ri->loop);
 }
 
-static gboolean clipboard_timeout(gpointer user_data)
+static void clipboard_agent_connected(RunInfo *ri)
 {
-    RunInfo *ri = user_data;
+    g_warning("agent status changed, cancel clipboard request");
 
-    g_warning("clipboard get timed out");
-    if (g_main_loop_is_running (ri->loop))
-        g_main_loop_quit (ri->loop);
-
-    ri->timeout_handler = 0;
-    return FALSE;
+    if (g_main_loop_is_running(ri->loop))
+        g_main_loop_quit(ri->loop);
 }
 
 static void clipboard_get(GtkClipboard *clipboard,
@@ -596,6 +591,7 @@ static void clipboard_get(GtkClipboard *clipboard,
     SpiceGtkSession *self = user_data;
     SpiceGtkSessionPrivate *s = self->priv;
     gulong clipboard_handler;
+    gulong agent_handler;
     int selection;
 
     SPICE_DEBUG("clipboard get");
@@ -613,7 +609,10 @@ static void clipboard_get(GtkClipboard *clipboard,
     clipboard_handler = g_signal_connect(s->main, "main-clipboard-selection",
                                          G_CALLBACK(clipboard_got_from_guest),
                                          &ri);
-    ri.timeout_handler = g_timeout_add_seconds(7, clipboard_timeout, &ri);
+    agent_handler = g_signal_connect(s->main, "notify::agent-connected",
+                                     G_CALLBACK(clipboard_agent_connected),
+                                     &ri);
+
     spice_main_clipboard_selection_request(s->main, selection,
                                            atom2agent[info].vdagent);
 
@@ -626,8 +625,7 @@ static void clipboard_get(GtkClipboard *clipboard,
     g_main_loop_unref(ri.loop);
     ri.loop = NULL;
     g_signal_handler_disconnect(s->main, clipboard_handler);
-    if (ri.timeout_handler != 0)
-        g_source_remove(ri.timeout_handler);
+    g_signal_handler_disconnect(s->main, agent_handler);
 }
 
 static void clipboard_clear(GtkClipboard *clipboard, gpointer user_data)
commit 299e3407d998b586a5d6c712e32e647b1a937f38
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Mar 21 19:27:29 2013 +0100

    main: warn if receiving message from disconnected agent

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index b2b9b1b..544df1d 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1889,6 +1889,8 @@ static void main_handle_agent_data(SpiceChannel *channel, SpiceMsgIn *in)
     guint8 *data;
     int len;
 
+    g_warn_if_fail(c->agent_connected);
+
     /* shortcut to avoid extra message allocation & copy if possible */
     if (c->agent_msg_pos == 0) {
         VDAgentMessage *msg;
commit ecfaf1e9a0c481ac283aebdfee3f78cab92695e4
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Mar 21 19:27:03 2013 +0100

    main: only notify on agent status change

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 2104f49..b2b9b1b 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1318,9 +1318,11 @@ static void set_agent_connected(SpiceMainChannel *channel, gboolean connected)
 {
     SpiceMainChannelPrivate *c = channel->priv;
 
-    c->agent_connected = connected;
     SPICE_DEBUG("agent connected: %s", spice_yes_no(connected));
-    g_object_notify_main_context(G_OBJECT(channel), "agent-connected");
+    if (connected != c->agent_connected) {
+        c->agent_connected = connected;
+        g_object_notify_main_context(G_OBJECT(channel), "agent-connected");
+    }
 
     update_display_timer(channel, 0);
 }
commit a1ddb857c1acf7a03c7a79fd273a19deac4f6351
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Tue Mar 19 21:08:03 2013 +0100

    controller: don't try to set integrity on XP x64 edition
    
    XP x64 uses version 5.2, but doesn't accept setting the pipe to low
    integrity.
    
    5.2 seems to be shared with many versions (server 2003 for example),
    but only Vista+ matters, which is only major >=6.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=918342

diff --git a/gtk/controller/win32-util.c b/gtk/controller/win32-util.c
index 3562154..ea68814 100644
--- a/gtk/controller/win32-util.c
+++ b/gtk/controller/win32-util.c
@@ -147,8 +147,7 @@ spice_win32_user_pipe_new (gchar *name, GError **error)
     }
 
     /* lower integrity on Vista/Win7+ */
-    if ((LOBYTE (g_win32_get_windows_version()) > 0x05
-         || LOWORD (g_win32_get_windows_version()) > 0x0105) &&
+    if ((LOBYTE (g_win32_get_windows_version()) > 0x05) &&
         !spice_win32_set_low_integrity (pipe, error))
         goto end;
 


More information about the Spice-commits mailing list