aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2021-09-26 10:21:57 -0400
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-10-02 18:39:21 +0200
commit6aa316e3c3498cac448773597c2cc9aa9b257986 (patch)
tree2a27614b3740fd40a03a1ac316c24abbee9ee92c /src
parented3ea35ed5f9ba403cdba0f8e5c94c769fca41db (diff)
downloadlite-xl-6aa316e3c3498cac448773597c2cc9aa9b257986.tar.gz
lite-xl-6aa316e3c3498cac448773597c2cc9aa9b257986.zip
Rearranged DPI calc so that on calc failure, returns 1. (#547)
Diffstat (limited to 'src')
-rw-r--r--src/main.c11
1 files 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;
}