ref: 064c250f0c7e5224db9222f6be46da8a29ebb589
parent: 922df766d609ac2cdc6fc5a8acc5c9f7dfcb255c
author: Philip Silva <[email protected]>
date: Mon Oct 18 15:12:51 EDT 2021
add hidpi patch for rio
--- a/hidpi-3.patch
+++ b/hidpi-3.patch
@@ -56,6 +56,120 @@
#define QID(w,q) ((w<<8)|(q))
#define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
+--- a/sys/src/cmd/rio/wind.c
++++ b/sys/src/cmd/rio/wind.c
+@@ -12,6 +12,14 @@
+ #include "dat.h"
+ #include "fns.h"
+
++static int
++wscale(Window *w, int n)
++{
++ if(w == nil || w->i == nil)
++ return n;
++ return scalesize(w->i->display, n);
++}
++
+ Window*
+ wlookid(int id)
+ {
+@@ -308,7 +316,7 @@
+ else
+ col = lighttitlecol;
+ }
+- border(w->i, w->i->r, Selborder, col, ZP);
++ border(w->i, w->i->r, wscale(w, Selborder), col, ZP);
+ }
+
+ static void
+@@ -353,17 +361,17 @@
+
+ w->i = i;
+ w->mc.image = i;
+- r = insetrect(i->r, Selborder+1);
++ r = insetrect(i->r, wscale(w, Selborder)+wscale(w, 1));
+ w->scrollr = r;
+- w->scrollr.max.x = r.min.x+Scrollwid;
++ w->scrollr.max.x = r.min.x+wscale(w, Scrollwid);
+ w->lastsr = ZR;
+- r.min.x += Scrollwid+Scrollgap;
++ r.min.x += wscale(w, Scrollwid)+wscale(w, Scrollgap);
+ frclear(w, FALSE);
+ frinit(w, r, w->font, w->i, cols);
+ wsetcols(w, w == input);
+ w->maxtab = maxtab*stringwidth(w->font, "0");
+ if(!w->mouseopen || !w->winnameread){
+- r = insetrect(w->i->r, Selborder);
++ r = insetrect(w->i->r, wscale(w, Selborder));
+ draw(w->i, r, cols[BACK], nil, w->entire.min);
+ wfill(w);
+ wsetselect(w, w->q0, w->q1);
+@@ -370,7 +378,7 @@
+ wscrdraw(w);
+ }
+ if(w == input)
+- wborder(w, Selborder);
++ wborder(w, wscale(w, Selborder));
+ else
+ wborder(w, Unselborder);
+ flushimage(display, 1);
+@@ -390,9 +398,9 @@
+ if(!w->mouseopen || !w->winnameread)
+ frredraw(w);
+ if(w == input)
+- wborder(w, Selborder);
++ wborder(w, wscale(w, Selborder));
+ else
+- wborder(w, Unselborder);
++ wborder(w, wscale(w, Unselborder));
+ }
+
+ static void
+@@ -401,9 +409,9 @@
+ Rectangle r;
+
+ if(w == input)
+- wborder(w, Selborder);
++ wborder(w, wscale(w, Selborder));
+ else
+- wborder(w, Unselborder);
++ wborder(w, wscale(w, Unselborder));
+ r = insetrect(w->i->r, Selborder);
+ draw(w->i, r, w->cols[BACK], nil, w->entire.min);
+ wfill(w);
+@@ -1249,7 +1257,7 @@
+
+ w = emalloc(sizeof(Window));
+ w->screenr = i->r;
+- r = insetrect(i->r, Selborder+1);
++ r = insetrect(i->r, wscale(w, Selborder)+wscale(w, 1));
+ w->i = i;
+ w->mc = *mc;
+ w->ck = ck;
+@@ -1263,9 +1271,9 @@
+ w->complete = chancreate(sizeof(Completion*), 0);
+ w->gone = chancreate(sizeof(char*), 0);
+ w->scrollr = r;
+- w->scrollr.max.x = r.min.x+Scrollwid;
++ w->scrollr.max.x = r.min.x+wscale(w, Scrollwid);
+ w->lastsr = ZR;
+- r.min.x += Scrollwid+Scrollgap;
++ r.min.x += wscale(w, Scrollwid)+wscale(w, Scrollgap);
+ frinit(w, r, font, i, cols);
+ w->maxtab = maxtab*stringwidth(font, "0");
+ w->topped = ++topped;
+@@ -1274,9 +1282,9 @@
+ w->scrolling = scrolling;
+ w->dir = estrdup(startdir);
+ w->label = estrdup("<unnamed>");
+- r = insetrect(w->i->r, Selborder);
++ r = insetrect(w->i->r, wscale(w, Selborder));
+ draw(w->i, r, cols[BACK], nil, w->entire.min);
+- wborder(w, Selborder);
++ wborder(w, wscale(w, Selborder));
+ wscrdraw(w);
+ incref(w); /* ref will be removed after mounting; avoids delete before ready to be deleted */
+ return w;
--- a/sys/src/libdraw/init.c
+++ b/sys/src/libdraw/init.c
@@ -452,5 +465,13 @@