xen/xen-vnc-resize.patch

54 lines
1.7 KiB
Diff

Index: xen-3.2-testing/tools/ioemu/vnc.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/vnc.c 2008-05-09 12:16:09.000000000 -0600
+++ xen-3.2-testing/tools/ioemu/vnc.c 2008-05-09 12:21:37.000000000 -0600
@@ -244,6 +244,7 @@
static void vnc_update_client(void *opaque);
static void vnc_client_read(void *opaque);
static void framebuffer_set_updated(VncState *vs, int x, int y, int w, int h);
+static void vnc_write_newsize(VncState *vs);
#if 0
static inline void vnc_set_bit(uint32_t *d, int k)
@@ -356,11 +357,7 @@
ds->height = h;
ds->linesize = w * vs->depth;
if (vs->csock != -1 && vs->has_resize && size_changed) {
- vnc_write_u8(vs, 0); /* msg id */
- vnc_write_u8(vs, 0);
- vnc_write_u16(vs, 1); /* number of rects */
- vnc_framebuffer_update(vs, 0, 0, ds->width, ds->height, -223);
- vnc_flush(vs);
+ vnc_write_newsize(vs);
vs->width = ds->width;
vs->height = ds->height;
}
@@ -370,6 +367,15 @@
framebuffer_set_updated(vs, 0, 0, ds->width, ds->height);
}
+static void vnc_write_newsize(VncState *vs)
+{
+ vnc_write_u8(vs, 0); /* msg id */
+ vnc_write_u8(vs, 0);
+ vnc_write_u16(vs, 1); /* number of rects */
+ vnc_framebuffer_update(vs, 0, 0, vs->ds->width, vs->ds->height, -223);
+ vnc_flush(vs);
+}
+
/* fastest code */
static void vnc_write_pixels_copy(VncState *vs, void *pixels, int size)
{
@@ -1300,6 +1306,11 @@
break;
case -223: /* DesktopResize */
vs->has_resize = 1;
+ if (vs->width != vs->ds->width || vs->height != vs->ds->height) {
+ vnc_write_newsize(vs);
+ vs->width = vs->ds->width;
+ vs->height = vs->ds->height;
+ }
break;
case -257:
vs->has_pointer_type_change = 1;