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

Code cleanup for held mouse buttons #1546

Merged
merged 1 commit into from
Aug 17, 2024
Merged

Code cleanup for held mouse buttons #1546

merged 1 commit into from
Aug 17, 2024

Conversation

AndreasArvidsson
Copy link
Collaborator

No description provided.


# Start drag
ctrl.mouse_click(button=button, down=True)

def mouse_drag_end():
"""Releases any held mouse buttons"""
buttons_held_down = list(ctrl.mouse_buttons_down())
for button in buttons_held_down:
for button in ctrl.mouse_buttons_down():
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctrl.mouse_buttons_down() returns set[int]. No need to wrap in a list.

@@ -151,11 +150,7 @@ def mouse_sleep():

show_cursor_helper(True)
stop_scroll()

# todo: fixme temporary fix for drag command
button_down = len(list(ctrl.mouse_buttons_down())) > 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically a recreation of the logic in mouse_drag_end, but worse.

@@ -132,15 +132,14 @@ def mouse_wake():
def mouse_drag(button: int):
"""Press and hold/release a specific mouse button for dragging"""
# Clear any existing drags
self.mouse_drag_end()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised this even worked. We should definitely call Talon actions through the action interface.

@AndreasArvidsson AndreasArvidsson changed the title Code cleanup about held mouse buttons Code cleanup for held mouse buttons Aug 15, 2024
@nriley nriley merged commit cb154d2 into main Aug 17, 2024
2 checks passed
@nriley nriley deleted the mouseButtonsHeldCleanup branch August 17, 2024 16:47
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.

2 participants