[Spice-commits] 2 commits - gtk/channel-display.c gtk/channel-main.c
Marc-André Lureau
elmarco at kemper.freedesktop.org
Sat Mar 16 10:31:23 PDT 2013
gtk/channel-display.c | 5 +++++
gtk/channel-main.c | 49 ++++++++++++++++++++++++++++---------------------
2 files changed, 33 insertions(+), 21 deletions(-)
New commits:
commit c0f49d49af80f0d333989c95d1ab6bd68c258e85
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Fri Mar 15 20:26:50 2013 +0100
Notify of monitors when not using MonitorConfig
Windows guest don't use MonitorConfig, but we may want to notify the
client of the number of monitors.
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=919530
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index c098ddb..2b44b43 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -889,6 +889,11 @@ static void spice_display_channel_up(SpiceChannel *channel)
out = spice_msg_out_new(channel, SPICE_MSGC_DISPLAY_INIT);
out->marshallers->msgc_display_init(out->marshaller, &init);
spice_msg_out_send_internal(out);
+
+ /* if we are not using monitors config, notify of existence of
+ this monitor */
+ if (channel->priv->channel_id != 0)
+ g_object_notify_main_context(G_OBJECT(channel), "monitors");
}
#define DRAW(type) { \
commit 801f10d485c5133cd4d27ee43f2f1bc8307a24b5
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Fri Mar 15 20:24:38 2013 +0100
Update current resolution when agent is started
This ensures we have the requested resolution whenever possible.
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 2039a8a..2104f49 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1289,6 +1289,30 @@ static void agent_clipboard_release(SpiceMainChannel *channel, guint selection)
agent_msg_queue(channel, VD_AGENT_CLIPBOARD_RELEASE, msgsize, msg);
}
+/* main context*/
+static gboolean timer_set_display(gpointer data)
+{
+ SpiceMainChannel *channel = data;
+ SpiceMainChannelPrivate *c = channel->priv;
+
+ c->timer_id = 0;
+ if (c->agent_connected)
+ spice_main_send_monitor_config(channel);
+
+ return FALSE;
+}
+
+/* any context */
+static void update_display_timer(SpiceMainChannel *channel, guint seconds)
+{
+ SpiceMainChannelPrivate *c = channel->priv;
+
+ if (c->timer_id)
+ g_source_remove(c->timer_id);
+
+ c->timer_id = g_timeout_add_seconds(seconds, timer_set_display, channel);
+}
+
/* coroutine context */
static void set_agent_connected(SpiceMainChannel *channel, gboolean connected)
{
@@ -1297,6 +1321,8 @@ static void set_agent_connected(SpiceMainChannel *channel, gboolean connected)
c->agent_connected = connected;
SPICE_DEBUG("agent connected: %s", spice_yes_no(connected));
g_object_notify_main_context(G_OBJECT(channel), "agent-connected");
+
+ update_display_timer(channel, 0);
}
/* coroutine context */
@@ -2320,19 +2346,6 @@ static void spice_main_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg)
g_return_if_reached();
}
-/* system context*/
-static gboolean timer_set_display(gpointer data)
-{
- SpiceChannel *channel = data;
- SpiceMainChannelPrivate *c = SPICE_MAIN_CHANNEL(channel)->priv;
-
- c->timer_id = 0;
- if (c->agent_connected)
- spice_main_send_monitor_config(SPICE_MAIN_CHANNEL(channel));
-
- return false;
-}
-
/**
* spice_main_agent_test_capability:
* @channel:
@@ -2387,10 +2400,7 @@ void spice_main_set_display(SpiceMainChannel *channel, int id,
c->display[id].width = width;
c->display[id].height = height;
- if (c->timer_id) {
- g_source_remove(c->timer_id);
- }
- c->timer_id = g_timeout_add_seconds(1, timer_set_display, channel);
+ update_display_timer(channel, 1);
}
/**
@@ -2572,10 +2582,7 @@ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean
c->display[id].enabled = enabled;
}
- if (c->timer_id) {
- g_source_remove(c->timer_id);
- }
- c->timer_id = g_timeout_add_seconds(1, timer_set_display, channel);
+ update_display_timer(channel, 1);
}
static void file_xfer_failed(SpiceFileXferTask *task, GError *error)
More information about the Spice-commits
mailing list