Lagrange [work/v1.7]

iPadOS: Fixed incorrect display scaling

=> 80e59939ece01707de32b4f7ee6c54a35e773c9e

diff --git a/res/about/ios-version.gmi b/res/about/ios-version.gmi
index d04a2a86..a42130b0 100644
--- a/res/about/ios-version.gmi
+++ b/res/about/ios-version.gmi
@@ -10,6 +10,7 @@
 * Added "Vibrant Light" color theme.
 * Improved readability of "Colorful Light" headings.
 * Preformatted blocks no longer switch to a smaller font to fit to the page.
+* (iPad) Fixed incorrect display scaling when launching the app in Slide Over or Split View mode.
 * Fixed horizontal scrolling issues with preformatted blocks: only scroll if needed, allow scrolling anywhere on the block and not just on non-empty text lines, and when scrolling disallow swipe navigation over the area.
 * Fixed visual artifacts around and next to preformatted blocks (e.g., streaking).
 * Fixed potential crash after (un)folding a preformatted block.
diff --git a/src/ios.h b/src/ios.h
index 768733fc..f501d504 100644
--- a/src/ios.h
+++ b/src/ios.h
@@ -43,6 +43,7 @@ void    openFileActivityView_iOS(const iString *path);
 iBool   isPhone_iOS             (void);
 void    safeAreaInsets_iOS      (float *left, float *top, float *right, float *bottom);
 int     displayRefreshRate_iOS  (void);
+float   displayScale_iOS        (const iWindow *window);
 
 /*----------------------------------------------------------------------------------------------*/
 
diff --git a/src/ios.m b/src/ios.m
index a463230a..08c13660 100644
--- a/src/ios.m
+++ b/src/ios.m
@@ -43,7 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
 static iBool isSystemDarkMode_ = iFalse;
 static iBool isPhone_          = iFalse;
 
-static UIWindow *uiWindow_(iWindow *window) {
+static UIWindow *uiWindow_(const iWindow *window) {
     SDL_SysWMinfo wm;
     SDL_VERSION(&wm.version);
     if (SDL_GetWindowWMInfo(window->win, &wm)) {
@@ -540,6 +540,10 @@ int displayRefreshRate_iOS(void) {
     return (int) uiWindow_(get_Window()).screen.maximumFramesPerSecond;
 }
 
+float displayScale_iOS(const iWindow *window) {
+    return uiWindow_(window).screen.scale;
+}
+
 void setupWindow_iOS(iWindow *window) {
     UIViewController *ctl = viewController_(window);
     isSystemDarkMode_ = isDarkMode_(window);
diff --git a/src/ui/window.c b/src/ui/window.c
index 2b4e3835..9c462c0c 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -376,10 +376,14 @@ void drawWhileResizing_MainWindow(iMainWindow *d, int w, int h) {
 }
 
 static float pixelRatio_Window_(const iWindow *d) {
+#if defined (iPlatformAppleMobile)
+    return displayScale_iOS(d);
+#else
     int dx, x;
     SDL_GetRendererOutputSize(d->render, &dx, NULL);
     SDL_GetWindowSize(d->win, &x, NULL);
     return (float) dx / (float) x;
+#endif
 }
 
 #if defined (iPlatformApple)
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.7/cdiff/80e59939ece01707de32b4f7ee6c54a35e773c9e
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
66.725189 milliseconds
Gemini-to-HTML Time
0.309091 milliseconds

This content has been proxied by September (ba2dc).