Merge pull request #408 from go-vgo/bitmap-pr

Optimize Linux get high DPI code
This commit is contained in:
Evans 2021-11-26 18:09:25 -04:00 committed by GitHub
commit 5327672335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,16 +56,18 @@ double sys_scale() {
// https://github.com/glfw/glfw/issues/1019#issuecomment-302772498 // https://github.com/glfw/glfw/issues/1019#issuecomment-302772498
char *rms = XResourceManagerString(dpy); char *rms = XResourceManagerString(dpy);
if (rms) { if (rms) {
XrmDatabase db; XrmDatabase db = XrmGetStringDatabase(rms);
XrmValue value; if (db) {
char *type = NULL; XrmValue value;
char *type = NULL;
XrmInitialize(); /* Need to initialize the DB before calling Xrm* functions */ if (XrmGetResource(db, "Xft.dpi", "String", &type, &value)) {
db = XrmGetStringDatabase(rms); if (value.addr) {
if (XrmGetResource(db, "Xft.dpi", "String", &type, &value) == True) { xres = atof(value.addr);
if (value.addr) { }
xres = atof(value.addr);
} }
XrmDestroyDatabase(db);
} }
} }
XCloseDisplay (dpy); XCloseDisplay (dpy);