From 40b146ab309f456ef8b15bf23dc24cdc8905f0cd Mon Sep 17 00:00:00 2001 From: Shai Almog <67850168+shai-almog@users.noreply.github.com> Date: Sun, 26 Apr 2026 09:17:56 +0300 Subject: [PATCH 1/2] Toolbar: restore setSafeArea on StatusBar button branch (#4814 regression) The fix in #4814 wrapped the StatusBar component creation in an if/else but only set setSafeArea(true) on the Container fallback. With the default statusBarScrollsUpBool=true the new Button branch ran without safe-area treatment, so the iOS top inset was no longer reserved and every form shifted vertically. iOS screenshot tests caught this: 36 of 37 baselines diverged on the merge commit. Move setSafeArea(true) below the if/else so it applies to both the Button and Container cases, matching the pre-#4814 behavior. Co-Authored-By: Claude Opus 4.7 (1M context) --- CodenameOne/src/com/codename1/ui/Toolbar.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CodenameOne/src/com/codename1/ui/Toolbar.java b/CodenameOne/src/com/codename1/ui/Toolbar.java index 2d84743456..817d6a9eaf 100644 --- a/CodenameOne/src/com/codename1/ui/Toolbar.java +++ b/CodenameOne/src/com/codename1/ui/Toolbar.java @@ -2549,9 +2549,7 @@ public void actionPerformed(ActionEvent evt) { }); bar = btn; } else { - Container c = new Container(); - c.setSafeArea(true); - bar = c; + bar = new Container(); } if (getUIManager().isThemeConstant("landscapeTitleUiidBool", false)) { bar.setUIID("StatusBar", "StatusBarLandscape"); @@ -2559,6 +2557,7 @@ public void actionPerformed(ActionEvent evt) { bar.setUIID("StatusBar"); } reallocateVerticalPaddingAndMarginsToTop(bar); + bar.setSafeArea(true); addComponent(BorderLayout.NORTH, bar); } } else { From a7099d61381d80a520136cbc4c654ae9e0bb4eb1 Mon Sep 17 00:00:00 2001 From: Shai Almog <67850168+shai-almog@users.noreply.github.com> Date: Sun, 26 Apr 2026 09:29:40 +0300 Subject: [PATCH 2/2] Toolbar: keep StatusBar as a Container to preserve safeArea behavior The previous fix attempt ran into a compile error because Component.setSafeArea does not exist - setSafeArea is only defined on Container. Replacing the StatusBar Container with a Button (as #4814 did) therefore drops safe-area support entirely, which is what made 36 of 37 iOS screenshot baselines diverge. Keep the StatusBar as a Container (so setSafeArea(true) and the StatusBar UIID styling continue to apply unchanged), and attach a pointer-released listener to it for the scroll-to-top behavior #4814 introduced. The synthetic iOS tap forwarded by cn1StatusBarTapProxy still fires Component.pointerReleased, which dispatches to that listener. Co-Authored-By: Claude Opus 4.7 (1M context) --- CodenameOne/src/com/codename1/ui/Toolbar.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/CodenameOne/src/com/codename1/ui/Toolbar.java b/CodenameOne/src/com/codename1/ui/Toolbar.java index 817d6a9eaf..513ff69cd3 100644 --- a/CodenameOne/src/com/codename1/ui/Toolbar.java +++ b/CodenameOne/src/com/codename1/ui/Toolbar.java @@ -2531,11 +2531,9 @@ protected void initTitleBarStatus() { if (getUIManager().isThemeConstant("paintsTitleBarBool", false)) { // check if its already added: if (((BorderLayout) getLayout()).getNorth() == null) { - Component bar; + Container bar = new Container(); if (getUIManager().isThemeConstant("statusBarScrollsUpBool", true)) { - Button btn = new Button(); - btn.setShowEvenIfBlank(true); - btn.addActionListener(new ActionListener() { + bar.addPointerReleasedListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { Form parent = getComponentForm(); @@ -2547,9 +2545,6 @@ public void actionPerformed(ActionEvent evt) { } } }); - bar = btn; - } else { - bar = new Container(); } if (getUIManager().isThemeConstant("landscapeTitleUiidBool", false)) { bar.setUIID("StatusBar", "StatusBarLandscape");