-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 keyboard modifiers to mouse events #2733
base: master
Are you sure you want to change the base?
Conversation
)), | ||
Event::Mouse(mouse::Event::ButtonPressed { | ||
button: mouse::Button::Left, | ||
modifiers: Modifiers::empty(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure hard-coding the modifiers to be empty here is correct, open to suggestions if it isn't :)
35cf791
to
99b2b35
Compare
Another idea I've had recently is to pass the mouse position in the |
Sounds to me like that's for a separate PR. I see the appeal and I think the library should default to providing as much information as possible with the messages that are produced, unless there is a meaningful cost associated with it. For example, The counter argument is that creating your own widget isn't that hard and you could always make a button which includes this information in a third-party crate or directly in your app... |
This is exactly why I haven't done this yet, however it shouldn't be much work. I'll probably just implement it in the coming days, then Héctor can merge or close it depending on whether he finds it to be a good fit. |
This PR makes the current state of keyboard modifiers available in mouse click and scroll events.
Before, implementing mouse+modifier shortcuts meant the need to save the state of the modifier keys in your app or widget state, and then track changes to the current modifier keys via
Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers))
, which is cumbersome.https://discourse.iced.rs/t/should-mouse-events-expose-the-state-of-the-modifier-keys/577
#1868
#1914