diff options
author | Russ Cox <rsc@swtch.com> | 2012-11-25 21:41:52 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2012-11-25 21:41:52 -0500 |
commit | d0e0701913f3aede1fcb256f3d1e9c60c9af6edf (patch) | |
tree | 89289d543069ef615e1a58343b8db1b93356fcc5 /src/cmd | |
parent | 7b9ef735a8d1fddf3887853abbd065271fa9c293 (diff) | |
download | plan9port-d0e0701913f3aede1fcb256f3d1e9c60c9af6edf.tar.gz plan9port-d0e0701913f3aede1fcb256f3d1e9c60c9af6edf.tar.bz2 plan9port-d0e0701913f3aede1fcb256f3d1e9c60c9af6edf.zip |
devdraw, libdraw: add display->dpi
Fixed at 100 right now, but the plan is to make it accurate
and then use it.
R=rsc
http://codereview.appspot.com/6856091
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/devdraw/devdraw.c | 28 | ||||
-rw-r--r-- | src/cmd/devdraw/devdraw.h | 2 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/cmd/devdraw/devdraw.c b/src/cmd/devdraw/devdraw.c index 0e2226cd..3fabd34e 100644 --- a/src/cmd/devdraw/devdraw.c +++ b/src/cmd/devdraw/devdraw.c @@ -11,6 +11,7 @@ #include "devdraw.h" extern void _flushmemscreen(Rectangle); +int displaydpi = 100; #define NHASH (1<<5) #define HASHMASK (NHASH-1) @@ -776,6 +777,7 @@ _drawmsgwrite(void *v, int n) DName *dn; DScreen *dscrn; FChar *fc; + Fmt fmt; Memimage *dst, *i, *l, **lp, *mask, *src; Memscreen *scrn; Point p, *pp, q, sp; @@ -1083,7 +1085,31 @@ _drawmsgwrite(void *v, int n) memmove(client->readdata, ibuf, ni); client->nreaddata = ni; client->infoid = -1; - continue; + continue; + + /* query: 'Q' n[1] queryspec[n] */ + case 'q': + if(n < 2) + goto Eshortdraw; + m = 1+1+a[1]; + if(n < m) + goto Eshortdraw; + fmtstrinit(&fmt); + for(c=0; c<a[1]; c++) { + switch(a[2+c]) { + default: + err = "unknown query"; + goto error; + case 'd': /* dpi */ + fmtprint(&fmt, "%11d ", displaydpi); + break; + } + } + client->readdata = (uchar*)fmtstrflush(&fmt); + if(client->readdata == nil) + goto Enomem; + client->nreaddata = strlen((char*)client->readdata); + continue; /* load character: 'l' fontid[4] srcid[4] index[2] R[4*4] P[2*4] left[1] width[1] */ case 'l': diff --git a/src/cmd/devdraw/devdraw.h b/src/cmd/devdraw/devdraw.h index 7abf212e..454cfe03 100644 --- a/src/cmd/devdraw/devdraw.h +++ b/src/cmd/devdraw/devdraw.h @@ -6,4 +6,4 @@ int parsewinsize(char*, Rectangle*, int*); int mouseswap(int); void abortcompose(void); - +extern int displaydpi; |