-
Notifications
You must be signed in to change notification settings - Fork 14
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 ability to detect mouse buttons are swapped #28
Comments
Makes sense to me (pretty similar to the "touchpad direction reversed" capability we've discussed previously). But can you describe the use case?
This seems like an argument for |
Use case is UI polish. You can display text like "Click the left button" (instead of text like "Click the primary button"), or for some web based game you could show the user a picture of a mouse annotated with the actions each one does. If the user has them swapped then the annotation could be correct. |
Thanks, those use cases seem really compelling to me! So are you thinking something like this? partial interface InputDeviceCapabilities {
// When true, the device represents a mouse where the physical location of
// the "right" and "left" buttons are swapped.
boolean mouseButtonsSwapped = false;
}; What about Back/Forward buttons, should they be considered swapped by this as well? Logically I'd expect so, but the SM_SWAPBUTTON documentation doesn't say anything about it. @smaug---- @patrickhlauke @patrickkettner any feedback? |
No objections from me (and now wondering if there's any other input-related GetSystemMetrics things we could consider adding) |
In principal sounds reasonable. But is InputDeviceCapabilities the right place? If the information is used in UI, one should be able to query it without any user input... but then, that would be a privacy issue... |
IMHO if we ever add a "enumerate devices" API, that API should probably be restricted from being used in cross-origin iframes (unless permitted by a feature policy). For top documents I don't see much difference between enumeration or on input event only - the vast majority of pages will get at least one mouse input event (assuming we expose it consistently even on |
Would it make sense to indicate in the InputDeviceCapabilities for mouse that the primary and secondary buttons are swapped?
You can do this via querying GetSystemMetrics(SM_SWAPBUTTON) on Windows.
The only problem I see with using the InputDeviceCapabilities API for this is that you can't query the API dynamically for installed devices; you have to wait for a device to appear.
The text was updated successfully, but these errors were encountered: