Skip to content

Commit

Permalink
remove unneeded allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredemus committed Oct 28, 2023
1 parent 1274b1c commit 475bd5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/win/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ unsafe fn wnd_proc_inner(
if *mouse_was_outside_window {
// this makes Windows track whether the mouse leaves the window.
// When the mouse leaves it results in a `WM_MOUSELEAVE` event.
let track_mouse = Rc::new(TRACKMOUSEEVENT {
let mut track_mouse =TRACKMOUSEEVENT {
cbSize: std::mem::size_of::<TRACKMOUSEEVENT>() as u32,
dwFlags: winapi::um::winuser::TME_LEAVE,
hwndTrack: hwnd,
dwHoverTime: winapi::um::winuser::HOVER_DEFAULT,
});
};
// Couldn't find a good way to track whether the mouse enters,
// but if `WM_MOUSEMOVE` happens, the mouse must have entered.
TrackMouseEvent(Rc::as_ptr(&track_mouse) as winapi::um::winuser::LPTRACKMOUSEEVENT);
TrackMouseEvent(&mut track_mouse);
*mouse_was_outside_window = false;

let enter_event = Event::Mouse(MouseEvent::CursorEntered);
Expand Down

0 comments on commit 475bd5f

Please sign in to comment.