tdevdraw: set displaydpi on devdraw x11 attach (#178) - plan9port - [fork] Plan… | |
git clone git://src.adamsgaard.dk/plan9port | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 000c1a3b19a8d3f8bbaefba84131995cb62c889f | |
parent a791787a384745b90fa0eb704cd9cbbe8c758684 | |
Author: Gabriel Díaz <[email protected]> | |
Date: Wed, 14 Nov 2018 06:19:29 +0100 | |
devdraw: set displaydpi on devdraw x11 attach (#178) | |
See https://plan9port-review.googlesource.com/c/plan9/+/1470 | |
for discussion of the approach, especially Michael Stapleberg's comment: | |
Note that chromium, firefox and others have tried this and then switched to usi… | |
The Xft.dpi resource is being set accurately by desktop environments (GNOME, KD… | |
I suggest we check only Xft.dpi, without considering the DPI environment variab… | |
Diffstat: | |
M src/cmd/devdraw/x11-init.c | 9 +++++++-- | |
1 file changed, 7 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/src/cmd/devdraw/x11-init.c b/src/cmd/devdraw/x11-init.c | |
t@@ -208,9 +208,9 @@ _xattach(char *label, char *winsize) | |
* Parse the various X resources. Thanks to Peter Canning. | |
*/ | |
char *screen_resources, *display_resources, *geom, | |
- *geomrestype, *home, *file; | |
+ *geomrestype, *home, *file, *dpitype; | |
XrmDatabase database; | |
- XrmValue geomres; | |
+ XrmValue geomres, dpires; | |
database = XrmGetDatabase(_x.display); | |
screen_resources = XScreenResourceString(xscreen); | |
t@@ -230,6 +230,11 @@ _xattach(char *label, char *winsize) | |
}else | |
XrmCombineDatabase(XrmGetStringDatabase(display_resour… | |
+ if (XrmGetResource(database, "Xft.dpi", "String", &dpitype, &d… | |
+ if (dpires.addr) { | |
+ displaydpi=atoi(dpires.addr); | |
+ } | |
+ } | |
geom = smprint("%s.geometry", label); | |
if(geom && XrmGetResource(database, geom, nil, &geomrestype, &… | |
mask = XParseGeometry(geomres.addr, &x, &y, (uint*)&wi… |