Commits

Russ Cox committed 1367866

devdraw: add forcedpi toggled by Fn+F3 on Mac

R=rsc
http://codereview.appspot.com/6846104

Comments (0)

Files changed (4)

src/cmd/devdraw/cocoa-screen.m

 	return i;
 }
 
-static void
-resizeimg()
+void
+resizeimg(void)
 {
 	[win.img release];
 	_drawreplacescreenimage(initimg());

src/cmd/devdraw/cocoa-srv.c

 		keystroke(Kalt);
 }
 
+void resizeimg(void);
+
 void
 keystroke(int c)
 {
 		nk = 0;
 		return;
 	}
+	if(c == KF+3) {
+		if(forcedpi)
+			forcedpi = 0;
+		else if(displaydpi >= 200)
+			forcedpi = 100;
+		else
+			forcedpi = 225;
+		resizeimg();
+		return;
+	}
 	if(!alting){
 		kputc(c);
 		return;

src/cmd/devdraw/devdraw.c

 #include "devdraw.h"
 
 extern void _flushmemscreen(Rectangle);
+int forcedpi = 0;
 int displaydpi = 100;
 
 #define NHASH (1<<5)
 					err = "unknown query";
 					goto error;
 				case 'd':	/* dpi */
-					fmtprint(&fmt, "%11d ", displaydpi);
+					if(forcedpi)
+						fmtprint(&fmt, "%11d ", forcedpi);
+					else
+						fmtprint(&fmt, "%11d ", displaydpi);
 					break;
 				}
 			}

src/cmd/devdraw/devdraw.h

 void abortcompose(void);
 
 extern int displaydpi;
+extern int forcedpi;