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

Handle mouse clicks for systray items #1059

Merged
merged 4 commits into from
Mar 31, 2024
Merged

Conversation

moetayuko
Copy link
Contributor

Description

Relocated from ralismark#6

This implements mouse button click handling for systray icons. Meanwhile, the building widgets MenuBar/MenuItem are replaced with Box/EventBox to fulfill the event hooking.

Additional Notes

gtk::Window is subclassed just to store its global coordinates, which appears to be a bit overkill, but I didn't come up with better ideas. This could be further polished.

Checklist

Please make sure you can check all the boxes that apply to this PR.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes.
  • I used cargo fmt to automatically format all code before committing

The major benefit of MenuItem is automatic handling of context menus.
However, MenuItem cannot properly process right mouse click, making it
less useful. Hence, this patch replaces it (as long as the container)
with a simple EventBox and process button clicks on our own.
@elkowar elkowar merged commit 149727c into elkowar:master Mar 31, 2024
1 check passed
@elkowar
Copy link
Owner

elkowar commented Mar 31, 2024

Looks great, thanks a lot!

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