ref: 2f6d6e90fd2ec071a45d99b9682ccb67552b18de
parent: 064c250f0c7e5224db9222f6be46da8a29ebb589
author: Philip Silva <philip.silva@protonmail.com>
date: Mon Oct 18 15:29:28 EDT 2021
add hidpi-drawterm-metal-cocoa.patch
--- a/README
+++ b/README
@@ -5,4 +5,5 @@
- hidpi-2.patch: be able to configure dpi via plan9.cfg
- hidpi-3.patch: scale borders of rio and acme
(p9p commit c96d832)
+- hidpi-drawterm-metal-cocoa.patch: hardcodes displaydpi to 200 (https://github.com/Plan9-Archive/drawterm-metal-cocoa)
- acme-at.patch: can be applied to open paths containing @s (e.g. the internal Go module paths)
--- /dev/null
+++ b/hidpi-drawterm-metal-cocoa.patch
@@ -1,0 +1,82 @@
+diff 0b7990cf2b84e7a80cf3f3a9e7eadca10d51a2c5 uncommitted
+--- a/include/draw.h
++++ b/include/draw.h
+@@ -193,6 +193,7 @@
+ Image *windows;
+ Image *screenimage;
+ int _isnewdisplay;
++ int dpi;
+ };
+
+ struct Image
+--- a/kern/devdraw.c
++++ b/kern/devdraw.c
+@@ -76,6 +76,8 @@
+ int refreshme;
+ int infoid;
+ int op;
++ int displaydpi;
++ int forcedpi;
+ };
+
+ struct Refresh
+@@ -166,6 +168,8 @@
+ Client* drawclientofpath(ulong);
+ DImage* allocdimage(Memimage*);
+
++int displaydpi = 200;
++
+ static char Enodrawimage[] = "unknown id for draw image";
+ static char Enodrawscreen[] = "unknown id for draw screen";
+ static char Eshortdraw[] = "short draw message";
+@@ -783,6 +787,7 @@
+ cl->slot = i;
+ cl->clientid = ++sdraw.clientid;
+ cl->op = SoverD;
++ cl->displaydpi = displaydpi;
+ sdraw.client[i] = cl;
+ return cl;
+ }
+@@ -1408,6 +1413,7 @@
+ int c, repl, m, y, dstid, scrnid, ni, ci, j, nw, e0, e1, op, ox, oy, oesize, esize, doflush;
+ uchar *u, *a, refresh;
+ char *fmt;
++ Fmt f;
+ ulong value, chan;
+ Rectangle r, clipr;
+ Point p, q, *pp, sp;
+@@ -1654,6 +1660,34 @@
+ memset(font->fchar, 0, ni*sizeof(FChar));
+ font->nfchar = ni;
+ font->ascent = a[9];
++ continue;
++
++ /* query: 'Q' n[1] queryspec[n] */
++ case 'q':
++ if(n < 2)
++ error(Eshortdraw);
++ m = 1+1+a[1];
++ if(n < m)
++ error(Eshortdraw);
++ fmtstrinit(&f);
++ for(c=0; c<a[1]; c++){
++ switch(a[2+c]){
++ default:
++ error("unknown query");
++ break;
++ case 'd': /* dpi */
++ if(client->forcedpi)
++ fmtprint(&f, "%11d ", client->forcedpi);
++ else {
++ fmtprint(&f, "%11d ", client->displaydpi);
++ }
++ break;
++ }
++ }
++ client->readdata = (uchar*)fmtstrflush(&f);
++ if(client->readdata == nil)
++ error(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] */