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

Add Scancode and Character handling #104

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

Kylogias
Copy link
Contributor

Adds the HandleScancode and HandleChar functions, for CNFGHandleInput to call for scancodes and characters respectively. They are used in the same way as the other input handling functions, meaning they must be provided for the project to compile. That is, if you are using the Windows and X11 drivers as those are the only drivers where this functionality is currently implemented. The argument for HandleChar is a UTF-8 character. The scancodes should be the same between systems assuming they use the same keyboard drivers (this also means Linux and Windows don't share scancodes)

Adjusted the examples so they will still compile after this change

@Kylogias Kylogias force-pushed the scancode-support branch 2 times, most recently from 8a068a9 to 745bad1 Compare April 15, 2024 23:33
@cnlohr
Copy link
Member

cnlohr commented Apr 22, 2024

We really can't go this route - it's too painful for users to have to implement another function anywhere this is used. It was a HUGE pain when we added destroy.

What we can do though is make it so from the key press function, we could call the get scan code / get whatever code. Where that information could be stored in a variable.

Instead of making rawdraw -> client calls, can you make client -> rawdraw calls? That doesn't have the same restrictions.

@Kylogias
Copy link
Contributor Author

Changed the scancode and character output from calling a handling function to checking a global variable inside the handling function, which is (so far) guaranteed to have the correct value for both characters and scancodes. They are set to 0 if there is no character/scancode or if the platform doesn't support it.

@Kylogias Kylogias force-pushed the scancode-support branch 2 times, most recently from 53df033 to b53be3b Compare April 22, 2024 23:31
@cnlohr
Copy link
Member

cnlohr commented Apr 29, 2024

I think this is all good from my end, let's get at least one other person to sign off on this.

@cnlohr cnlohr merged commit c78f8b9 into cntools:master Apr 30, 2024
1 check 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.

3 participants