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

Inconsistent decoding #4

Open
katietheqt-old opened this issue Dec 29, 2018 · 3 comments
Open

Inconsistent decoding #4

katietheqt-old opened this issue Dec 29, 2018 · 3 comments

Comments

@katietheqt-old
Copy link

Your crate decodes some keys into DecodedKey::RawKey objects. The enum that you provide containing keys has a Backspace variant, but, using QEmu as my example, a backspace is decoded into unicode U+0008, and as a DecodedKey::Unicode.

@thejpster
Copy link
Member

That's because I understood 0x08 to be the ASCII value for Backspace, like 0x09 is the ASCII value for Tab. I only used DecodedKey::RawKey when there wasn't a clear mapping to an ASCII (or Unicode) value (e.g. there's no ASCII or even Unicode value corresponding to the Windows key). If you'd rather have raw key events (i.e. the KeyCode enum you mention that includes KeyCode::Backspace, plus an indication of whether the key was pressed or released), you can avoid calling process_keyevent and handle the key events yourself.

@katietheqt-old
Copy link
Author

Then can we remove the Backspace variant of the enum, as it is not used, and only use ASCII Backspace

@thejpster
Copy link
Member

It is used if you take KeyEvents and don't decode them.

I can see your point though. I could create a new enum called UndecodableKeys or something. It would include Home, PageUp, etc, but not A, +, or Backspace. You can then match exhaustively without overlaps.

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

No branches or pull requests

2 participants