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

Implemented TrayIcon mouse right button event (#17383) #17406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

loyvsc
Copy link
Contributor

@loyvsc loyvsc commented Nov 1, 2024

What does the pull request do?

Implements TrayIcon mouse click events (MouseLeftButtonClick, MouseRightButtonClick).

What is the current behavior?

TrayIcon don't have right mouse click event.

What is the updated/expected behavior with this PR?

Now TrayIcon have MouseLeftButtonClick & MouseRightButtonClick events.

Breaking changes

The MouseEventArgs class has been created (stores information about the cursor position when the button is pressed, as well as the button pressed), and the ITrayIconImpl interface has been updated.

Fixed issues

Fixes #17383

@thevortexcloud
Copy link
Contributor

thevortexcloud commented Nov 2, 2024

Avalonia generally avoids the concept of a "mouse" and instead prefers "pointer" since Avalonia supports many things that are not a Mouse. Even on desktop platforms touch screens are fairly popular these days.

@MrJul
Copy link
Member

MrJul commented Nov 3, 2024

Avalonia generally avoids the concept of a "mouse" and instead prefers "pointer" since Avalonia supports many things that are not a Mouse. Even on desktop platforms touch screens are fairly popular these days.

Indeed, this should probably reuse PointerEventArgs.

That said, even with the proper arguments, I fail to really see what this PR really gives us in its current state:

  • You didn't add any events to the public TrayIcon, only to the implementations, so there's nothing new usable exposed to the user. (The Impl members shouldn't be used outside of Avalonia, they're marked as Unstable.)
  • It really only works for Win32.

The current TrayIcon tries to target the features available in most platforms. We can discuss whether to extend it or not, but APIs that only work on a single platform should probably be kept specific to that platform. Otherwise, that's just an non-fixable bug report waiting to happen.

@loyvsc
Copy link
Contributor Author

loyvsc commented Nov 3, 2024

We can discuss whether to extend it or not, but APIs that only work on a single platform should probably be kept specific to that platform

I think this functionality should be implemented, as it may be useful in some situations. I agree that it was a mistake to implement on only one platform - I'll fix it in a couple of days.

You didn't add any events to the public TrayIcon, only to the implementations, so there's nothing new usable exposed to the user. (The Impl members shouldn't be used outside of Avalonia, they're marked as Unstable.)

I accidentally didn't commit edits in the control:)

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

Successfully merging this pull request may close these issues.

Add RightClick event to TrayIcon
3 participants