Char input support on Windows

This commit is contained in:
Daniel Collin 2016-07-08 14:27:25 +02:00
parent 1ca62fa111
commit 2a8d09fb28

View file

@ -145,6 +145,11 @@ fn update_key_state(window: &mut Window, wparam: u32, state: bool) {
}
}
fn char_down(window: &mut Window, code_point: u32) {
if let Some(ref mut callback) = window.key_handler.key_callback {
callback.add_char(code_point);
}
}
#[cfg(target_arch = "x86_64")]
unsafe fn set_window_long(window: winapi::HWND, data: winapi::LONG_PTR) -> winapi::LONG_PTR {
@ -203,6 +208,14 @@ unsafe extern "system" fn wnd_proc(window: winapi::HWND,
return 0;
}
winapi::winuser::WM_CHAR => {
char_down(wnd, wparam as u32);
}
winapi::winuser::WM_SYSCHAR => {
char_down(wnd, wparam as u32);
}
winapi::winuser::WM_LBUTTONDOWN => {
wnd.mouse.state[0] = true
}