Widgets stay hovered when mouse leaves
When I use the :hover property in css for a system tray icon, it still stays hovered when the mouse leaves if I enter the menu, then close it without clicking the icon, as demonstrated in this video:
https://github.com/Aylur/ags/assets/67327023/27108bc6-0f84-456c-9550-914597d85642
The video did not upload properly. Here is the same video:
https://github.com/Aylur/ags/assets/67327023/01820df4-dc26-46b5-a186-11d8c42116de
Same here. This bug happens for me only when I assign opening menu to primary click, just like you did; If a menu is opened with secondary click, it works correctly. So as a temporary workaround you can do the same.
In my experience, onHoverLost seems to work when the mouse hover is lost over the containing window. If the mouse hover is lost outside of the containing window, the onHoverLost is not executed.
The culprit seems to be ags's Widget.isHovered. Bug affects Widget.EventBox and Widget.Button.
Workaround:
const child = Widget.Label({label: "or any other Widget"});
const eventBox = new Widget.EventBox({
child,
onHover: event => {
// this works :)
},
onHoverLost: event => {
// this doesn't work :(
},
});
eventBox.connect('leave-notify-event', (_, event) => {
// this works :)
});
return eventBox;