[Spice-commits] 2 commits - src/channel-main.c
Pavel Grunt
pgrunt at kemper.freedesktop.org
Thu Jun 25 06:42:01 PDT 2015
src/channel-main.c | 39 ++++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 17 deletions(-)
New commits:
commit 5be627986bf00436b8fd48f365fca47dd87b4754
Author: Pavel Grunt <pgrunt at redhat.com>
Date: Thu Jun 18 17:47:11 2015 +0200
Send monitor config if guest supports sparse monitors
It is ok to send monitor configuration even for displays which are not
disabled or enabled. Because the guest having support for the sparse
monitor configuration (VD_AGENT_CAP_SPARSE_MONITORS_CONFIG) will not
resize the monitor which is disabled / undefined.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=90914
diff --git a/src/channel-main.c b/src/channel-main.c
index 8f5edf2..d573758 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1428,14 +1428,15 @@ static gboolean timer_set_display(gpointer data)
session = spice_channel_get_session(SPICE_CHANNEL(channel));
- /* ensure we have an explicit monitor configuration at least for
- number of display channels */
- for (i = 0; i < spice_session_get_n_display_channels(session); i++)
- if (c->display[i].display_state == DISPLAY_UNDEFINED) {
- SPICE_DEBUG("Not sending monitors config, missing monitors");
- return FALSE;
- }
-
+ if (!spice_main_agent_test_capability(channel, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) {
+ /* ensure we have an explicit monitor configuration at least for
+ number of display channels */
+ for (i = 0; i < spice_session_get_n_display_channels(session); i++)
+ if (c->display[i].display_state == DISPLAY_UNDEFINED) {
+ SPICE_DEBUG("Not sending monitors config, missing monitors");
+ return FALSE;
+ }
+ }
spice_main_send_monitor_config(channel);
return FALSE;
commit 980798534c51fe21af6476f9d15f4e0e19295b07
Author: Pavel Grunt <pgrunt at redhat.com>
Date: Tue Jun 16 15:52:12 2015 +0200
channel-main: Use enum to describe display state
diff --git a/src/channel-main.c b/src/channel-main.c
index c55d097..8f5edf2 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -74,6 +74,12 @@ typedef struct SpiceFileXferTask {
GError *error;
} SpiceFileXferTask;
+typedef enum {
+ DISPLAY_UNDEFINED,
+ DISPLAY_DISABLED,
+ DISPLAY_ENABLED,
+} SpiceDisplayState;
+
struct _SpiceMainChannelPrivate {
enum SpiceMouseMode mouse_mode;
bool agent_connected;
@@ -98,8 +104,7 @@ struct _SpiceMainChannelPrivate {
int y;
int width;
int height;
- gboolean enabled;
- gboolean enabled_set;
+ SpiceDisplayState display_state;
} display[MAX_DISPLAY];
gint timer_id;
GQueue *agent_msg_queue;
@@ -1058,7 +1063,7 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
} else {
monitors = 0;
for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) {
- if (c->display[i].enabled)
+ if (c->display[i].display_state == DISPLAY_ENABLED)
monitors += 1;
}
}
@@ -1073,7 +1078,7 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
j = 0;
for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) {
- if (!c->display[i].enabled) {
+ if (c->display[i].display_state != DISPLAY_ENABLED) {
if (spice_main_agent_test_capability(channel,
VD_AGENT_CAP_SPARSE_MONITORS_CONFIG))
j++;
@@ -1426,7 +1431,7 @@ static gboolean timer_set_display(gpointer data)
/* ensure we have an explicit monitor configuration at least for
number of display channels */
for (i = 0; i < spice_session_get_n_display_channels(session); i++)
- if (!c->display[i].enabled_set) {
+ if (c->display[i].display_state == DISPLAY_UNDEFINED) {
SPICE_DEBUG("Not sending monitors config, missing monitors");
return FALSE;
}
@@ -2742,6 +2747,7 @@ void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint sel
**/
void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled)
{
+ SpiceDisplayState display_state = enabled ? DISPLAY_ENABLED : DISPLAY_DISABLED;
g_return_if_fail(channel != NULL);
g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
g_return_if_fail(id >= -1);
@@ -2751,15 +2757,13 @@ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean
if (id == -1) {
gint i;
for (i = 0; i < G_N_ELEMENTS(c->display); i++) {
- c->display[i].enabled = enabled;
- c->display[i].enabled_set = TRUE;
+ c->display[i].display_state = display_state;
}
} else {
g_return_if_fail(id < G_N_ELEMENTS(c->display));
- if (c->display[id].enabled == enabled)
+ if (c->display[id].display_state == display_state)
return;
- c->display[id].enabled = enabled;
- c->display[id].enabled_set = TRUE;
+ c->display[id].display_state = display_state;
}
update_display_timer(channel, 1);
More information about the Spice-commits
mailing list