diff --git a/CHANGELOG.md b/CHANGELOG.md index ccb1b79..26c24ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This project follows semantic versioning. +### v0.8.1 (2016-07-07) + +- [fixed] Character callback wouldn't get called on Mac and Linux +- [fixed] Resize cursors on Windows was swapped + ### v0.8.0 (2016-06-24) - [added] ```window.set_title``` Can now change title after creation diff --git a/Cargo.toml b/Cargo.toml index 78fc1d5..bf0db9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minifb" -version = "0.8.0" +version = "0.8.1" license = "MIT/Apache-2.0" authors = ["Daniel Collin "] description = "Cross-platform window setup with optional bitmap rendering" diff --git a/README.md b/README.md index ea6e899..c4ac4dc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Usage ```toml # Cargo.toml [dependencies] -minifb = "0.8.0" +minifb = "0.8.1" ``` Example diff --git a/src/os/windows/mod.rs b/src/os/windows/mod.rs index 507146f..d05fa0f 100644 --- a/src/os/windows/mod.rs +++ b/src/os/windows/mod.rs @@ -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 } @@ -463,8 +476,8 @@ impl Window { user32::LoadCursorW(ptr::null_mut(), winuser::IDC_CROSS), user32::LoadCursorW(ptr::null_mut(), winuser::IDC_HAND), user32::LoadCursorW(ptr::null_mut(), winuser::IDC_HAND), - user32::LoadCursorW(ptr::null_mut(), winuser::IDC_SIZENS), user32::LoadCursorW(ptr::null_mut(), winuser::IDC_SIZEWE), + user32::LoadCursorW(ptr::null_mut(), winuser::IDC_SIZENS), user32::LoadCursorW(ptr::null_mut(), winuser::IDC_SIZEALL), ], };