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
fix(behaviors): Fixing erroneous combo triggering #1401
Conversation
This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. The corresponding test (which fails without this change) has also been added.
I merged in this fix into the keymap where I originally encountered the problem. This seems to be the fix. I have not been able to reproduce the original problem since, and things seem to be working as expected otherwise as well. I'll continue to test tomorrow. |
This workaround may fix combos, but I suspect you might have caught the core issue also causing #986 In particular, this happens:
So capturing the current event, then possibly rasing it, before it's actually been noted as captured by the return. Perhaps this needs to be fixed to not capture at all based on the decision. @okke-formsma any thoughts? |
Let's have a look at what's going on. The position state changed event is potentially handled multiple times by the hold-tap handler, because that's often needed if there are multiple hold-taps that are being decided by the same event (e.g., a key release which causes multiple hold-taps to decide).
if we would not capture the position state changed event and raise it again at behavior_hold_tap, we might not release all hold-taps correctly. Example, multiple tap-preferred hold-taps:
At this point, we have three position events in the queue, and an undecided hold tap. Then, by the
Now the TL;DR: we need to queue and release the position events, otherwise we do not properly handle nested hold-taps. |
There is one more thing! By re-raising the event, it may actually be fully handled! But the event handler code doesn't know!
the event->last_listener_index is set to hold_tap, and that will cause it to be improperly re-released when the combo releases it! Instead, the event->last_listener_index should be set before the handler is called! |
would this be the right fix instead?
The flow is as follows:
|
Making the change in the event handler seems like a sensible solution in general to me, it certainly provides a more consistent value of |
An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401
Squashed commit of the following: commit b6f987f Author: okke <okke@formsma.nl> Date: Tue Jul 26 21:51:02 2022 +0200 Behaviors: Update last_listener_index before running event handler An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401 commit 0086ff9 Author: Andrew Rae <ajrae.nv@gmail.com> Date: Mon Jul 25 11:02:57 2022 -0700 fix(behaviors): Fixing erroneous combo triggering (zmkfirmware#1395) This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. The corresponding test (which fails without this change) has also been added.
An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401
An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401
An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401
An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401
An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401
Squashes the following commits commit d1006ca Author: Peter Johanson <peter@peterjohanson.com> Date: Sun Jul 31 03:44:57 2022 +0000 fix(behaviors): Properly clean up timed out hold. * If our handler dedides our undedided hold-tap, return early before continuing. commit 0b4198d Author: okke <okke@formsma.nl> Date: Tue Jul 26 21:51:02 2022 +0200 Behaviors: Update last_listener_index before running event handler An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401 commit 8e9db11 Author: Andrew Rae <ajrae.nv@gmail.com> Date: Mon Jul 25 11:02:57 2022 -0700 fix(behaviors): Fixing erroneous combo triggering (zmkfirmware#1395) This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. The corresponding test (which fails without this change) has also been added.
Squashes the following commits commit d1006ca Author: Peter Johanson <peter@peterjohanson.com> Date: Sun Jul 31 03:44:57 2022 +0000 fix(behaviors): Properly clean up timed out hold. * If our handler dedides our undedided hold-tap, return early before continuing. commit 0b4198d Author: okke <okke@formsma.nl> Date: Tue Jul 26 21:51:02 2022 +0200 Behaviors: Update last_listener_index before running event handler An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401 commit 8e9db11 Author: Andrew Rae <ajrae.nv@gmail.com> Date: Mon Jul 25 11:02:57 2022 -0700 fix(behaviors): Fixing erroneous combo triggering (zmkfirmware#1395) This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. The corresponding test (which fails without this change) has also been added.
Squashes the following commits commit d1006ca Author: Peter Johanson <peter@peterjohanson.com> Date: Sun Jul 31 03:44:57 2022 +0000 fix(behaviors): Properly clean up timed out hold. * If our handler dedides our undedided hold-tap, return early before continuing. commit 0b4198d Author: okke <okke@formsma.nl> Date: Tue Jul 26 21:51:02 2022 +0200 Behaviors: Update last_listener_index before running event handler An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. Also see discussion at zmkfirmware#1401 commit 8e9db11 Author: Andrew Rae <ajrae.nv@gmail.com> Date: Mon Jul 25 11:02:57 2022 -0700 fix(behaviors): Fixing erroneous combo triggering (zmkfirmware#1395) This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. The corresponding test (which fails without this change) has also been added.
Closing because #1411 encapsulates this fix |
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at #1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
* This is a very simple fix to a rather complicated issue. Essentially, hold-taps will "release" (raise) their captured keys before actually telling the event manager they have captured a key. This means the event manager ends up assigning the `last_listener_index` to the hold-tap subscription rather than the combo. So when the combo calls `ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the combo as the combo code expects. * The corresponding test (which fails without this change) has also been added. * An event can be captured and released in the same event handler, before the last_listener_index would have been updated. This causes some handlers to be triggered multiple times. * The solution is to update the last_listener_index before calling the next event handler, so capturing and releasing within an event handler is harmless. * Also see discussion at zmkfirmware#1401 * If our handler dedides our undedided hold-tap, return early before continuing. * Fix incorrect pointer logic, resulting in combo candidate filtering leaving incorrect timeout details. Co-authored-by: Andrew Rae <ajrae.nv@gmail.com> Co-authored-by: okke <okke@formsma.nl>
This is a very simple fix to a rather complicated issue. Essentially,
hold-taps will "release" (raise) their captured keys before actually
telling the event manager they have captured a key. This means the event manager ends up assigning the
last_listener_index
to the hold-tap subscription rather than the combo. So when the combo callsZMK_EVENT_RELEASE
it raises after the hold-tap instead of after thecombo as the combo code expects.
The corresponding test (which fails without this change) has also been added.