Commit e25a5822ca2dfd229471cc5d02458956b1bf0fa8

Authored by ths
1 parent 71cab5ca

Extend monitor 'change' command for VNC, by Daniel P. Berrange.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3134 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 18 additions and 3 deletions
monitor.c
... ... @@ -386,7 +386,7 @@ static void do_eject(int force, const char *filename)
386 386 eject_device(bs, force);
387 387 }
388 388  
389   -static void do_change(const char *device, const char *filename)
  389 +static void do_change_block(const char *device, const char *filename)
390 390 {
391 391 BlockDriverState *bs;
392 392  
... ... @@ -401,6 +401,21 @@ static void do_change(const char *device, const char *filename)
401 401 qemu_key_check(bs, filename);
402 402 }
403 403  
  404 +static void do_change_vnc(const char *target)
  405 +{
  406 + if (vnc_display_open(NULL, target) < 0)
  407 + term_printf("could not start VNC server on %s\n", target);
  408 +}
  409 +
  410 +static void do_change(const char *device, const char *target)
  411 +{
  412 + if (strcmp(device, "vnc") == 0) {
  413 + do_change_vnc(target);
  414 + } else {
  415 + do_change_block(device, target);
  416 + }
  417 +}
  418 +
404 419 static void do_screen_dump(const char *filename)
405 420 {
406 421 vga_hw_screen_dump(filename);
... ...
... ... @@ -1208,7 +1208,7 @@ void vnc_display_init(DisplayState *ds)
1208 1208  
1209 1209 void vnc_display_close(DisplayState *ds)
1210 1210 {
1211   - VncState *vs = (VncState *)ds->opaque;
  1211 + VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
1212 1212  
1213 1213 if (vs->display) {
1214 1214 qemu_free(vs->display);
... ... @@ -1239,7 +1239,7 @@ int vnc_display_open(DisplayState *ds, const char *arg)
1239 1239 int reuse_addr, ret;
1240 1240 socklen_t addrlen;
1241 1241 const char *p;
1242   - VncState *vs = (VncState *)ds->opaque;
  1242 + VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
1243 1243  
1244 1244 vnc_display_close(ds);
1245 1245 if (strcmp(arg, "none") == 0)
... ...