diff options
| author | Adam <adamdharrison@gmail.com> | 2021-09-26 10:21:57 -0400 |
|---|---|---|
| committer | Francesco Abbate <francesco.bbt@gmail.com> | 2021-10-02 18:39:21 +0200 |
| commit | 6aa316e3c3498cac448773597c2cc9aa9b257986 (patch) | |
| tree | 2a27614b3740fd40a03a1ac316c24abbee9ee92c /src | |
| parent | ed3ea35ed5f9ba403cdba0f8e5c94c769fca41db (diff) | |
| download | lite-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.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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; } |
