fix(macos): bind Safari navigation to press-time process - #1082
fix(macos): bind Safari navigation to press-time process#1082foleykyle01 wants to merge 14 commits into
Conversation
1ea4782 to
3b12248
Compare
|
Safari took a brief detour through the Linux and Windows build lanes lol. It’s back in its macOS lane now—cross-target Clippy is green locally. |
|
Would absolutely love a version with this fix in it. Reversing the buttons is a workaround, but muscle memory is driving me insane. Love the app by the way, so glad there's finally a good replacement. |
c5c60eb to
bc73714
Compare
|
Greptile's latest reservation warning assumes the two mouse capture paths dispatch concurrently. They do not: OS-hook and HID++ Back/Forward events both enter the same ButtonRuntimeOwner worker, and Safari AX dispatch is synchronous in that worker. If AX fails, browser_nav_debounce_cancel runs before the worker can dequeue the duplicate event, so that second path is admitted. The failed_captured_navigation_releases_its_debounce_reservation regression covers this sequence. The separate hook action worker handles configured function-key actions, not duplicate mouse capture, so I do not think a code change is needed for this finding. |
87d898e to
1054ad8
Compare
|
Have you looked at the swipe-based approach used by e.g https://github.com/weiyou/sensible-side-buttons-rust? It seems like a better option since it doesn't require any browser-specific workarounds. |
|
Thanks for the suggestion. This PR is intentionally scoped to fixing Back/Forward in Safari on macOS. Switching to synthesized swipe events would be a broader architectural decision for the maintainers, so that is outside the scope of this fix. |
1054ad8 to
b6ff420
Compare
| impl ActionDispatchTarget { | ||
| fn capture() -> Self { | ||
| openlogi_inject::frontmost_safari_pid().map_or(Self::Keyboard, Self::SafariProcess) | ||
| } |
There was a problem hiding this comment.
Synchronous Input-Tap AppKit Call
ActionDispatchTarget::capture() calls NSWorkspace.frontmostApplication() synchronously from the macOS global event-tap callback. This capture runs for every candidate button press, bound key, and thumb-wheel action, not only browser navigation. If the AppKit call stalls, shorter stalls delay the system-wide input tap, while a stall beyond the 200 ms watchdog budget terminates the agent. Capture the application identity without doing potentially blocking AppKit work on the tap thread, for example by maintaining an asynchronous frontmost-application snapshot.
b6ff420 to
058d9a9
Compare
Summary
Harden Safari Back and Forward dispatch on macOS by binding each action to the Safari process that was active when the physical input was pressed.
#1225 fixed the primary routing problem by making explicit Browser Back and Browser Forward bindings enter the dispatch path. This PR now covers the remaining Safari-specific focus-safety work: queued input cannot fall through to an application that became active after the press.
Changes
NSWorkspaceactivation observer, keeping AppKit reads off the freeze-sensitive event-tap callback.AXPress; do not send a keyboard fallback after the target becomes stale.Testing
cargo fmt --all -- --checkRUSTFLAGS='-D warnings' cargo clippy --workspace --all-targets -- -D warningsRUSTFLAGS='-D warnings' cargo test --workspace— all runnable tests passed exceptopenlogi-hook::tap_callback_suppresses_normally_and_passes_through_panics; the same unchanged test fails onorigin/masterbecause this host session cannot create a privateCGEventSource.RUSTDOCFLAGS='-D warnings' cargo doc --workspace --no-deps --document-private-items --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay --exclude openlogi-agentRUSTFLAGS='-D warnings' cargo xtask ci clippy-windows058d9a99. Current heade9678b92is an empty CI-retry commit with the identical source tree.34380533484: four Ubuntu jobs stopped inapt-get updatebefore compilation becausedl.google.com/linux/chrome-stablereturned a package-index hash mismatch. The retry workflows require upstream maintainer approval.Related