framework: honor process_record_user() return value - #55
Conversation
process_record_kb() called process_record_user() but discarded its result, so a keymap returning false could not stop a key from being processed. Every framework input module shares this function, and six shipped keymaps already return false to consume FN_LOCK (ansi/iso/jis/copilot defaults, ansi/advanced, iso/copilot) — so keymap-level suppression silently does nothing today. Return early when the keymap reports it has handled the key, matching the standard QMK idiom. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
One trade-off worth raising myself, since it's a judgement call rather than a clear-cut fix. Returning early is the conventional QMK shape, but it means that when a keymap does suppress a key, the remainder of
In practice that housekeeping runs on every non-suppressed keypress, so state corrects itself on the very next key, and today only bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
bool handled = process_record_user(keycode, record);
/* ... existing OS detection, NKRO, BIOS hotkeys ... */
return handled ? true : false; /* combined with the existing return paths */
}That variant is a slightly larger diff because the function has several intermediate Happy to switch to whichever you prefer, or to drop the change entirely if the current behavior is intentional and I've misread it. |
process_record_kb()inkeyboards/framework/framework.ccallsprocess_record_user()but discards its return value:so a keymap returning
falsecannot stop a key from being processed. The usual QMK idiom is to return early when the keymap reports it has handled the key.Impact
framework.cis shared by every input module (ansi, iso, jis, copilot, numpad, macropad), so this affects all of them. Six shipped keymaps already rely on the return value to consumeFN_LOCK:ansi/keymaps/default,ansi/keymaps/advancediso/keymaps/default,iso/keymaps/copilotjis/keymaps/defaultcopilot/keymaps/defaultTo be precise about severity: for
FN_LOCKspecifically the practical effect may be benign, since it is a custom keycode that nothing downstream emits. The general case is not — a keymap that suppresses a standard keycode gets no suppression at all, silently.How I hit it
I added a raw-HID key-event stream to a
framework/macropadkeymap, where the firmware reports(row, col, pressed)to a host daemon and must send no keycode for that press. Returningfalsefromprocess_record_userhad no effect, which is what led me here.Testing
Built
framework/macropad:defaultand flashed it on a Framework Laptop 16 RGB Macropad. With the fix, returningfalsefromprocess_record_usercorrectly suppresses the keycode; returningtruebehaves exactly as before. FN Lock behavior on the ANSI keymap is unchanged.Base branch
Based on
fl16-2026-f9as the most recently updated branch carrying this code. The same line is present onfl16-2025andfl16-2026-remap-keys— happy to retarget or open additional PRs if you would prefer it land elsewhere.🤖 Generated with Claude Code