ags icon indicating copy to clipboard operation
ags copied to clipboard

Widgets stay hovered when mouse leaves

Open LilleAila opened this issue 1 year ago • 4 comments

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

This and this is the code for the system tray.

LilleAila avatar Mar 30 '24 14:03 LilleAila

The video did not upload properly. Here is the same video:

https://github.com/Aylur/ags/assets/67327023/01820df4-dc26-46b5-a186-11d8c42116de

LilleAila avatar Mar 30 '24 15:03 LilleAila

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.

coolstrong avatar Apr 11 '24 10:04 coolstrong

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.

sl33nyc avatar Apr 19 '24 15:04 sl33nyc

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;

sl33nyc avatar Apr 28 '24 15:04 sl33nyc