diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-08-29 15:52:06 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-08-29 15:53:41 +0300 |
commit | fbad0cc670fc12f135af2a60f4af2aa9bd93cf9c (patch) | |
tree | 2100291c635de90389688533171d12fa6a52b8ed /src/ui | |
parent | f01530f64b1e3951e0239ac8d2000cef57e814ba (diff) |
Fixed running under KMSDRM video driver on Linux
SDL2 works fine without a window system, but it seems the DPI-querying
API will crash so let's not call that.
Should still add command line options to control the screen resolution,
i.e., overriding the window size.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/window.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index ebb4d1a8..f8391ed9 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -278,11 +278,14 @@ static float displayScale_Window_(const iWindow *d) { | |||
278 | iUnused(d); | 278 | iUnused(d); |
279 | return desktopDPI_Win32(); | 279 | return desktopDPI_Win32(); |
280 | #else | 280 | #else |
281 | float vdpi = 0.0f; | 281 | if (isRunningUnderWindowSystem_App()) { |
282 | SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(d->win), NULL, NULL, &vdpi); | 282 | float vdpi = 0.0f; |
283 | // printf("DPI: %f\n", vdpi); | 283 | SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(d->win), NULL, NULL, &vdpi); |
284 | const float factor = vdpi / baseDPI_Window / pixelRatio_Window_(d); | 284 | // printf("DPI: %f\n", vdpi); |
285 | return iMax(1.0f, factor); | 285 | const float factor = vdpi / baseDPI_Window / pixelRatio_Window_(d); |
286 | return iMax(1.0f, factor); | ||
287 | } | ||
288 | return 1.0f; | ||
286 | #endif | 289 | #endif |
287 | } | 290 | } |
288 | 291 | ||