1
0
Fork 0

remove unneeded allocation

This commit is contained in:
Fredemus 2023-10-28 17:35:26 +02:00
parent 1274b1c08f
commit 475bd5f88a

View file

@ -182,15 +182,15 @@ unsafe fn wnd_proc_inner(
if *mouse_was_outside_window { if *mouse_was_outside_window {
// this makes Windows track whether the mouse leaves the window. // this makes Windows track whether the mouse leaves the window.
// When the mouse leaves it results in a `WM_MOUSELEAVE` event. // 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, cbSize: std::mem::size_of::<TRACKMOUSEEVENT>() as u32,
dwFlags: winapi::um::winuser::TME_LEAVE, dwFlags: winapi::um::winuser::TME_LEAVE,
hwndTrack: hwnd, hwndTrack: hwnd,
dwHoverTime: winapi::um::winuser::HOVER_DEFAULT, dwHoverTime: winapi::um::winuser::HOVER_DEFAULT,
}); };
// Couldn't find a good way to track whether the mouse enters, // Couldn't find a good way to track whether the mouse enters,
// but if `WM_MOUSEMOVE` happens, the mouse must have entered. // 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; *mouse_was_outside_window = false;
let enter_event = Event::Mouse(MouseEvent::CursorEntered); let enter_event = Event::Mouse(MouseEvent::CursorEntered);