From 80e59939ece01707de32b4f7ee6c54a35e773c9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Sat, 21 Oct 2023 16:16:07 +0300
Subject: [PATCH 1/1] iPadOS: Fixed incorrect display scaling
Workaround is to not trust what SDL is reporting.
IssueID #626
res/about/ios-version.gmi | 1 +
src/ios.h | 1 +
src/ios.m | 6 +++++-
src/ui/window.c | 4 ++++
4 files changed, 11 insertions(+), 1 deletion(-)
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 @@
+* (iPad) Fixed incorrect display scaling when launching the app in Slide Over or Split View mode.
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) {
+}
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)
+#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)
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).