]> git.sur5r.net Git - i3/i3/blobdiff - libi3/dpi.c
ipc: tree reply: document focus, nodes and floating_nodes (#2955)
[i3/i3] / libi3 / dpi.c
index a832a689c40600b089ffbfdc2f5dd7421bb34ef5..93a3c6f6a99f1074d333adb3ebdf6250f671beb7 100644 (file)
@@ -24,6 +24,7 @@ static long init_dpi_fallback(void) {
  */
 void init_dpi(void) {
     xcb_xrm_database_t *database = NULL;
+    char *resource = NULL;
 
     if (conn == NULL) {
         goto init_dpi_end;
@@ -35,7 +36,6 @@ void init_dpi(void) {
         goto init_dpi_end;
     }
 
-    char *resource;
     xcb_xrm_resource_get_string(database, "Xft.dpi", NULL, &resource);
     if (resource == NULL) {
         DLOG("Resource Xft.dpi not specified, skipping.\n");
@@ -53,6 +53,10 @@ void init_dpi(void) {
     DLOG("Found Xft.dpi = %ld.\n", dpi);
 
 init_dpi_end:
+    if (resource != NULL) {
+        free(resource);
+    }
+
     if (database != NULL) {
         xcb_xrm_database_free(database);
     }
@@ -64,6 +68,14 @@ init_dpi_end:
     }
 }
 
+/*
+ * This function returns the value of the DPI setting.
+ *
+ */
+long get_dpi_value(void) {
+    return dpi;
+}
+
 /*
  * Convert a logical amount of pixels (e.g. 2 pixels on a “standard” 96 DPI
  * screen) to a corresponding amount of physical pixels on a standard or retina