Add configurable radial menu for controls#1709
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (20)
🚧 Files skipped from review as they are similar to previous changes (19)
📝 WalkthroughWalkthroughAdds a configurable radial menu with persisted slots and bindings, controller and touch gesture activation, an interactive overlay, settings UI, QuickMenu access, profile synchronization, gamepad dispatch, lifecycle cleanup, and localized strings. ChangesRadial menu feature
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant XServerScreen
participant RadialMenuCoordinator
participant RadialMenuOverlayView
participant XServer
User->>XServerScreen: touch, gesture, or controller input
XServerScreen->>RadialMenuCoordinator: route radial menu event
RadialMenuCoordinator->>RadialMenuOverlayView: open and update selection
RadialMenuOverlayView-->>RadialMenuCoordinator: selected binding on release
RadialMenuCoordinator->>XServer: dispatch binding and gamepad state
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 12
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@app/src/main/java/app/gamenative/ui/screen/xserver/PhysicalControllerHandler.kt`:
- Line 27: Update closeRadialMenuIfOpen() and its teardown callers, including
profile changes and cleanup(), to accept or propagate a commit/cancel choice and
invoke the radial-menu close path with commit = false during lifecycle closure.
Preserve normal release behavior with commit = true for user-triggered button
release, so RadialMenuCoordinator does not execute the highlighted slot during
teardown.
- Around line 173-179: Update the radial-menu opening transition in
PhysicalControllerHandler, around the radialMenuPressed handling and its
motion-opener path, to neutralize any previously active gamepad axes, triggers,
and mouse movement before returning to radial selection. Exclude the control
that opened the menu, send neutral release states once on the opening
transition, and preserve normal radial-menu vector updates and opener-release
behavior.
- Around line 46-48: Update PhysicalControllerHandler’s radial-menu state to
track the opener controller device ID alongside radialMenuOpenerKeyCode. Record
the device ID when opening the menu, and in the radial input, selection,
release, and close paths ignore events from other devices so only the opener can
drive or close the menu; preserve existing keycode checks and
motion-versus-digital behavior.
In `@app/src/main/java/app/gamenative/ui/screen/xserver/RadialMenuCoordinator.kt`:
- Around line 263-266: The radial-stick handling in the visible magnitude check
must clear the current selection when the controller returns to the dead zone.
Update the relevant selection state in the coordinator before returning from the
magnitude < 0.25f branch, so releasing the opener selects the displayed cancel
area rather than committing the previous slot.
- Around line 326-336: Update the profile creation flow in RadialMenuCoordinator
around duplicateProfile so any duplication or subsequent linkage/save failure
aborts settings instead of returning sourceProfile. Keep the duplicate
operation, name assignment, container profileId update, and persistence within
one failure boundary, and propagate or handle the failure so the settings dialog
is not opened with an inconsistent profile.
In `@app/src/main/java/app/gamenative/ui/screen/xserver/RadialMenuOverlayView.kt`:
- Around line 192-199: Update label sizing in the radial menu drawing logic
around fitLabel and textRadiusPx so the maximum label width is derived from the
available slice width represented by sweep and textRadiusPx, rather than using
the fixed radiusPx * 0.62f constraint. Preserve support for all configured
action counts, including 12 slots, and continue passing the resulting
constrained label to canvas.drawText.
In `@app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt`:
- Line 1124: Update the profile-swap flow near radialMenuCoordinator.setProfile
to also call physicalControllerHandler?.setProfile with the same activeProfile,
or use a shared helper that updates both components. Ensure OPEN_RADIAL_MENU
uses the new profile’s bindings after every profile change.
In `@app/src/main/java/com/winlator/inputcontrols/ControlElement.java`:
- Around line 1261-1266: Update the Type.BUTTON release handling in
ControlElement so radial-menu buttons handled by isRadialMenuButton() do not
proceed into the common toggleSwitch logic. Ensure the OPEN_RADIAL_MENU action
remains momentary by bypassing or clearing toggle behavior for that branch,
while preserving the existing radial-menu touch-up and invalidation calls.
- Around line 1078-1084: Before the radial-menu early return in the directional
handling logic of ControlElement, release every previously active directional
binding recorded in states, including keyboard, mouse, and gamepad inputs, then
clear their active state before calling handleRadialMenuTouchDown. Preserve
normal radial-menu activation and ensure the existing cleanup path cannot leave
prior directional inputs held.
In `@app/src/main/java/com/winlator/widget/InputControlsView.java`:
- Around line 1283-1285: The ACTION_CANCEL handling must release the saved
radial pointer without committing any radial button. Update the cancellation
flow around handleRadialMenuTouchUp and the element-loop handleTouchUp path to
use a dedicated cancel-release operation for radial controls, keyed by
radialMenuTouchPointerId rather than the event action-index pointer, while
preserving normal touch-up behavior.
In `@app/src/main/res/values-ru/strings.xml`:
- Line 1985: Update the radial_menu_slot_count_subtitle string to use the
natural Russian wording “Активных слотов: %1$d” while preserving the existing
numeric placeholder.
- Around line 1991-1992: Update the Russian translations
radial_menu_slot_binding and radial_menu_slot_binding_summary to use the
established “Привязка” terminology instead of “Назначение,” preserving their
existing format placeholders.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6a9b6cc6-d51d-4a4f-a552-4eb4437de9f8
📒 Files selected for processing (31)
app/src/main/java/app/gamenative/PluviaApp.ktapp/src/main/java/app/gamenative/data/TouchGestureConfig.ktapp/src/main/java/app/gamenative/ui/component/QuickMenu.ktapp/src/main/java/app/gamenative/ui/component/dialog/RadialMenuSettingsDialog.ktapp/src/main/java/app/gamenative/ui/component/dialog/TouchGestureSettingsDialog.ktapp/src/main/java/app/gamenative/ui/screen/xserver/InputControlsProfileCopy.ktapp/src/main/java/app/gamenative/ui/screen/xserver/PhysicalControllerHandler.ktapp/src/main/java/app/gamenative/ui/screen/xserver/RadialMenuCoordinator.ktapp/src/main/java/app/gamenative/ui/screen/xserver/RadialMenuOverlayView.ktapp/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.ktapp/src/main/java/com/winlator/inputcontrols/Binding.javaapp/src/main/java/com/winlator/inputcontrols/ControlElement.javaapp/src/main/java/com/winlator/inputcontrols/ControlsProfile.javaapp/src/main/java/com/winlator/inputcontrols/RadialMenu.javaapp/src/main/java/com/winlator/widget/InputControlsView.javaapp/src/main/java/com/winlator/widget/TouchpadView.javaapp/src/main/res/values-da/strings.xmlapp/src/main/res/values-de/strings.xmlapp/src/main/res/values-es/strings.xmlapp/src/main/res/values-fr/strings.xmlapp/src/main/res/values-it/strings.xmlapp/src/main/res/values-ja/strings.xmlapp/src/main/res/values-ko/strings.xmlapp/src/main/res/values-pl/strings.xmlapp/src/main/res/values-pt-rBR/strings.xmlapp/src/main/res/values-ro/strings.xmlapp/src/main/res/values-ru/strings.xmlapp/src/main/res/values-uk/strings.xmlapp/src/main/res/values-zh-rCN/strings.xmlapp/src/main/res/values-zh-rTW/strings.xmlapp/src/main/res/values/strings.xml
There was a problem hiding this comment.
All reported issues were addressed across 31 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
Description
Adds a configurable radial menu for control profiles. The radial menu setting is in the in-game quick menu.
Users can bind on-screen controls, touchscreen gestures, or physical controller inputs to open a radial wheel with up to 12 actions. Radial slots can trigger existing bindings such as keyboard keys, mouse buttons, gamepad buttons, show keyboard, etc.
Recording
https://drive.google.com/file/d/1J8N80X6IBjkhhcNJCU-v48TmQf0LYGC7/view?usp=sharing
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by CodeRabbit