Copy the database from the display connection

This allows to update the DB on the xctx.dpy object. Crawling the string
from xctx.dpy will always return the xdefaults string, which represents
the defaults from the initialisation, but not with any other updates.
This commit is contained in:
Benedikt Heine 2019-03-06 19:26:15 +01:00 committed by Nikos Tsipinakis
parent e9e199c4ec
commit 9961efd10c

View File

@ -60,17 +60,13 @@ static double screen_dpi_get_from_xft(void)
screen_dpi_xft_cache = 0; screen_dpi_xft_cache = 0;
XrmInitialize(); XrmInitialize();
char *xRMS = XResourceManagerString(xctx.dpy);
ASSERT_OR_RET(xRMS, screen_dpi_xft_cache);
XrmDatabase xDB = XrmGetStringDatabase(xRMS);
char *xrmType; char *xrmType;
XrmValue xrmValue; XrmValue xrmValue;
XrmDatabase db = XrmGetDatabase(xctx.dpy);
if (XrmGetResource(xDB, "Xft.dpi", "Xft.dpi", &xrmType, &xrmValue)) ASSERT_OR_RET(db, screen_dpi_xft_cache);
if (XrmGetResource(db, "Xft.dpi", "Xft.dpi", &xrmType, &xrmValue))
screen_dpi_xft_cache = strtod(xrmValue.addr, NULL); screen_dpi_xft_cache = strtod(xrmValue.addr, NULL);
XrmDestroyDatabase(xDB);
} }
return screen_dpi_xft_cache; return screen_dpi_xft_cache;
} }