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

Fixes #3374 - Curses and Net drivers don't generate click events unless mouse has not moved #3375

Draft
wants to merge 1 commit into
base: v2_develop
Choose a base branch
from

Conversation

tig
Copy link
Collaborator

@tig tig commented Apr 2, 2024

Fixes

Proposed Changes/Todos

  • Add debug spew to further diagnose
  • ???

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tig
Copy link
Collaborator Author

tig commented Apr 2, 2024

@BDisp - I suspect you have more knowledge of this than I. Do you have any suggestions on how to address this?

@BDisp
Copy link
Collaborator

BDisp commented Apr 2, 2024

The clicked event is only generated if the mouse location is the same on the buttonPressed and buttonReleased. This is the normal behavior of the clicked event. If you press the mouse button and move the mouse keeping the button pressed, when you release the button the location isn't the same and thus the clicked event isn't processed.

This allows a user cancel a click event if the button was pressed and then regret do it and move the mouse to another place and release it avoiding a clicked event.

@tig
Copy link
Collaborator Author

tig commented Apr 2, 2024

The clicked event is only generated if the mouse location is the same on the buttonPressed and buttonReleased. This is the normal behavior of the clicked event. If you press the mouse button and move the mouse keeping the button pressed, when you release the button the location isn't the same and thus the clicked event isn't processed.

This allows a user cancel a click event if the button was pressed and then regret do it and move the mouse to another place and release it avoiding a clicked event.

I'm not sure I love the logic you've described. It means that the user has to hold the mouse perfectly still to cause a clicked event.

However, we can debate that another day.

Please try the steps I outlined in #3374 - You'll see that even though the mouse is perfectly still, pressing the button and releasing it does not cause either driver to receive a clicked event.

@BDisp
Copy link
Collaborator

BDisp commented Apr 2, 2024

Please try the steps I outlined in #3374 - You'll see that even though the mouse is perfectly still, pressing the button and releasing it does not cause either driver to receive a clicked event.

The bug is in this line. The point isn't assigned if it isn't null. In that line point must always be equal to pos.

To fix change to:

point = pos;

@BDisp
Copy link
Collaborator

BDisp commented Apr 2, 2024

I'm not sure I love the logic you've described. It means that the user has to hold the mouse perfectly still to cause a clicked event.

However, we can debate that another day.

I hope you consider this because many app use that behavior and prevents many times when accidently press a button and avoiding the clicked after moving the mouse. If a user want to catch all the clicks he can use the ButtonPressed event.

@tig
Copy link
Collaborator Author

tig commented Apr 2, 2024

I'm not sure I love the logic you've described. It means that the user has to hold the mouse perfectly still to cause a clicked event.
However, we can debate that another day.

I hope you consider this because many app use that behavior and prevents many times when accidently press a button and avoiding the clicked after moving the mouse. If a user want to catch all the clicks he can use the ButtonPressed event.

Lets discuss this here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants