Fix window_state pointer
This commit is contained in:
parent
5866bf372e
commit
6bae3e7507
|
@ -82,9 +82,7 @@ unsafe extern "system" fn wnd_proc<H: WindowHandler>(
|
||||||
|
|
||||||
let mut window_state = window_state.borrow_mut();
|
let mut window_state = window_state.borrow_mut();
|
||||||
|
|
||||||
// FIXME: For some reason, the data in window_info is corrupted.
|
let logical_pos = window_state.window_info.physical_to_logical(physical_pos);
|
||||||
// let logical_pos = window_state.window_info.physical_to_logical(physical_pos);
|
|
||||||
let logical_pos = physical_pos;
|
|
||||||
|
|
||||||
window_state.handler.on_event(
|
window_state.handler.on_event(
|
||||||
&mut window,
|
&mut window,
|
||||||
|
@ -242,15 +240,13 @@ impl Window {
|
||||||
|
|
||||||
let handler = H::build(&mut window);
|
let handler = H::build(&mut window);
|
||||||
|
|
||||||
let window_state = Rc::new(RefCell::new(WindowState {
|
let window_state = Box::new(RefCell::new(WindowState {
|
||||||
window_class,
|
window_class,
|
||||||
window_info,
|
window_info,
|
||||||
handler,
|
handler,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let win = Rc::new(RefCell::new(window));
|
SetWindowLongPtrA(hwnd, GWLP_USERDATA, Box::into_raw(window_state) as *const _ as _);
|
||||||
|
|
||||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, Rc::into_raw(win) as *const _ as _);
|
|
||||||
SetTimer(hwnd, 4242, 13, None);
|
SetTimer(hwnd, 4242, 13, None);
|
||||||
|
|
||||||
Ok((WindowHandle { hwnd }, window_info))
|
Ok((WindowHandle { hwnd }, window_info))
|
||||||
|
|
Loading…
Reference in a new issue