Commit 18dfbb9e authored by hexchain's avatar hexchain Committed by Frediano Ziglio
Browse files

spice-widget: add an API to get guest display size


Signed-off-by: hexchain's avatarHaochen Tong <i@hexchain.org>
Acked-by: Frediano Ziglio's avatarFrediano Ziglio <fziglio@redhat.com>
parent b3059829
......@@ -33,6 +33,7 @@ spice_display_channel_gl_draw_done;
spice_display_get_gl_scanout;
spice_display_get_grab_keys;
spice_display_get_pixbuf;
spice_display_get_preferred_size;
spice_display_get_primary;
spice_display_get_type;
spice_display_gl_draw_done;
......
......@@ -29,6 +29,7 @@ spice_display_channel_get_primary
spice_display_channel_get_type
spice_display_channel_gl_draw_done
spice_display_get_gl_scanout
spice_display_get_preferred_size
spice_display_get_primary
spice_display_gl_draw_done
spice_file_transfer_task_cancel
......
......@@ -3520,3 +3520,22 @@ GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display)
return pixbuf;
}
/**
* spice_display_get_preferred_size:
* @display: a #SpiceDisplay
* @width: the preferred width of the display, in physical pixel
* @height: the preferred height of the display, in physical pixel
*
* Get the preferred width and height of the display.
**/
void spice_display_get_preferred_size(SpiceDisplay *display, int *width, int *height)
{
SpiceDisplayPrivate *d = display->priv;
if (width)
*width = d->area.width;
if (height)
*height = d->area.height;
}
\ No newline at end of file
......@@ -79,6 +79,7 @@ SpiceGrabSequence *spice_display_get_grab_keys(SpiceDisplay *display);
void spice_display_send_keys(SpiceDisplay *display, const guint *keyvals,
int nkeyvals, SpiceDisplayKeyEvent kind);
GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display);
void spice_display_get_preferred_size(SpiceDisplay *display, int *width, int *height);
G_END_DECLS
......
......@@ -587,8 +587,7 @@ static void menu_cb_resize_to(GtkAction *action G_GNUC_UNUSED,
spin_x = gtk_spin_button_new_with_range(0, G_MAXINT, 10);
spin_y = gtk_spin_button_new_with_range(0, G_MAXINT, 10);
gtk_widget_get_preferred_width(win->spice, NULL, &width);
gtk_widget_get_preferred_height(win->spice, NULL, &height);
spice_display_get_preferred_size(SPICE_DISPLAY(win->spice), &width, &height);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_width), width);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_height), height);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment