[Spice-commits] 3 commits - src/map-file src/spice-glib-sym-file src/spice-widget.c src/spice-widget.h tools/spicy.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 1 14:06:54 UTC 2020
src/map-file | 1 -
src/spice-glib-sym-file | 1 -
src/spice-widget.c | 34 +++++++++-------------------------
src/spice-widget.h | 1 -
tools/spicy.c | 5 ++++-
5 files changed, 13 insertions(+), 29 deletions(-)
New commits:
commit ae55e755908c7d8b02a1068bfbebe8670bf7db08
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Tue Dec 1 16:48:09 2020 +0400
spicy: use the scale factor to get the display preferred dimension
Since commit b30598293b1c48b9dc0eddfde5a9fc996a83939c ("spice-widget:
fix widget size request on HiDPI when scaling is disabled"), the
widget requested size is divided by the scale factor.
Multiply it back to get the guest display size (a more precise version
would retrive the associated channel and get the "width" and "height"
property from it)
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
diff --git a/tools/spicy.c b/tools/spicy.c
index 8ca62f9..b786aa0 100644
--- a/tools/spicy.c
+++ b/tools/spicy.c
@@ -589,6 +589,8 @@ static void menu_cb_resize_to(GtkAction *action G_GNUC_UNUSED,
gtk_widget_get_preferred_width(win->spice, NULL, &width);
gtk_widget_get_preferred_height(win->spice, NULL, &height);
+ width *= gtk_widget_get_scale_factor(win->spice);
+ height *= gtk_widget_get_scale_factor(win->spice);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_width), width);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_height), height);
commit c829f89788e767abbcb31f75050e913a1b55279f
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Tue Dec 1 16:50:05 2020 +0400
Revert "spice-widget: ensure a 640x480 initial size on HiDPI"
This reverts commit cbdda3334724f5bb7afe9e21ce0e972e53e71fdc.
This commit doesn't actually do anything useful.
diff --git a/src/spice-widget.c b/src/spice-widget.c
index c39af82..36bceaf 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -209,16 +209,19 @@ static void update_size_request(SpiceDisplay *display)
gint reqwidth, reqheight;
gint scale_factor;
- scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
-
if (d->resize_guest_enable || d->allow_scaling) {
- reqwidth = 640 / scale_factor;
- reqheight = 480 / scale_factor;
+ reqwidth = 640;
+ reqheight = 480;
} else {
- reqwidth = d->area.width / scale_factor;
- reqheight = d->area.height / scale_factor;
+ reqwidth = d->area.width;
+ reqheight = d->area.height;
}
+ scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
+
+ reqwidth /= scale_factor;
+ reqheight /= scale_factor;
+
gtk_widget_set_size_request(GTK_WIDGET(display), reqwidth, reqheight);
recalc_geometry(GTK_WIDGET(display));
update_mouse_cursor(display);
commit b0651e424a7bf44f02e17b074015218180699371
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Tue Dec 1 16:40:30 2020 +0400
Revert "spice-widget: add an API to get guest display size"
This reverts commit 18dfbb9e7974d153a1758aef58208591111de80e.
The motivation behind the new API isn't clear enough.
The guest display size can be retrieved through the "width" and "height"
properties of the associated display channel.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
diff --git a/src/map-file b/src/map-file
index 8ceaeb1..bb85702 100644
--- a/src/map-file
+++ b/src/map-file
@@ -33,7 +33,6 @@ 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;
diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
index a8bfe1d..2cc80aa 100644
--- a/src/spice-glib-sym-file
+++ b/src/spice-glib-sym-file
@@ -29,7 +29,6 @@ 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
diff --git a/src/spice-widget.c b/src/spice-widget.c
index eaf9e91..c39af82 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -3588,22 +3588,3 @@ 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;
-}
diff --git a/src/spice-widget.h b/src/spice-widget.h
index ead5d7c..e0b1fb3 100644
--- a/src/spice-widget.h
+++ b/src/spice-widget.h
@@ -79,7 +79,6 @@ 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
diff --git a/tools/spicy.c b/tools/spicy.c
index 437a298..8ca62f9 100644
--- a/tools/spicy.c
+++ b/tools/spicy.c
@@ -587,7 +587,8 @@ 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);
- spice_display_get_preferred_size(SPICE_DISPLAY(win->spice), &width, &height);
+ gtk_widget_get_preferred_width(win->spice, NULL, &width);
+ gtk_widget_get_preferred_height(win->spice, NULL, &height);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_width), width);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_height), height);
More information about the Spice-commits
mailing list