aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-03-30 13:12:37 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-03-30 13:12:37 +0200
commit2089e9c476691b8d81b9bbe8eb83f4c878614774 (patch)
treeaa3d6c4ea6d9903a7e7953b808401f1d8cd8c5d8
parent9bef21048ef03ecfa8e0ca46ed700cabf95a9f30 (diff)
downloadglutin-2089e9c476691b8d81b9bbe8eb83f4c878614774.tar.gz
glutin-2089e9c476691b8d81b9bbe8eb83f4c878614774.zip
Add draft for raw input
-rw-r--r--src/win32/callback.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/win32/callback.rs b/src/win32/callback.rs
index bbf5b55..1cfb640 100644
--- a/src/win32/callback.rs
+++ b/src/win32/callback.rs
@@ -1,3 +1,4 @@
+use std::mem;
use std::rc::Rc;
use std::cell::RefCell;
use std::sync::mpsc::Sender;
@@ -176,6 +177,26 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
0
},
+ winapi::WM_INPUT => {
+ let mut data: winapi::RAWINPUT = mem::uninitialized();
+ let mut data_size = mem::size_of::<winapi::RAWINPUT>() as winapi::UINT;
+ user32::GetRawInputData(mem::transmute(lparam), winapi::RID_INPUT,
+ mem::transmute(&mut data), &mut data_size,
+ mem::size_of::<winapi::RAWINPUTHEADER>() as winapi::UINT);
+
+ if data.header.dwType == winapi::RIM_TYPEMOUSE {
+ let _x = data.mouse.lLastX; // FIXME: this is not always the relative movement
+ let _y = data.mouse.lLastY;
+ // TODO:
+ //send_event(window, Event::MouseRawMovement { x: x, y: y });
+
+ 0
+
+ } else {
+ user32::DefWindowProcW(window, msg, wparam, lparam)
+ }
+ },
+
winapi::WM_SETFOCUS => {
use events::Event::Focused;
send_event(window, Focused(true));