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

desktop.MouseHover Button state is not reliable #1533

Closed
MagicalTux opened this issue Nov 14, 2020 · 4 comments
Closed

desktop.MouseHover Button state is not reliable #1533

MagicalTux opened this issue Nov 14, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@MagicalTux
Copy link
Contributor

MagicalTux commented Nov 14, 2020

Describe the bug:

When using desktop.MouseHover to capture MouseMoved(MouseEvent) events in a widget, the button status may not work if both buttons are pressed at the same time.

To Reproduce:

Steps to reproduce the behaviour:

  1. Move mouse, Button=0
  2. Press left mouse button, Button=1
  3. Press right mouse button too, Button=2 (expecting 3)
  4. Release any one of the two mouse buttons, Button=0
  5. Moving the mouse shows Button=0 despite one of the mouse buttons being still pressed
  6. Release last button, a MouseUp event will be generated as expected (with the right value for Button)

Right now mouse buttons are handled as values (iota+1), I believe these should be handled as flags (1<<iota) in order to keep track of multiple buttons used at the same time.

Multiple buttons used at the same time might not be typical in desktop environment, but could happen in games (left button to move forward, right button to fire kind of things for example).

Extra: I'm not sure if it's expected or not, but enabling drag events (Dragged/DragEnd) causes MouseMoved events to not be fired while Button is not zero.

Device (please complete the following information):

  • OS: Linux
  • Go version: 1.15.3
  • Fyne version: 1.4.0
@andydotxyz andydotxyz added the bug Something isn't working label Nov 14, 2020
@andydotxyz
Copy link
Member

andydotxyz commented Nov 14, 2020

Thanks for the report, I think I can see what's wrong.

However for:

Extra: I'm not sure if it's expected or not, but enabling drag events (Dragged/DragEnd) causes MouseMoved events to not be fired while Button is not zero.

I'm not sure I can see it. Can you share some code to replicate?

andydotxyz added a commit to andydotxyz/fyne that referenced this issue Nov 14, 2020
Also remove old comment - that was supposed to reserve the iota, but
it got broken some time ago
Fixes fyne-io#1533
@andydotxyz
Copy link
Member

Please let me know if #1534 fixes the issue for you @MagicalTux

@MagicalTux
Copy link
Contributor Author

Hi, just tested and that works nicely, thanks!!

@andydotxyz
Copy link
Member

Cool, resolved for the pending 1.4.1 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants