From 9961efd10cabba03a0673a6dcce21d2236d3fced Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Wed, 6 Mar 2019 19:26:15 +0100 Subject: [PATCH] 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. --- src/x11/screen.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/x11/screen.c b/src/x11/screen.c index 0b590ea..ce89702 100644 --- a/src/x11/screen.c +++ b/src/x11/screen.c @@ -60,17 +60,13 @@ static double screen_dpi_get_from_xft(void) screen_dpi_xft_cache = 0; XrmInitialize(); - char *xRMS = XResourceManagerString(xctx.dpy); - ASSERT_OR_RET(xRMS, screen_dpi_xft_cache); - - XrmDatabase xDB = XrmGetStringDatabase(xRMS); char *xrmType; XrmValue xrmValue; - - if (XrmGetResource(xDB, "Xft.dpi", "Xft.dpi", &xrmType, &xrmValue)) + XrmDatabase db = XrmGetDatabase(xctx.dpy); + 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); - XrmDestroyDatabase(xDB); } return screen_dpi_xft_cache; }