Skip to content
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

Fixed bug in do_code16 #968

Merged
merged 1 commit into from
Dec 28, 2016
Merged

Conversation

ofples
Copy link
Contributor

@ofples ofples commented Dec 23, 2016

The do_code16 function would falsely send both right and left modifiers for a given keycode because of the way the keycode is checked against the modifiers (bitwise and).
See #865 for an example where this matters.

@fredizzimo
Copy link
Contributor

Yes, this seems like a valid fix to me. But only because the current design doesn't allow programmatically sending a left hand modifier and right hand modifier at the same time in other cases either, as I reported in #524 for example.

The best fix would be to add one more bit to the modifiers and change the do_code16 to handle all three cases. But that would probably require a lot of other fixes too, so that's definitely not needed to fix this bug. There would easily be room for that in the quantum_keycodes enum, by for example allowing "only" 2047 functions and macros instead of 4095.

So the relevant part of quantum_keycodes would look like this.

QK_MODS               = 0x0100,
QK_LCTL               = 0x0100,
QK_LSFT               = 0x0200,
QK_LALT               = 0x0400,
QK_LGUI               = 0x0800,
QK_RCTL               = 0x1100,
QK_RSFT               = 0x1200,
QK_RALT               = 0x1400,
QK_RGUI               = 0x2800,
QK_RCTL               = 0x2100,
QK_RSFT               = 0x2200,
QK_RALT               = 0x2400,
QK_RGUI               = 0x2800,
QK_MODS_MAX           = 0x2FFF,
QK_FUNCTION           = 0x3000,
QK_FUNCTION_MAX       = 0x37FF,
QK_MACRO              = 0x3800,
QK_MACRO_MAX          = 0x3FFF,

@ofples
Copy link
Contributor Author

ofples commented Dec 28, 2016

I agree that this would be the more thorough approach.
I'd have to check what other side effects the change would have.
I consider this pull request more of a temporary fix, so that tap dance would work properly.

@jackhumbert
Copy link
Member

Cool - I'll go ahead and merge this then. Thanks!

@jackhumbert jackhumbert merged commit 223cffd into qmk:master Dec 28, 2016
@ofples ofples deleted the bugfix/right-modifiers branch November 3, 2017 09:01
mattpcaswell pushed a commit to mattpcaswell/qmk_firmware that referenced this pull request Jun 7, 2023
* Add a degraded status to reflect API

* move keypress code into it's own file under app

* extract exclusion list data

* Remove keymap parsing code from jquery.js

* remove jquery.js

 - move API code to api.js
   - some technical debt here because UI code is still in here
 - move util code to util.js

* Fixup broken merge

* Add missing this

* Missing error patch

* Switch to async await

 - promises are so 2020

* Upgrade to node 14

* Force fixes onto npm packages

* outdated Updates to deps

* More package updates

* Upgrade eslint and prettier

 - resulting formatting changes
 - change trailingComma default to avoid changing a lot of files in same
   commmit

* linting

* Use AJV to validate JSON files

 <3 zekth for idea

* remove unused packages

* Suggested changes by zekth

* Add some comments

* remove old json check

* Fix up action files

* Prettier warnings

 - change in base rules

* Revert Async Await for now

 - makes debugging really difficult because of all the wrapping

* Trivial use of async
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants