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

Get access to physical key events #688

Closed
Woyten opened this issue Jan 8, 2021 · 3 comments
Closed

Get access to physical key events #688

Woyten opened this issue Jan 8, 2021 · 3 comments
Labels
feature New feature or request shell web

Comments

@Woyten
Copy link

Woyten commented Jan 8, 2021

I would like to turn microwave into an app that runs both on desktop and web environments.

To me it seems that iced is the most promising candidate to achieve this goal. My first experience with it was very pleasant and everything worked out-of-the box.

However, to fully migrate microwave to iced I need to access the physical location / scan code of keyboard events. It seems that this is not possible at the moment.

@dhardy
Copy link

dhardy commented Jan 9, 2021

Are you aware of rust-windowing/winit#1806 ?

Currently I believe it is possible to get scancodes, though these are platform-specific and not really much use aside from matching the same key again (though IIUC they may not be unique on Windows). Physical key location is planned but I'm not sure at the moment exactly how that will look (probably equivalent key on US-ASCII layout, with None for extra media keys).

@hecrj hecrj added the feature New feature or request label Jan 20, 2021
@Woyten
Copy link
Author

Woyten commented May 29, 2021

Thanks for sharing your ideas. Is there an idiomatic way to register an onkeydown event listener on some canvas component which feeds OnKeyDownEvents into the main loop of iced?

@hecrj
Copy link
Member

hecrj commented Jan 20, 2022

@Woyten You can listen to keyboard events in canvas::Program::update and return a Message for the Application when necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request shell web
Projects
None yet
Development

No branches or pull requests

3 participants