From 1cd4c78086ab921f13393942ab06fadda196c6c9 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Mon, 21 Mar 2022 06:46:49 +0200

Subject: [PATCH 1/1] Mobile: Fixing phone toolbar glitches

Various combinations of the bottom URL/tab bar and toolbar hiding options weren't playing nicely together.


src/app.h | 1 +

src/ui/root.c | 17 +++++++++++------

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

src/ui/widget.c | 39 +++++----------------------------------

4 files changed, 25 insertions(+), 42 deletions(-)

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

index 003b8d37..f2f1fb0d 100644

--- a/src/app.h

+++ b/src/app.h

@@ -88,6 +88,7 @@ iBool isLandscape_App (void);

iLocalDef iBool isPortrait_App (void) { return !isLandscape_App(); }

enum iAppDeviceType deviceType_App (void);

iLocalDef iBool isPortraitPhone_App (void) { return isPortrait_App() && deviceType_App() == phone_AppDeviceType; }

+iLocalDef iBool isLandscapePhone_App(void) { return isLandscape_App() && deviceType_App() == phone_AppDeviceType; }

iBool isRunningUnderWindowSystem_App (void);

iGmCerts * certs_App (void);

diff --git a/src/ui/root.c b/src/ui/root.c

index ca73f3a5..da90a796 100644

--- a/src/ui/root.c

+++ b/src/ui/root.c

@@ -523,7 +523,6 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {

         addChildPos_Widget(findChild_Widget(root, "tabs.content"), iClob(sidebar), front_WidgetAddPos);            

         setWidth_SidebarWidget(sidebar, 73.0f);

         setFlags_Widget(as_Widget(sidebar), fixedHeight_WidgetFlag | fixedPosition_WidgetFlag, iFalse);

     }

     else {

         addChild_Widget(root, iClob(sidebar));

@@ -535,8 +534,8 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {

         setMidHeight_SidebarWidget(sidebar, midHeight);

         setFixedSize_Widget(as_Widget(sidebar), init_I2(-1, midHeight));

         setPos_Widget(as_Widget(sidebar), init_I2(0, height_Widget(root) - midHeight));

     }

     return iFalse;

 }

 else if (equal_Command(cmd, "root.arrange")) {

@@ -849,8 +848,8 @@ static void updateNavBarSize_(iWidget *navBar) {

     static const char *buttons[] = { "navbar.action1", "navbar.action2", "navbar.action3",

                                      "navbar.action4", "navbar.ident",   "navbar.menu" };

     iWidget *toolBar = findWidget_Root("toolbar");

+// setVisualOffset_Widget(toolBar, 0, 0, 0);

+// setFlags_Widget(toolBar, hidden_WidgetFlag, isLandscape_App());

     iForIndices(i, buttons) {

         iLabelWidget *btn = findChild_Widget(navBar, buttons[i]);

         setFlags_Widget(as_Widget(btn), hidden_WidgetFlag, isPortrait_App());

@@ -1685,6 +1684,7 @@ void createUserInterface_Root(iRoot *d) {

                          moveToParentBottomEdge_WidgetFlag |

                              parentCannotResizeHeight_WidgetFlag | arrangeVertical_WidgetFlag |

                              arrangeHeight_WidgetFlag | resizeWidthOfChildren_WidgetFlag |

                              drawBackgroundToBottom_WidgetFlag);

     iWidget *toolBar = new_Widget();

     addChild_Widget(bottomBar, iClob(toolBar));

@@ -1908,7 +1908,6 @@ static void setBottomBarPosition_(iWidget *bottomBar, iBool show, iBool animate)

 iWidget *docTabs = findChild_Widget(root->widget, "doctabs");

 iWidget *toolBar = findChild_Widget(bottomBar, "toolbar");

 iWidget *navBar = findChild_Widget(root->widget, "navbar");

 size_t numPages = 0;

 iBool bottomTabBar = prefs->bottomTabBar;

 if (prefs->bottomTabBar || prefs->bottomNavBar) {

@@ -1927,6 +1926,7 @@ static void setBottomBarPosition_(iWidget *bottomBar, iBool show, iBool animate)

 }

#endif

 showCollapsed_Widget(toolBar, isPortrait_App());

 if (show) {

     if (flags_Widget(bottomBar) & hidden_WidgetFlag) {

         setFlags_Widget(bottomBar, hidden_WidgetFlag, iFalse);

@@ -1938,7 +1938,12 @@ static void setBottomBarPosition_(iWidget *bottomBar, iBool show, iBool animate)

     }

     if (bottomTabBar) {

         /* Tab bar needs to stay visible, too. */

         //tabBar->flags2 |= permanentVisualOffset_WidgetFlag2;

     }

 }

diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c

index 3536d2fc..2a2ce30a 100644

--- a/src/ui/sidebarwidget.c

+++ b/src/ui/sidebarwidget.c

@@ -1365,12 +1365,18 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)

                         isPortrait_App());

         setBackgroundColor_Widget(w, isPortrait_App() ? uiBackgroundSidebar_ColorId : none_ColorId);

     }

         /* In sliding sheet mode, sidebar is resized to fit in the safe area. */

         setPadding_Widget(d->actions, 0, 0, 0, bottomSafeInset_Mobile());

     }

     else {

     }

     return iFalse;

 }

diff --git a/src/ui/widget.c b/src/ui/widget.c

index 61c8a37e..632e3900 100644

--- a/src/ui/widget.c

+++ b/src/ui/widget.c

@@ -1518,18 +1518,16 @@ void drawLayerEffects_Widget(const iWidget *d) {

     }

     if (top < 0) {

         fillRect_Paint(&p, (iRect){ init_I2(left_Rect(rect), 0),

     }

     if (left < 0) {

         fillRect_Paint(&p, (iRect){ init_I2(0, top_Rect(rect)),

     }

     if (right > 0) {

         fillRect_Paint(&p, (iRect){ init_I2(right_Rect(rect), top_Rect(rect)),

     }

-// adjustEdges_Rect(&rect, iMin(0, top), iMax(0, right), iMax(0, bottom), iMin(0, left));

 }

#endif

}

@@ -1545,38 +1543,11 @@ void drawBackground_Widget(const iWidget *d) {

 if (d->bgColor >= 0 || d->frameColor >= 0) {

     iRect rect = bounds_Widget(d);

     if (d->flags & drawBackgroundToBottom_WidgetFlag) {

     }

     iPaint p;

     init_Paint(&p);

     if (d->bgColor >= 0) {

-#if 0 && defined (iPlatformAppleMobile)

-#endif

         fillRect_Paint(&p, rect, d->bgColor);

     }

     if (d->frameColor >= 0 && ~d->flags & frameless_WidgetFlag) {

@@ -1625,7 +1596,7 @@ static void addToPotentiallyVisible_Widget_(const iWidget *d, iPtrArray *pvs, iR

 if (isDrawn_Widget_(d)) {

     iRect bounds = bounds_Widget(d);

     if (d->flags & drawBackgroundToBottom_WidgetFlag) {

     }

     if (isFullyContainedByOther_Rect(bounds, *fullyMasked)) {

         return; /* can't be seen */

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.12/patch/1cd4c78086ab921f13393942ab06fadda196c6c9.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
76.454735 milliseconds
Gemini-to-HTML Time
2.719081 milliseconds

This content has been proxied by September (3851b).