ia64/xen-unstable

view tools/ioemu/patches/vnc-start-vncviewer @ 10804:060025203f54

[qemu] Re-calculate color_table after color depth reset.
VNC client may reset color depth after connection, so if we don't
re-calculate color_table, monitor/console's background is abnormal.

Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author chris@kneesaa.uk.xensource.com
date Wed Jul 26 14:20:13 2006 +0100 (2006-07-26)
parents 42aa63188a88
children 4c2a281cd1e7
line source
1 Index: ioemu/vnc.c
2 ===================================================================
3 --- ioemu.orig/vnc.c 2006-07-26 14:16:51.636538318 +0100
4 +++ ioemu/vnc.c 2006-07-26 14:18:15.612266329 +0100
5 @@ -1002,3 +1002,25 @@
7 vnc_dpy_resize(vs->ds, 640, 400);
8 }
9 +
10 +int vnc_start_viewer(int port)
11 +{
12 + int pid;
13 + char s[16];
14 +
15 + sprintf(s, ":%d", port);
16 +
17 + switch (pid = fork()) {
18 + case -1:
19 + fprintf(stderr, "vncviewer failed fork\n");
20 + exit(1);
21 +
22 + case 0: /* child */
23 + execlp("vncviewer", "vncviewer", s, 0);
24 + fprintf(stderr, "vncviewer execlp failed\n");
25 + exit(1);
26 +
27 + default:
28 + return pid;
29 + }
30 +}
31 Index: ioemu/vl.c
32 ===================================================================
33 --- ioemu.orig/vl.c 2006-07-26 14:13:44.488196651 +0100
34 +++ ioemu/vl.c 2006-07-26 14:18:15.615265998 +0100
35 @@ -121,6 +121,7 @@
36 int bios_size;
37 static DisplayState display_state;
38 int nographic;
39 +int vncviewer;
40 const char* keyboard_layout = NULL;
41 int64_t ticks_per_sec;
42 int boot_device = 'c';
43 @@ -4801,6 +4802,7 @@
44 #endif
45 "-loadvm file start right away with a saved state (loadvm in monitor)\n"
46 "-vnc display start a VNC server on display\n"
47 + "-vncviewer start a vncviewer process for this domain\n"
48 "-timeoffset time offset (in seconds) from local time\n"
49 "\n"
50 "During emulation, the following keys are useful:\n"
51 @@ -4889,6 +4891,7 @@
52 QEMU_OPTION_usbdevice,
53 QEMU_OPTION_smp,
54 QEMU_OPTION_vnc,
55 + QEMU_OPTION_vncviewer,
57 QEMU_OPTION_d,
58 QEMU_OPTION_vcpus,
59 @@ -4964,6 +4967,7 @@
60 { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
61 { "smp", HAS_ARG, QEMU_OPTION_smp },
62 { "vnc", HAS_ARG, QEMU_OPTION_vnc },
63 + { "vncviewer", 0, QEMU_OPTION_vncviewer },
65 /* temporary options */
66 { "usb", 0, QEMU_OPTION_usb },
67 @@ -5294,6 +5298,7 @@
68 #endif
69 snapshot = 0;
70 nographic = 0;
71 + vncviewer = 0;
72 kernel_filename = NULL;
73 kernel_cmdline = "";
74 #ifdef TARGET_PPC
75 @@ -5663,6 +5668,9 @@
76 exit(1);
77 }
78 break;
79 + case QEMU_OPTION_vncviewer:
80 + vncviewer++;
81 + break;
82 case QEMU_OPTION_domainname:
83 strncat(domain_name, optarg, sizeof(domain_name) - 20);
84 break;
85 @@ -5910,6 +5918,8 @@
86 dumb_display_init(ds);
87 } else if (vnc_display != -1) {
88 vnc_display_init(ds, vnc_display);
89 + if (vncviewer)
90 + vnc_start_viewer(vnc_display);
91 } else {
92 #if defined(CONFIG_SDL)
93 sdl_display_init(ds, full_screen);
94 Index: ioemu/vl.h
95 ===================================================================
96 --- ioemu.orig/vl.h 2006-07-26 14:18:05.490383989 +0100
97 +++ ioemu/vl.h 2006-07-26 14:18:15.616265887 +0100
98 @@ -733,6 +733,7 @@
100 /* vnc.c */
101 void vnc_display_init(DisplayState *ds, int display);
102 +int vnc_start_viewer(int port);
104 /* ide.c */
105 #define MAX_DISKS 4