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

ModifiersChanged message does not indicate keyboard device_id #1514

Closed
maaku opened this issue Mar 21, 2020 · 1 comment
Closed

ModifiersChanged message does not indicate keyboard device_id #1514

maaku opened this issue Mar 21, 2020 · 1 comment
Labels
C - needs discussion Direction must be ironed out F - question There's no such thing as a stupid one S - api Design and usability

Comments

@maaku
Copy link

maaku commented Mar 21, 2020

The modifiers field in winit::event::KeyboardInput is marked as depreciated, and a note in the documentation says that applications should instead handle the ModifiersChanged message (and presumably track the resulting value themselves). However the KeyboardInput event has a device_id field while the ModifiersChanged message does not. Strictly speaking, this is therefore a decrease in functionality.

To illustrate, consider a system that has two keyboards attached--which is not so crazy as it sounds when you consider bluetooth keyboards, or special purpose devices. If a modifier key is pressed on one device, conceivably that could be isolated from the other in the prior model. However with the ModifiersChanged message pressing any modifier key on any device affects the key input of all other devices.

Although this is certainly and edge case, it appears to me to be a bug. Perhaps the ModifiersChanged event type should be augmented to include a device_id?

@ryanisaacg ryanisaacg added C - needs discussion Direction must be ironed out S - api Design and usability F - question There's no such thing as a stupid one labels Apr 6, 2020
@Osspial
Copy link
Contributor

Osspial commented Apr 20, 2020

device_id in WindowEvent has only ever been implemented on Linux, and from what I can tell it's pretty much impossible to expose on all the other OSes. All the non-Linux backends just pass in a dummy value for that field. As it stands, if you need to distinguish between devices when handling input you should listen for DeviceEvents instead of WindowEvent.

In light of that we've been moving towards removing DeviceId from WindowEvent completely (see #1374), but that PR needs more design work before it can move forward.

@Osspial Osspial closed this as completed Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - needs discussion Direction must be ironed out F - question There's no such thing as a stupid one S - api Design and usability
Development

No branches or pull requests

3 participants