diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 8 | ||||
-rw-r--r-- | src/ui/window.c | 10 |
2 files changed, 16 insertions, 2 deletions
@@ -374,6 +374,14 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
374 | /* Must scale by UI scaling factor. */ | 374 | /* Must scale by UI scaling factor. */ |
375 | mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32()); | 375 | mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32()); |
376 | #endif | 376 | #endif |
377 | #if defined (iPlatformLinux) | ||
378 | /* Scale by the primary (?) monitor DPI. */ { | ||
379 | float vdpi; | ||
380 | SDL_GetDisplayDPI(0, NULL, NULL, &vdpi); | ||
381 | const float factor = vdpi / 96.0f; | ||
382 | mulfv_I2(&d->initialWindowRect.size, iMax(factor, 1.0f)); | ||
383 | } | ||
384 | #endif | ||
377 | init_Prefs(&d->prefs); | 385 | init_Prefs(&d->prefs); |
378 | setCStr_String(&d->prefs.downloadDir, downloadDir_App_); | 386 | setCStr_String(&d->prefs.downloadDir, downloadDir_App_); |
379 | d->isRunning = iFalse; | 387 | d->isRunning = iFalse; |
diff --git a/src/ui/window.c b/src/ui/window.c index 8df92706..f8123a17 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -685,7 +685,12 @@ static float pixelRatio_Window_(const iWindow *d) { | |||
685 | #if defined (iPlatformMsys) | 685 | #if defined (iPlatformMsys) |
686 | iUnused(d); | 686 | iUnused(d); |
687 | return desktopDPI_Win32(); | 687 | return desktopDPI_Win32(); |
688 | #else | 688 | #elif defined (iPlatformLinux) |
689 | float vdpi = 0.0f; | ||
690 | SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(d->win), NULL, NULL, &vdpi); | ||
691 | const float factor = vdpi / 96.0f; | ||
692 | return iMax(1.0f, factor); | ||
693 | #else | ||
689 | int dx, x; | 694 | int dx, x; |
690 | SDL_GetRendererOutputSize(d->render, &dx, NULL); | 695 | SDL_GetRendererOutputSize(d->render, &dx, NULL); |
691 | SDL_GetWindowSize(d->win, &x, NULL); | 696 | SDL_GetWindowSize(d->win, &x, NULL); |
@@ -764,6 +769,7 @@ void init_Window(iWindow *d, iRect rect) { | |||
764 | useExecutableIconResource_SDLWindow(d->win); | 769 | useExecutableIconResource_SDLWindow(d->win); |
765 | #endif | 770 | #endif |
766 | #if defined (iPlatformLinux) | 771 | #if defined (iPlatformLinux) |
772 | SDL_SetWindowMinimumSize(d->win, minSize.x * d->pixelRatio, minSize.y * d->pixelRatio); | ||
767 | /* Load the window icon. */ { | 773 | /* Load the window icon. */ { |
768 | int w, h, num; | 774 | int w, h, num; |
769 | const iBlock *icon = &imageLagrange64_Embedded; | 775 | const iBlock *icon = &imageLagrange64_Embedded; |
@@ -1033,7 +1039,7 @@ iInt2 rootSize_Window(const iWindow *d) { | |||
1033 | } | 1039 | } |
1034 | 1040 | ||
1035 | iInt2 coord_Window(const iWindow *d, int x, int y) { | 1041 | iInt2 coord_Window(const iWindow *d, int x, int y) { |
1036 | #if defined (iPlatformMsys) | 1042 | #if defined (iPlatformMsys) || defined (iPlatformLinux) |
1037 | /* On Windows, surface coordinates are in pixels. */ | 1043 | /* On Windows, surface coordinates are in pixels. */ |
1038 | return init_I2(x, y); | 1044 | return init_I2(x, y); |
1039 | #else | 1045 | #else |