devdraw: add forcedpi toggled by Fn+F3 on Mac

R=rsc
http://codereview.appspot.com/6846104
This commit is contained in:
Russ Cox 2012-11-25 23:38:14 -05:00
parent 2589c5c6ee
commit 55905845f3
4 changed files with 20 additions and 3 deletions

View file

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

View file

@ -367,6 +367,8 @@ abortcompose(void)
keystroke(Kalt);
}
void resizeimg(void);
void
keystroke(int c)
{
@ -379,6 +381,16 @@ 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;

View file

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

View file

@ -7,3 +7,4 @@ int mouseswap(int);
void abortcompose(void);
extern int displaydpi;
extern int forcedpi;