[gtk-vnc] src: reset widget size request when changing force-resize prop
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] src: reset widget size request when changing force-resize prop
- Date: Tue, 15 Dec 2020 17:25:15 +0000 (UTC)
commit a5d966aea6e07a035202d3896fe5ac6e0f4c8ae1
Author: Daniel P. Berrangé <dan berrange com>
Date: Thu Dec 10 18:30:21 2020 +0000
src: reset widget size request when changing force-resize prop
Currently once force-resize is turned on, we never unset the widget size
request if it is turned back off.
Signed-off-by: Daniel P. Berrangé <berrange redhat com>
src/vncdisplay.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index 12ba2a5..8cd8f43 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -1206,6 +1206,19 @@ static void on_framebuffer_update(VncConnection *conn G_GNUC_UNUSED,
}
+static void do_size_request(VncDisplay *obj)
+{
+ VncDisplayPrivate *priv = obj->priv;
+
+ if (priv->force_size) {
+ int width = vnc_framebuffer_get_width(VNC_FRAMEBUFFER(priv->fb));
+ int height = vnc_framebuffer_get_height(VNC_FRAMEBUFFER(priv->fb));
+ gtk_widget_set_size_request(GTK_WIDGET(obj), width, height);
+ } else {
+ gtk_widget_set_size_request(GTK_WIDGET(obj), -1, -1);
+ }
+}
+
static void do_framebuffer_init(VncDisplay *obj,
const VncPixelFormat *remoteFormat,
int width, int height, gboolean quiet)
@@ -1251,8 +1264,7 @@ static void do_framebuffer_init(VncDisplay *obj,
priv->fb = vnc_cairo_framebuffer_new(width, height, remoteFormat);
vnc_connection_set_framebuffer(priv->conn, VNC_FRAMEBUFFER(priv->fb));
- if (priv->force_size)
- gtk_widget_set_size_request(GTK_WIDGET(obj), width, height);
+ do_size_request(obj);
if (!quiet) {
g_signal_emit(G_OBJECT(obj),
@@ -2994,6 +3006,10 @@ void vnc_display_set_force_size(VncDisplay *obj, gboolean enabled)
{
g_return_if_fail (VNC_IS_DISPLAY (obj));
obj->priv->force_size = enabled;
+
+ if (obj->priv->fb != NULL) {
+ do_size_request(obj);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]