Skip to content

fix: keybinding release propagation (attempt 2) - #1209

Draft
Lubsch wants to merge 1 commit into
mangowm:mainfrom
Lubsch:keybinding-release-propagation
Draft

fix: keybinding release propagation (attempt 2)#1209
Lubsch wants to merge 1 commit into
mangowm:mainfrom
Lubsch:keybinding-release-propagation

Conversation

@Lubsch

@Lubsch Lubsch commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

See also #1206 and #1206 (comment)

With the previous commit, there was a bug causing key repeats to not stop after releasing the button when a keybinding was pressed during key hold.

Steps to replicate:

  • Assume SUPER+j is mapped to something on press
  • hold j -> j is repeated (expected)
  • hold SUPER -> j is still repeated, no binding executed (expected)
  • release j -> j is still repeated (WRONG)
  • release SUPER -> j is still repeated (WRONG)

You then must press j again to end the key repeat

This commit adds a 256 byte bool array intercepted to KeyboardGroup which stores whether a key's press was intercepted and shouldn't be passed to clients.

I don't think this is the most elegant solution but something similar is done by other compositors
like sway: https://github.com/swaywm/sway/blob/6959a78a8f0d52f79ad7465135b3295307a5146a/include/sway/input/keyboard.h#L29
or river: https://codeberg.org/river/river-classic/src/commit/b1af960e1bea8506c25179775c18f902a5cb8c87/river/Keyboard.zig#L41

@Lubsch
Lubsch marked this pull request as draft July 23, 2026 06:18
@Lubsch

Lubsch commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

I've just noticed that this now propagates release event for release keybinds when it shouldn't. I'Lll undraft this when I've properly tested it.

@Lubsch
Lubsch force-pushed the keybinding-release-propagation branch from 2c4dfbb to 6e1c959 Compare July 24, 2026 00:40
Also fixes the opposite case: Don't pass key press event when it's
handled by an on-release keybinding.

This makes the keybinding function always return true (meaning "handled")
on both press and release for mappings even when it didn't actually
execute the function because it's mapped to the opposite event type.
This information is used by the keypress function to decide if it should
propagate the event to the client.

Fixes mangowm#348

This commit adds a 256 byte bool array `intercepted` to `KeyboardGroup`
which stores whether a key was intercepted and shouldn't be passed to
clients.

Something similar is done by other compositors
like sway: https://github.com/swaywm/sway/blob/6959a78a8f0d52f79ad7465135b3295307a5146a/include/sway/input/keyboard.h#L29
or river: https://codeberg.org/river/river-classic/src/commit/b1af960e1bea8506c25179775c18f902a5cb8c87/river/Keyboard.zig#L41
@Lubsch
Lubsch force-pushed the keybinding-release-propagation branch from 6e1c959 to 75a6b3f Compare July 24, 2026 00:52
@DreamMaoMao
DreamMaoMao force-pushed the main branch 3 times, most recently from 0efe75b to 20ad711 Compare August 10, 2026 05:15
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.

1 participant