diff --git a/sys/man/1/vmx b/sys/man/1/vmx index 8d014c294..fef51735c 100644 --- a/sys/man/1/vmx +++ b/sys/man/1/vmx @@ -24,7 +24,7 @@ vmx \- virtual PC .I blockfile ] [ -.B -v +.BR -v | -w .I vga ] [ @@ -61,6 +61,11 @@ argument. If .B -v is specified, a graphics device, PS/2 keyboard and mouse are simulated. +The +.B -w +flag behaves the same as +.B -v +but also creates a new window for the screen. Clicking on the screen "grabs" the mouse; pressing Ctrl and Alt simultaneously releases the grab. Valid values for the argument are .TP diff --git a/sys/src/cmd/vmx/vga.c b/sys/src/cmd/vmx/vga.c index 9fadff15e..eea5c8deb 100644 --- a/sys/src/cmd/vmx/vga.c +++ b/sys/src/cmd/vmx/vga.c @@ -737,7 +737,7 @@ vgafbparse(char *fbstring) void -vgainit(void) +vgainit(int new) { char buf[512]; int i; @@ -760,7 +760,7 @@ vgainit(void) sysfatal("got nil ptr for framebuffer"); } snprint(buf, sizeof(buf), "-dx %d -dy %d", maxw+50, maxh+50); - if(newwindow(buf) < 0 || initdraw(nil, nil, "vmx") < 0) + if((new && newwindow(buf) < 0) || initdraw(nil, nil, "vmx") < 0) sysfatal("failed to initialize graphics: %r"); screeninit(1); flushimage(display, 1); diff --git a/sys/src/cmd/vmx/vmx.c b/sys/src/cmd/vmx/vmx.c index 1a974a042..64536c522 100644 --- a/sys/src/cmd/vmx/vmx.c +++ b/sys/src/cmd/vmx/vmx.c @@ -504,7 +504,7 @@ sendnotif(void (*f)(void *), void *arg) send(notifch, ¬if); } -extern void vgainit(void); +extern void vgainit(int); extern void pciinit(void); extern void pcibusmap(void); extern void cpuidinit(void); @@ -574,7 +574,7 @@ usage(void) for(p = blanks; *p != 0; p++) *p = ' '; fprint(2, "usage: %s [ -M mem ] [ -c com1rd[,com1wr] ] [ -C com2rd[,com2r] ] [ -n nic ]\n", argv0); - fprint(2, " %s [ -d blockfile ] [ -m module ] [ -v vga ] [ -9 srv ] kernel [ args ... ]\n", blanks); + fprint(2, " %s [ -d blockfile ] [ -m module ] [ -v|-w vga ] [ -9 srv ] kernel [ args ... ]\n", blanks); threadexitsall("usage"); } @@ -590,6 +590,7 @@ threadmain(int argc, char **argv) static uvlong gmemsz = 64*1024*1024; static char *srvname; extern uintptr fbsz, fbaddr; + int newwin = 0; int i; quotefmtinstall(); @@ -637,6 +638,8 @@ threadmain(int argc, char **argv) gmemsz = siparse(EARGF(usage())); if(gmemsz != (uintptr) gmemsz) sysfatal("too much memory for address space"); break; + case 'w': + newwin = 1; case 'v': vgafbparse(EARGF(usage())); break; @@ -673,7 +676,7 @@ threadmain(int argc, char **argv) loadkernel(argv[0]); pciinit(); - vgainit(); + vgainit(newwin); for(i = 0; i < edevn; i++) if(edev[i](edevaux[i]) < 0) sysfatal("%s: %r", edevt[i]);