Repository navigation
Conversation
This was referenced Sep 26, 2026
Author
chrislearn
pushed a commit
to chrislearn/makepad
that referenced
this pull request
Sep 28, 2026
A host that regenerates a Splash body from declarative data (Rinx's L0 mini apps) must keep focus, selection and scroll state in the named widgets it already has. reapply_text evaluates the new body with Apply::Reload into the existing view; set_text still tears the instance down. From OctoSense-org#32 (its Splash part), on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Every Back (key, navigation button, system edge gesture) now goes through one MakepadActivity.dispatchBackPressed(): an open QR scanner closes, the application extension may consume it, otherwise MakepadNative.onBackPressed. super.onBackPressed() no longer finishes or backgrounds the activity before the widget tree has handled the event. The surface leaves KEYCODE_BACK unhandled instead of forwarding it to Rust as KeyDown(Back) (which became a second BackPressed). Below API 33 the activity's onKeyUp -> onBackPressed delivers it; on API 33+ an OnBackInvokedCallback (PRIORITY_DEFAULT, so the IME's Back stays first) does, and cargo-makepad's manifests opt every activity in with android:enableOnBackInvokedCallback. ApplicationExtension.usesSystemBackCallback() lets an extension that owns its own system callback keep it: the activity then registers none and drops the compatibility Back key. This upstreams OctoSense's tools/runtime-patches/makepad-system-back.patch with the same interface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ymote
force-pushed
the
feat/rinx-host-services
branch
from
October 1, 2026 16:07
3fda5b6 to
76311da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Android Back now reaches the native widget tree exactly once, on every API level and for every source: the hardware or navigation-bar Back key, and on Android 13+ the system edge gesture. The activity no longer finishes or backgrounds itself before widgets handle the event.
The Splash half of this PR's original scope landed separately in #35 (
widgets/src/splash.rsreapply_text), so this branch has been rebased onto main and cut down to the Android Back change. The manifest extension-class override that used to be in it is gone too; it was unrelated to Back.What changed
tools/cargo_makepad/src/android/java/dev/makepad/android/MakepadActivity.javadispatchBackPressed(). It closes an open QR scanner, then offers the event toApplicationExtension.onBackPressed(), then sendsMakepadNative.onBackPressed().super.onBackPressed()is gone because it finished the activity (or backgrounded it on API 31+) before Rust had seen the event.KEYCODE_BACK. Before,MakepadSurface.onKeyforwarded the key to Rust, which turnedKeyDown(Back)intoBackPressed, and the framework also delivered Back through the activity, so one press produced two navigations. Now the key is left unhandled. Below API 33 it reachesonKeyUp→onBackPressed. On API 33+ theOnBackInvokedCallbackreceives it.OnBackInvokedCallbackon Android 13+. It usesPRIORITY_DEFAULT, so dismissing the IME still comes first, and it is unregistered inonDestroy.ApplicationExtension.usesSystemBackCallback()is a new default method that returns false. An extension that registers its own system callback, as OctoSense's shell extension does, returns true. In that case the activity registers no callback of its own and drops the compatibility Back key indispatchKeyEvent, so there is still only one delivery.tools/cargo_makepad/src/android/mod.rsandroid:enableOnBackInvokedCallback="true". Without that opt-in, Android 13+ ignores the callback.singleTaskactivity in both variants carries the opt-in.Relation to OctoSense's
makepad-system-back.patchThis PR upstreams OctoSense's
tools/runtime-patches/makepad-system-back.patchand goes further than it:usesSystemBackCallback()interface method, the API 33+ compatibility-key drop when the extension owns the callback, and closing the QR scanner fromonBackPressed.super.onBackPressed()and gives plain cargo-makepad apps, which have no extension, the same single-delivery behaviour.The method name and semantics are unchanged, so
MakepadAppExtension.javacompiles as-is. When OctoSense repins to a makepad that includes this PR, it should drop the patch, which will no longer apply. Its shell extension can keep its own callback (throughusesSystemBackCallback()), or delete itsSystemBackhelper and rely on the activity's callback plusonBackPressed().Validation
cargo check -p makepad-widgets: cleancargo test -p cargo-makepad android::: passes, including the new manifest testcargo makepad android build -p makepad-example-hello-world(aarch64) with this checkout's cargo-makepad, so the modifiedMakepadActivity.javais compiled by javac and packaged🤖 Generated with Claude Code