summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-05-25 18:25:16 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-01 13:30:08 -0500
commit621aaeb9991933a367e3964ecfc88a8f96af1f6a (patch)
tree847b6d2552a4152f2786c94ba0b58d7b7ac8868b
parentb627808462de92fd2635de16fa7d10b18d806802 (diff)
downloadqemu-621aaeb9991933a367e3964ecfc88a8f96af1f6a.tar.gz
vnc: factor out vnc_desktop_resize()
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--vnc.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/vnc.c b/vnc.c
index 046bd3849c..4fb13ba886 100644
--- a/vnc.c
+++ b/vnc.c
@@ -522,6 +522,21 @@ void buffer_append(Buffer *buffer, const void *data, size_t len)
buffer->offset += len;
}
+static void vnc_desktop_resize(VncState *vs)
+{
+ DisplayState *ds = vs->ds;
+
+ if (vs->csock == -1 || !vnc_has_feature(vs, VNC_FEATURE_RESIZE)) {
+ return;
+ }
+ vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
+ vnc_write_u8(vs, 0);
+ vnc_write_u16(vs, 1); /* number of rects */
+ vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds),
+ VNC_ENCODING_DESKTOPRESIZE);
+ vnc_flush(vs);
+}
+
static void vnc_dpy_resize(DisplayState *ds)
{
int size_changed;
@@ -550,14 +565,7 @@ static void vnc_dpy_resize(DisplayState *ds)
QTAILQ_FOREACH(vs, &vd->clients, next) {
vnc_colordepth(vs);
if (size_changed) {
- if (vs->csock != -1 && vnc_has_feature(vs, VNC_FEATURE_RESIZE)) {
- vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
- vnc_write_u8(vs, 0);
- vnc_write_u16(vs, 1); /* number of rects */
- vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds),
- VNC_ENCODING_DESKTOPRESIZE);
- vnc_flush(vs);
- }
+ vnc_desktop_resize(vs);
}
if (vs->vd->cursor) {
vnc_cursor_define(vs);