Closed Fredemus closed 6 months ago
I first tried to do it like that, but WM_MOUSEHOVER
ends up firing every time the mouse moves inside the window. This way it only happens the first time the mouse enters the window, which lines up with how it works on x11.
edit: also looks like winit does it the same way as I: https://github.com/rust-windowing/winit/blob/ee0db52ac49d64b46c500ef31d7f5f5107ce871a/src/platform_impl/windows/event_loop.rs#L1443
In that case you'd be able to just only set TME_HOVER
when initially creating the window and when handling WM_MOUSELEAVE
, and only set TME_LEAVE
when handling WM_MOUSEENTER
, no? If that works that sounds like a better solution than approximating it by tracking mouse moves.
WM_MOUSEENTER
For some reason there is no WM_MOUSEENTER
, only WM_MOUSEHOVER
Sorry yeah I meant WM_MOUSEHOVER
.
Ah okay. For reasons I don't really understand just sending TrackMouseEvent
with TME_HOVER
in WM_MOUSELEAVE
means the event never fires, no matter if I set either TME_HOVER
or TME_LEAVE
initially, or both. I also tried to change dwHoverTime
in case the system default was weird. It seemingly has to happen in WM_MOUSEMOVE
.
I digged up the documentation I based this on.
Necessary to fix https://github.com/vizia/vizia/issues/407, which is a bug that locks up the GUI when you press down on a mouse button inside the window and release the button outside the window.