Repository navigation
feat(windows): expose native touch input to Cx::touch_controls - #2638
Merged
Merged
Conversation
- Track per-window native PrimaryPointer (Hover vs Touch) in HostState and expose it through Cx::touch_controls() and Cx::hover_none(), re-running views and memos only when read. - On Windows, classify WM_TOUCH and WM_POINTER* (PT_TOUCH vs PT_PEN/PT_MOUSE/PT_TOUCHPAD) via a lightweight window subclass, distinguish touch-promoted vs pen-promoted mouse messages via MI_WP_SIGNATURE bit 7, and reconcile Windows tablet posture (SM_MAXIMUMTOUCHES, SM_DIGITIZER, SM_CONVERTIBLESLATEMODE, SM_MOUSEPRESENT, and WM_SETTINGCHANGE for ConvertibleSlateMode / UserInteractionMode) without clobbering live touch mode on focus changes. - Add Runtime::touch_controls() / Runtime::set_touch_controls() (and default iOS LayerHost to touch controls), keeping web CSS media query behavior unchanged.
pascalandr
added a commit
to NeuralNomadsAI/rune
that referenced
this pull request
Nov 27, 2026
Upstream merged the first Android slice (anomalyco#2662, closing anomalyco#2647): the winit activity feature, the getloadavg gate and an android workflow. Taken from upstream: runq.rs, the Android target section of rune's Cargo.toml (the fork's JNI, NDK and AccessKit dependencies now sit in it), android.yml and the changelog entry; the fork's own S0 entry goes. Also from upstream since the last merge: - Cx::touch_controls and hover_none read the host's primary pointer (anomalyco#2638). The fork's cfg(android) constants go; the Android LayerHost calls set_touch_controls(true), as the iOS one does. - rune-text's prewarm_system_fonts (anomalyco#2660): Android's backend answers it with nothing to build ahead. - rav1d without assembly (anomalyco#2641): an x86_64 library with avif links without -Wl,-Bsymbolic, so ANDROID.md's note about it goes. Kept over upstream in android.yml: the android/** push trigger and the apk job, which builds the Kotlin host with the example. Checked: clippy for both Android targets (let_underscore_must_use allowed, as rune-core fails it upstream), an x86_64 cdylib with avif links, check-wasm, cargo check, file-size, rune lib tests 4087 passed with the 4 failures upstream dev has on Windows (and one more that passes alone).
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.
Fixes #1410
Summary
HostStatenow tracksPrimaryPointer(HovervsTouch) per window/runtime and exposes it throughCx::touch_controls()andCx::hover_none(). Views (and memos) that read either accessor automatically re-run when the pointer mode changes, while views that do not read them incur zero extra commits (preservingTx::live_only()on touch gestures).crates/rune/src/platform/win32/touch_input.rs):WM_TOUCHandWM_POINTERDOWN/WM_POINTERUPDATE/WM_POINTERUP(GetPointerType:PT_TOUCHvsPT_PEN/PT_MOUSE/PT_TOUCHPAD) in a lightweight Win32 window subclass installed on both windows and overlays, so finger touch activatesCx::touch_controls()while Windows pen/stylus input keeps precision hover mode without breaking pen clicks or drags.0xFF51_5780..=0xFF51_57FF) vs pen-promoted (0xFF51_5700..=0xFF51_577F) legacy mouse messages viaGetMessageExtraInfo()MI_WP_SIGNATUREbit 7, keeping promoted messages suppressed while preventing touch promotion from flipping back to mouse mode.SM_MAXIMUMTOUCHES,SM_DIGITIZERready + touch bits,SM_CONVERTIBLESLATEMODE,SM_MOUSEPRESENT) and watchesWM_SETTINGCHANGE(ConvertibleSlateMode/UserInteractionMode), updating only on initial sample or actual posture transitions so focus changes on hybrid touchscreen laptops keep live touch mode intact.WindowEvent::Touch/Runtime::touch) switches toTouchand mouse/trackpad/wheel/pen input switches back toHoveron all native targets;LayerHoston iOS starts in touch mode;Runtime::touch_controls()andRuntime::set_touch_controls(bool)support headless tests and embedded hosts;wasm32keeps its browser CSS media-query implementation unchanged.Verification
cargo check -p rune --lib(Windows) — passcargo check -p rune --target wasm32-unknown-unknown --lib— pass (0 new warnings)cargo test -p rune --lib -- touch_input::tests controls_tests runtime::input::touch edge_drag platform_events— 76 passed, 0 failed (covering Windows system metrics,MI_WP_SIGNATUREmouse/pen/touch classification,WM_TOUCHvsWM_POINTER*pen/touch routing,WM_SETTINGCHANGEarea matching, tablet posture transitions, memo invalidation, unread zero-commit gating, and existing touch/pinch/edge-drag suites).