diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/window.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index eb0c7d3a..60c1483d 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -63,6 +63,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
63 | #include "stb_image.h" | 63 | #include "stb_image.h" |
64 | #include "stb_image_resize.h" | 64 | #include "stb_image_resize.h" |
65 | 65 | ||
66 | #include <stdlib.h> | ||
67 | #include <string.h> | ||
68 | |||
66 | static iWindow *theWindow_ = NULL; | 69 | static iWindow *theWindow_ = NULL; |
67 | 70 | ||
68 | #if defined (iPlatformApple) || defined (iPlatformLinux) | 71 | #if defined (iPlatformApple) || defined (iPlatformLinux) |
@@ -1357,6 +1360,24 @@ static float pixelRatio_Window_(const iWindow *d) { | |||
1357 | #endif | 1360 | #endif |
1358 | 1361 | ||
1359 | static float displayScale_Window_(const iWindow *d) { | 1362 | static float displayScale_Window_(const iWindow *d) { |
1363 | char* LAGRANGE_OVERRIDE_DPI = getenv("LAGRANGE_OVERRIDE_DPI"); | ||
1364 | |||
1365 | /* If LAGRANGE_OVERRIDE_DPI is not set, or is an empty string, ignore it. */ | ||
1366 | if ((LAGRANGE_OVERRIDE_DPI != NULL) && (strnlen(LAGRANGE_OVERRIDE_DPI, 1) > 0)) { | ||
1367 | /* This if the user has set the env var, but it is not an int, atoi */ | ||
1368 | /* will return 0, in which case we just guess and return 96 DPI. */ | ||
1369 | int env_dpi = atoi(LAGRANGE_OVERRIDE_DPI); | ||
1370 | |||
1371 | if (env_dpi == 0) { | ||
1372 | fprintf(stderr, "WARNING: failed to parse LAGRANGE_OVERRIDE_DPI='%s', ignoring it\n", LAGRANGE_OVERRIDE_DPI); | ||
1373 | /* To avoid showing the window multiple times, overwrite | ||
1374 | * LAGRANGE_OVERRIDE_DPI with the empty string. */ | ||
1375 | setenv("LAGRANGE_OVERRIDE_DPI", "", 1); | ||
1376 | } else { | ||
1377 | return ((float) env_dpi) / baseDPI_Window; | ||
1378 | } | ||
1379 | } | ||
1380 | |||
1360 | #if defined (iPlatformApple) | 1381 | #if defined (iPlatformApple) |
1361 | iUnused(d); | 1382 | iUnused(d); |
1362 | /* Apple UI sizes are fixed and only scaled by pixel ratio. */ | 1383 | /* Apple UI sizes are fixed and only scaled by pixel ratio. */ |