From b43b9a6b81e572556800a82a5bda2befc578c4cc Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi

Date: Tue, 2 Feb 2021 15:01:01 +0200

Subject: [PATCH 1/1] Linux: Use SDL to query display monitor DPI value

IssueID #133


src/app.c | 8 ++++++++

src/ui/window.c | 10 ++++++++--

2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/app.c b/src/app.c

index f44fdf4f..a2d80bf2 100644

--- a/src/app.c

+++ b/src/app.c

@@ -373,6 +373,14 @@ static void init_App_(iApp *d, int argc, char **argv) {

#if defined (iPlatformMsys)

 /* Must scale by UI scaling factor. */

 mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32());

+#endif

+#if defined (iPlatformLinux)

#endif

 init_Prefs(&d->prefs);

 setCStr_String(&d->prefs.downloadDir, downloadDir_App_);

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) {

#if defined (iPlatformMsys)

 iUnused(d);

 return desktopDPI_Win32();

-#else

+#elif defined (iPlatformLinux)

+#else

 int dx, x;

 SDL_GetRendererOutputSize(d->render, &dx, NULL);

 SDL_GetWindowSize(d->win, &x, NULL);

@@ -764,6 +769,7 @@ void init_Window(iWindow *d, iRect rect) {

 useExecutableIconResource_SDLWindow(d->win);

#endif

#if defined (iPlatformLinux)

 /* Load the window icon. */ {

     int w, h, num;

     const iBlock *icon = &imageLagrange64_Embedded;

@@ -1033,7 +1039,7 @@ iInt2 rootSize_Window(const iWindow *d) {

}

iInt2 coord_Window(const iWindow *d, int x, int y) {

-#if defined (iPlatformMsys)

+#if defined (iPlatformMsys) || defined (iPlatformLinux)

 /* On Windows, surface coordinates are in pixels. */

 return init_I2(x, y);

#else

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.7/patch/b43b9a6b81e572556800a82a5bda2befc578c4cc.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
59.809907 milliseconds
Gemini-to-HTML Time
0.80587 milliseconds

This content has been proxied by September (ba2dc).