code: plan9front

Download patch

ref: 0e632454e2d6cba7acb7e05771e027244e02416d
parent: 806353ec9eda162a3ff13cad1e5228c58cd67566
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Dec 27 18:10:39 EST 2020

aux/vga: remove panning, add screen tilting support

--- a/sys/man/8/vga
+++ b/sys/man/8/vga
@@ -15,6 +15,10 @@
 .I monitor
 ]
 [
+.B -t
+.I tilt
+]
+[
 .B -x
 .I file
 ]
@@ -91,6 +95,17 @@
 .B -V
 print a verbose trace of the functions called.
 .TP
+.B -t
+can be used to change the tilt of the screen.
+The value is one of
+.BR none ,
+.BR left ,
+.B inverted
+and
+.BR right .
+See
+.IR vga (3).
+.TP
 .BI -x " file"
 use 
 .I file
@@ -137,9 +152,6 @@
 .I X x Y
 and configures the display to have a virtual
 screen of the given size.
-The physical screen will pan to follow the mouse.
-This is useful on displays with small screens,
-such as laptops, but can be confusing.
 .PP
 Using the monitor name
 .B vesa
--- a/sys/src/cmd/aux/vga/main.c
+++ b/sys/src/cmd/aux/vga/main.c
@@ -204,7 +204,7 @@
 static void
 usage(void)
 {
-	fprint(2, "usage: aux/vga [ -BcdilpvV ] [ -b bios-id ] [ -m monitor ] [ -x db ] [ mode [ virtualsize ] ]\n");
+	fprint(2, "usage: aux/vga [ -BcdilpvV ] [ -b bios-id ] [ -m monitor ] [ -x db ] [ -t tilt ] [ mode [ virtualsize ] ]\n");
 	exits("usage");
 }
 
@@ -211,7 +211,7 @@
 void
 main(int argc, char** argv)
 {
-	char *bios, buf[256], sizeb[256], *p, *vsize, *psize;
+	char *bios, buf[256], sizeb[256], *p, *vsize, *psize, *tilt;
 	char *type, *vtype;
 	int virtual, len;
 	Ctlr *ctlr;
@@ -220,8 +220,9 @@
 	fmtinstall('H', encodefmt);
 	Binit(&stdout, 1, OWRITE);
 
+	tilt = getenv("tiltscreen");
 	bios = getenv("vgactlr");
-	if((type = getenv("monitor")) == 0)
+	if((type = getenv("monitor")) == nil)
 		type = "vga";
 	psize = vsize = "640x480x8";
 
@@ -259,6 +260,9 @@
 		 */
 		rflag++;
 		break;
+	case 't':
+		tilt = EARGF(usage());
+		break;
 	case 'v':
 		vflag = 1;
 		break;
@@ -372,12 +376,10 @@
 			vga->virty = atoi(p+1);
 			if(vga->virtx < vga->mode->x || vga->virty < vga->mode->y)
 				error("virtual size smaller than physical size\n");
-			vga->panning = 1;
 		}
 		else{
 			vga->virtx = vga->mode->x;
 			vga->virty = vga->mode->y;
-			vga->panning = 0;
 		}
 
 		trace("vmf %d vmdf %d vf1 %lud vbw %lud\n",
@@ -526,9 +528,10 @@
 			if(vga->virtx != vga->mode->x || vga->virty != vga->mode->y){
 				sprint(buf, "%dx%d", vga->mode->x, vga->mode->y);
 				vgactlw("actualsize", buf);
-				if(vga->panning)
-					vgactlw("panning", "on");
 			}
+
+			if(tilt != nil && *tilt != '\0')
+				vgactlw("tilt", tilt);
 
 			if(pflag)
 				dump(vga);
--- a/sys/src/cmd/aux/vga/vesa.c
+++ b/sys/src/cmd/aux/vga/vesa.c
@@ -275,7 +275,6 @@
 	if(v = dbattr(vga->mode->attr, "virtx")){
 		vga->virtx = atoi(v);
 		vga->virty = vga->mode->y;
-		vga->panning = 0;
 	}
 	ctlr->flag |= Foptions;
 }
--- a/sys/src/cmd/aux/vga/vga.c
+++ b/sys/src/cmd/aux/vga/vga.c
@@ -434,8 +434,6 @@
 
 	printitem(ctlr->name, "virtual");
 	Bprint(&stdout, "%ld %ld\n", vga->virtx, vga->virty);
-	printitem(ctlr->name, "panning");
-	Bprint(&stdout, "%s\n", vga->panning ? "on" : "off");
 	if(vga->f[0]){
 		printitem(ctlr->name, "clock[0] f");
 		Bprint(&stdout, "%9ld\n", vga->f[0]);
--- a/sys/src/cmd/aux/vga/vga.h
+++ b/sys/src/cmd/aux/vga/vga.h
@@ -212,8 +212,6 @@
 	ulong	virtx;			/* resolution of virtual screen */
 	ulong	virty;
 
-	int	panning;		/* pan the virtual screen */
-
 	Ctlr*	ctlr;
 	Ctlr*	ramdac;
 	Ctlr*	clock;