summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-06-18 19:27:06 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-07-16 17:46:41 +0200
commitb79f3e148b5c9952a63de80c0a6959dc129c9cc0 (patch)
tree882b22c39421e3833b974552589c2a0c8b488eae /gtk
parentb1aaa08be76605d68ee1b4a7feb93078c1dff73e (diff)
Use monitor_id to compute display_id
Diffstat (limited to 'gtk')
-rw-r--r--gtk/channel-main.c4
-rw-r--r--gtk/spice-widget.c17
2 files changed, 17 insertions, 4 deletions
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 9e97b8b..3c173c6 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1829,7 +1829,7 @@ gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap
/**
* spice_main_set_display:
* @channel:
- * @id: display channel ID
+ * @id: display ID
* @x: x position
* @y: y position
* @width: display width
@@ -2013,7 +2013,7 @@ void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint sel
/**
* spice_main_set_display_enabled:
* @channel: a #SpiceMainChannel
- * @id: display channel ID (if -1: set all displays)
+ * @id: display ID (if -1: set all displays)
* @enabled: wether display @id is enabled
*
* When sending monitor configuration to agent guest, don't set
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 3febb66..6635e31 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -779,6 +779,19 @@ static void update_mouse_grab(SpiceDisplay *display)
try_mouse_ungrab(display);
}
+static gint get_display_id(SpiceDisplay *display)
+{
+ SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+
+ /* supported monitor_id only with display channel #0 */
+ if (d->channel_id == 0 && d->monitor_id >= 0)
+ return d->monitor_id;
+
+ g_return_val_if_fail(d->monitor_id <= 0, -1);
+
+ return d->channel_id;
+}
+
static void recalc_geometry(GtkWidget *widget)
{
SpiceDisplay *display = SPICE_DISPLAY(widget);
@@ -800,7 +813,7 @@ static void recalc_geometry(GtkWidget *widget)
d->ww, d->wh, zoom, d->mx, d->my);
if (d->resize_guest_enable)
- spice_main_set_display(d->main, d->channel_id,
+ spice_main_set_display(d->main, get_display_id(display),
0, 0, d->ww / zoom, d->wh / zoom);
}
@@ -1687,7 +1700,7 @@ static void mark(SpiceChannel *channel, gint mark, gpointer data)
SPICE_DEBUG("widget mark: %d, channel %d", mark, d->channel_id);
d->mark = mark;
- spice_main_set_display_enabled(d->main, d->channel_id, d->mark != 0);
+ spice_main_set_display_enabled(d->main, get_display_id(display), d->mark != 0);
if (mark != 0 && gtk_widget_get_window(GTK_WIDGET(display)))
gtk_widget_queue_draw(GTK_WIDGET(display));
}