summaryrefslogtreecommitdiffstats
path: root/src/virt-viewer-session-spice.c
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2013-10-24 15:04:54 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2013-11-27 10:35:22 -0600
commit33614f86db490364339ef69e0eb76f98a4ac8138 (patch)
treead415dcf85c7b98883e07dc0b33242764a2d75ec /src/virt-viewer-session-spice.c
parentc57f0f3df9a4e68d66e0aa3644e66557d423cfdb (diff)
downloadvirt-viewer-33614f86db490364339ef69e0eb76f98a4ac8138.tar.gz
virt-viewer-33614f86db490364339ef69e0eb76f98a4ac8138.tar.xz
virt-viewer-33614f86db490364339ef69e0eb76f98a4ac8138.zip
Do all display alignment in virt-viewer
Don't rely on spice-gtk to do any alignment of displays. This patch sets the disable-display-align property on the SpiceMainChannel, and makes the VirtViewerSession in charge of doing all alignment. This means that every display has to tell the VirtViewerSession when its "virtual monitor" has changed configuration (and wants to reconfigure its display on the guest), rather than sending it directly to the Main Channel. The session will then align the displays (if necessary), and the spice session will send down new configuration for all displays at once. This solves a couple of problems: 1. It allows the session to send down absolute coordinates only in the case where *all* windows are fullscreen (so that we can still support vertically-stacked displays, etc). But it auto-aligns displays if only a subset of the displays are in fullscreen mode. This solves the problem of overlapping regions on different displays when one monitor is in fullscreen because only one monitor's configuration was updated and the others were not aligned. 2. Allows us to always align based on the current position of each display. This contrasts with the earlier behavior where the position used for alignment was the window's position at the time when it was last resized. This caused displays to be arranged in a seemingly non-deterministic manner if one window was moved and then another window was resized (causing a display re-configuration). Solves rhbz#1002156
Diffstat (limited to 'src/virt-viewer-session-spice.c')
-rw-r--r--src/virt-viewer-session-spice.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 85d3895..d87fcd7 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -82,6 +82,7 @@ static void virt_viewer_session_spice_channel_destroy(SpiceSession *s,
static void virt_viewer_session_spice_smartcard_insert(VirtViewerSession *session);
static void virt_viewer_session_spice_smartcard_remove(VirtViewerSession *session);
static gboolean virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self);
+static void virt_viewer_session_spice_apply_monitor_geometry(VirtViewerSession *self, GdkRectangle *monitors, guint nmonitors);
static void
virt_viewer_session_spice_get_property(GObject *object, guint property_id,
@@ -157,6 +158,7 @@ virt_viewer_session_spice_class_init(VirtViewerSessionSpiceClass *klass)
dclass->smartcard_insert = virt_viewer_session_spice_smartcard_insert;
dclass->smartcard_remove = virt_viewer_session_spice_smartcard_remove;
dclass->mime_type = virt_viewer_session_spice_mime_type;
+ dclass->apply_monitor_geometry = virt_viewer_session_spice_apply_monitor_geometry;
g_type_class_add_private(klass, sizeof(VirtViewerSessionSpicePrivate));
@@ -675,6 +677,10 @@ virt_viewer_session_spice_channel_new(SpiceSession *s,
g_signal_connect(channel, "channel-event",
G_CALLBACK(virt_viewer_session_spice_main_channel_event), self);
self->priv->main_channel = SPICE_MAIN_CHANNEL(channel);
+ g_object_set(G_OBJECT(channel),
+ "disable-display-position", FALSE,
+ "disable-display-align", TRUE,
+ NULL);
g_signal_connect(channel, "notify::agent-connected", G_CALLBACK(agent_connected_changed), self);
}
@@ -752,11 +758,6 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
return FALSE;
}
-
- g_object_set(G_OBJECT(cmain),
- "disable-display-position", FALSE,
- "disable-display-align", TRUE,
- NULL);
spice_main_set_display_enabled(cmain, -1, FALSE);
ndisplays = virt_viewer_app_get_n_initial_displays(app);
@@ -887,6 +888,20 @@ virt_viewer_session_spice_smartcard_remove(VirtViewerSession *session G_GNUC_UNU
spice_smartcard_manager_remove_card(spice_smartcard_manager_get());
}
+void
+virt_viewer_session_spice_apply_monitor_geometry(VirtViewerSession *session, GdkRectangle *monitors, guint nmonitors)
+{
+ guint i;
+ VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(session);
+
+ for (i = 0; i < nmonitors; i++) {
+ GdkRectangle* rect = &monitors[i];
+
+ spice_main_set_display(self->priv->main_channel, i, rect->x,
+ rect->y, rect->width, rect->height);
+ }
+}
+
/*
* Local variables:
* c-indent-level: 4