From 22592e1ce3684671285dee7782213d9786c780cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Mon, 31 Jul 2023 11:58:51 +0300
Subject: [PATCH 1/1] Mobile: Fixed UI layout regressions
Keyboard height changes need to be applied and cause layout changes.
There would be better ways to handle screen orientation changes
(observe the actual events about them!).
src/app.c | 3 +++
src/ui/window.c | 21 +++++++++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/app.c b/src/app.c
index 366037dd..f2a7c5be 100644
--- a/src/app.c
+++ b/src/app.c
@@ -2252,6 +2252,9 @@ static int resizeWatcher_(void *user, SDL_Event *event) {
}
iLocalDef iBool isResizeDrawEnabled_(void) {
return iFalse;
#if defined (LAGRANGE_ENABLE_RESIZE_DRAW)
if (!isXSession_X11()) {
diff --git a/src/ui/window.c b/src/ui/window.c
index 8c2a36ac..5b8b4da3 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1577,14 +1577,27 @@ void draw_MainWindow(iMainWindow *d) {
setCurrent_Text(d->base.text);
/* Check if root needs resizing. */ {
const iBool wasPortrait = isPortrait_App();
-// iInt2 renderSize;
-// SDL_GetRendererOutputSize(w->render, &renderSize.x, &renderSize.y);
+#if defined (iPlatformMobile)
/* On a mobile device, the window doesn't get freely resized. The render size will
change when the device orientation changes. */
iInt2 renderSize;
SDL_GetRendererOutputSize(w->render, &renderSize.x, &renderSize.y);
if (!isEqual_I2(renderSize, w->size)) {
updateSize_MainWindow_(d, iTrue);
processEvents_App(postedEventsOnly_AppEventMode); /* apply changes immediately */
if (isPortrait_App() != wasPortrait) {
d->maxDrawableHeight = renderSize.y;
}
}
+#else
/* On the desktop, we cannot process events now because that would interfere with
regular input processing (currently drawing the window). */
if (updateSize_MainWindow_(d, iTrue)) {
//processEvents_App(postedEventsOnly_AppEventMode);
if (isPortrait_App() != wasPortrait) {
d->maxDrawableHeight = w->size.y; // renderSize.y;
d->maxDrawableHeight = w->size.y;
}
}
+#endif
/* TODO: On macOS, a detached popup window will mess up the main window's rendering
completely. Looks like a render target mixup. macOS builds normally use native menus,
though, so leaving it in. */
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).