From 6aa316e3c3498cac448773597c2cc9aa9b257986 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Sep 2021 10:21:57 -0400 Subject: [PATCH] Rearranged DPI calc so that on calc failure, returns 1. (#547) --- src/main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index a7147e76..4eb1ec03 100644 --- a/src/main.c +++ b/src/main.c @@ -18,13 +18,12 @@ SDL_Window *window; static double get_scale(void) { -#ifdef __APPLE__ - return 1.0; -#else - float dpi = 96.0; - SDL_GetDisplayDPI(0, NULL, &dpi, NULL); - return dpi / 96.0; +#ifndef __APPLE__ + float dpi; + if (SDL_GetDisplayDPI(0, NULL, &dpi, NULL) == 0) + return dpi / 96.0; #endif + return 1.0; }