Extend core API to enable mouse keymap community modules#26232
Open
schuay wants to merge 2 commits into
Open
Conversation
Track the most recent buttons mask passed to host_mouse_send() and expose it via host_last_mouse_buttons(). Mirrors host_last_system_usage() and host_last_consumer_usage() in shape and motivation. Consumers that synthesize out-of-band mouse activity (Raw HID adapters, pointing-device button handlers) need the current HID-level button state to stamp onto reports they generate from non-button signals (motion, wheel). Without this, a click-and-drag whose press and motion arrive on separate code paths sees buttons=0 on the motion report and the drag drops mid-stream.
Move the bodies of update_source_layers_cache and read_source_layers_cache into update_source_layers_cache_default and read_source_layers_cache_default, and make the original symbols weak wrappers that delegate to the defaults. This lets out-of-tree code (e.g. community modules adding new KEYLOC_* sentinels for additional keypos types) strong-override the wrappers to add their own cache buffers for those sentinels, then delegate the existing matrix and encoder cases back to the *_default sibling. Same shape as get_chordal_hold_default() in action_tapping.c. Pure refactor: no behavior change for code that doesn't override the wrappers.
Author
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.
Description
Two small core additions that enable an out-of-tree community module to bridge host-side mouse activity into the QMK action pipeline.
host_last_mouse_buttons()- shadow getter mirroring host_last_system_usage / host_last_consumer_usage. Tracks the latest buttons mask written byhost_mouse_send(). Consumers that synthesize out-of-band mouse activity need this to stamp the current HID button state onto motion/wheel reports generated from non-button signals - otherwise a click-and-drag whose press and motion arrive on separate code paths sees buttons=0 on motion and the drag drops mid-stream.update/read_source_layers_cache_default- extract the existing bodies intodefaultsiblings and make the originals weak wrappers that delegate. Same shape asget_chordal_hold_default(). Lets modules adding new KEYLOC_* keypos sentinels add cache buffers for those sentinels and delegate the matrix/encoder cases back. Pure refactor; no behavior change for code that does not override.See https://github.com/schuay/qmk_modules/tree/feat/strict-core/native_mouse for the community module that uses these hooks.
Types of Changes
Issues Fixed or Closed by This PR
Checklist