ref: d50596a489b51df5603567e2784b2be6b32239c3
dir: /hidpi-3.patch/
diff 75d8e460a00505c2b21a0d06ceb4300c93d9c4d6 uncommitted --- a/sys/include/ape/draw.h +++ b/sys/include/ape/draw.h @@ -69,6 +69,7 @@ Displaybufsize = 8000, ICOSSCALE = 1024, Borderwidth = 4, + DefaultDPI = 100, }; enum @@ -358,6 +359,7 @@ extern Image* namedimage(Display*, char*); extern int nameimage(Image*, char*, int); extern Image* allocimagemix(Display*, ulong, ulong); +extern int scalesize(Display*, int); /* * Colors --- a/sys/include/draw.h +++ b/sys/include/draw.h @@ -61,6 +61,7 @@ Displaybufsize = 8000, ICOSSCALE = 1024, Borderwidth = 4, + DefaultDPI = 100, }; enum @@ -354,6 +355,7 @@ extern Image* namedimage(Display*, char*); extern int nameimage(Image*, char*, int); extern Image* allocimagemix(Display*, ulong, ulong); +extern int scalesize(Display*, int); /* * Colors --- a/sys/src/cmd/acme/dat.h +++ b/sys/src/cmd/acme/dat.h @@ -473,11 +473,14 @@ BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */ RBUFSIZE = BUFSIZE/sizeof(Rune), EVENTSIZE = 256, - Scrollwid = 12, /* width of scroll bar */ - Scrollgap = 4, /* gap right of scroll bar */ - Margin = 4, /* margin around text */ - Border = 2, /* line between rows, cols, windows */ }; + +// like in p9p c96d832 +#define Scrollwid scalesize(display, 12) /* width of scroll bar */ +#define Scrollgap scalesize(display, 4) /* gap right of scroll bar */ +#define Margin scalesize(display, 4) /* margin around text */ +#define Border scalesize(display, 2) /* line between rows, cols, windows */ +#define ButtonBorder scalesize(display, 2) #define QID(w,q) ((w<<8)|(q)) #define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF) --- a/sys/src/libdraw/init.c +++ b/sys/src/libdraw/init.c @@ -452,5 +465,13 @@ p = d->bufp; d->bufp += n; return p; +} + +int +scalesize(Display *d, int n) +{ + if(d == nil || d->dpi <= DefaultDPI) + return n; + return (n*d->dpi+DefaultDPI/2)/DefaultDPI; }