Skip to content

Commit

Permalink
Provide distinct event number for types defined by reference
Browse files Browse the repository at this point in the history
Prior to this commit, message types defined by reference were exposed
to Rust as type aliases, such as `type KeyReleaseEvent =
KeyPressEvent;`.  As a result, they shared a single implementation of
`BaseEvent`, erroneously sharing the same `BaseEvent::NUMBER`.

This commit updates the code generation to instead expose these types
as a wrapper struct, such as `struct KeyReleaseEvent(KeyPressEvent);`.
These wrapper structs expose the same methods, but have an independent
implementation of `BaseEvent`.  This allows these events to be
constructed, such as for use in `SendEvent`.

Fixes #214
  • Loading branch information
Lunderberg committed Nov 29, 2024
1 parent eaddeda commit 1ddeeb1
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 128 deletions.
Loading

0 comments on commit 1ddeeb1

Please sign in to comment.