-
-
Notifications
You must be signed in to change notification settings - Fork 37.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Per-key tapping term API simplification #16472
Comments
i've actually seen a number of people implement the record part, mostly for the row/column information. Which is actually why I added it in the first place. However, i've mostly see it outside of the main repo. |
Ah, in that case it should not be dropped. Do note that in some places (at least tap-dance), an empty record is provided since no real record is (easily) available. Are there other ways to provide row/column information that may be better suited than a record? This does leave the second point: would it make sense to drop |
yeah, I would rather it's not dropped. That said, on develop, tzarc has made it much easier to create empty records, so there is that. But it may be possible to record the keyrecord to be passed on, but my concern is bloat. As for dropping the "per key" option and make it default, my concern there is also bloat, as a majority of the boards are AVR, and a lot of them are already close to the limit for firmware size. |
Wouldn't the last concern also be solved with a single access point (called #ifdef TAPPING_TERM_PER_KEY
get_tapping_term(…)
#else
TAPPING_TERM
#endif |
Actually |
The linked MR realizes a best of both worlds scenario through a new |
The macro gives the right tapping term depending on whether per-key tapping terms and/or dynamic tapping terms are enabled. Unnecessary function calls and variable resolution are avoided. Fixes qmk#16472.
* Add GET_TAPPING_TERM macro to reduce duplicate code The macro gives the right tapping term depending on whether per-key tapping terms and/or dynamic tapping terms are enabled. Unnecessary function calls and variable resolution are avoided. Fixes #16472. * Use GET_TAPPING_TERM for Cirque trackpads Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
Closed via #16681. |
* Add GET_TAPPING_TERM macro to reduce duplicate code The macro gives the right tapping term depending on whether per-key tapping terms and/or dynamic tapping terms are enabled. Unnecessary function calls and variable resolution are avoided. Fixes qmk#16472. * Use GET_TAPPING_TERM for Cirque trackpads Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
Working on #16394, I noted two things about per-key tapping terms:
get_tapping_term
does not see much use yet and none of the usage depends on the second argument (ofkeyrecord_t
type).TAPPING_TERM_PER_KEY
has little effect on firmware size/speed and makesqmk
code more convoluted.It is possible that these observations generalize to more than just per-key tapping terms. Likely, they apply also to per key
Feature Request Type
Description
I suggest removing the second argument of the
get_…
functions, leading to an API with only one argument: the keycode. Additionally, while the documentation states that there is no need for separate functions at quantum/keyboard/user level, having a quantum level wrapper would make it easier to ignore any user implementations of these functions. Currently, we cannot simply put#define get_tapping_term(keycode) (TAPPING_TERM)
in any of our code paths without forcing the user to place guards around theirget_tapping_term
implementations.I also suggest to reconsider whether we need the
TAPPING_TERM_PER_KEY
guard at all. Disabling the aforementioned per-key features yield little to no benefit to the built firmware. If there are conceptual reasons to have these flags, it would be nice if they could be dealt with at a lower level, so that the call sites can just use, say,get_tapping_term_quantum(…)
without having to resort to#ifdef
blocks. Essentially, this is the same point as mentioned in the previous paragraph.Outlook
If there is a desire to improve on either or both these points, I can prepare a merge request. Rather than doing so right away, I wanted to hear what more experienced QMK developers think of this.
The text was updated successfully, but these errors were encountered: