ref: c74458c98b3cba6ed33a63b9f02a10e9828f9097
parent: 1bb96d542cd43a027934ca372e0ab8c87f523db9
author: cinap_lenrek <[email protected]>
date: Mon Dec 7 13:59:54 EST 2020
vmx: add -v|-w flag to control window creation behaviour The -v flag now does not create a new rio window, while -w flag does (restores the old behaviour). This allows vmx to run under vncs and is in general mode aligned to other emulators and programs.
--- a/sys/man/1/vmx
+++ b/sys/man/1/vmx
@@ -24,7 +24,7 @@
.I blockfile
]
[
-.B -v
+.BR -v | -w
.I vga
]
[
@@ -61,6 +61,11 @@
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
--- a/sys/src/cmd/vmx/vga.c
+++ b/sys/src/cmd/vmx/vga.c
@@ -737,7 +737,7 @@
void
-vgainit(void)
+vgainit(int new)
{
char buf[512];
int i;
@@ -760,7 +760,7 @@
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);
--- a/sys/src/cmd/vmx/vmx.c
+++ b/sys/src/cmd/vmx/vmx.c
@@ -504,7 +504,7 @@
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 @@
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 @@
static uvlong gmemsz = 64*1024*1024;
static char *srvname;
extern uintptr fbsz, fbaddr;
+ int newwin = 0;
int i;
quotefmtinstall();
@@ -637,6 +638,8 @@
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 @@
loadkernel(argv[0]);
pciinit();
- vgainit();
+ vgainit(newwin);
for(i = 0; i < edevn; i++)
if(edev[i](edevaux[i]) < 0)
sysfatal("%s: %r", edevt[i]);