Skip to content

Conversation

@Ph4ntomas
Copy link
Contributor

This PR address a few issue I have with the current Layer::on_key_pressed

I've cherry-picked some commits from #369 (the one to emit the text in events).

To avoid breaking current config, Layer::on_key_pressed was mostly kept as-is, except I'm explicitly discarding events if they were captured, since they used to be discarded on the server side. I don't know if the function should be marked as deprecated, or kept as a short-hand if only key press are needed.

I did not add Layer::on_key_release, since:

  • This is already covered by the new Layer::on_key_event() function.
  • There's no way to have several handlers, and I don't feel like only handling key release events make sense.

closes #374

@Ph4ntomas Ph4ntomas force-pushed the snowcap-on_key_event branch 3 times, most recently from 1d9f273 to ad0c3dc Compare November 4, 2025 07:52
@Ph4ntomas Ph4ntomas force-pushed the snowcap-on_key_event branch 3 times, most recently from 89f398b to 40d902a Compare December 12, 2025 10:50
@Ph4ntomas Ph4ntomas force-pushed the snowcap-on_key_event branch from 40d902a to db3bb93 Compare December 19, 2025 16:36
@Ph4ntomas Ph4ntomas force-pushed the snowcap-on_key_event branch from db3bb93 to 927de0c Compare January 5, 2026 09:28
@Ph4ntomas Ph4ntomas force-pushed the snowcap-on_key_event branch from 927de0c to 31088e5 Compare January 13, 2026 20:52
Copy link
Collaborator

@Ottatop Ottatop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if the function should be marked as deprecated, or kept as a short-hand if only key press are needed.

Let's keep it as shorthand for now. Outside of the comments, lgtm.

@Ph4ntomas Ph4ntomas force-pushed the snowcap-on_key_event branch from 31088e5 to f15b1f8 Compare January 16, 2026 07:01
The on_key_pressed handler can be limiting since:
- it doesn't allow to react to key being released
- it doesn't transmit the processed `text` associated with keys when
  using a layout with dead keys.
- it doesn't transmit captured events (I've added this one to conserve
  the previous behavior.)

This commit address this by adding a on_key_event that transmit the key
state, whether it was captured on the server side, and the associated
text if available.
The on_key_pressed handler can be limiting since:
- it doesn't allow to react to key being released
- it doesn't transmit the processed `text` associated with keys when
  using a layout with dead keys.
- it doesn't transmit captured events (I've added this one to conserve
  the previous behavior.)

This commit address this by adding a on_key_event that transmit the key
state, whether it was captured on the server side, and the associated
text if available.
@Ph4ntomas Ph4ntomas force-pushed the snowcap-on_key_event branch from f15b1f8 to 7b25a72 Compare January 16, 2026 21:03
@Ph4ntomas Ph4ntomas requested a review from Ottatop January 16, 2026 21:10
Copy link
Collaborator

@Ottatop Ottatop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Ottatop Ottatop merged commit ef1b2d6 into pinnacle-comp:main Jan 16, 2026
11 checks passed
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.

[Snowcap] Let captured input go through

2 participants