diff options
author | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-07-27 19:41:02 +0200 |
---|---|---|
committer | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-07-27 19:41:02 +0200 |
commit | f5080a2b2922c5cb26b7315910b1e111c44e75c5 (patch) | |
tree | 28aab50509ecab712d400686ecd40dbc0f9a7c94 /src | |
parent | a28282ef5f4b7e17d9897047dcf3c14f073c2d13 (diff) | |
download | glutin-f5080a2b2922c5cb26b7315910b1e111c44e75c5.tar.gz glutin-f5080a2b2922c5cb26b7315910b1e111c44e75c5.zip |
Implement mouse clicks on win32
Diffstat (limited to 'src')
-rw-r--r-- | src/win32/ffi.rs | 6 | ||||
-rw-r--r-- | src/win32/mod.rs | 36 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/win32/ffi.rs b/src/win32/ffi.rs index f10ab0f..cf853ea 100644 --- a/src/win32/ffi.rs +++ b/src/win32/ffi.rs @@ -298,13 +298,19 @@ pub static VK_PA1: WPARAM = 0xFD; pub static VK_OEM_CLEAR: WPARAM = 0xFE; // messages +pub static WM_LBUTTONDOWN: UINT = 0x0201; +pub static WM_LBUTTONUP: UINT = 0x0202; pub static WM_CHAR: UINT = 0x0102; pub static WM_COMMAND: UINT = 0x0111; pub static WM_DESTROY: UINT = 0x0002; pub static WM_KEYDOWN: UINT = 0x0100; pub static WM_KEYUP: UINT = 0x0101; +pub static WM_MBUTTONDOWN: UINT = 0x0207; +pub static WM_MBUTTONUP: UINT = 0x0208; pub static WM_MOUSEMOVE: UINT = 0x0200; pub static WM_PAINT: UINT = 0x000F; +pub static WM_RBUTTONDOWN: UINT = 0x0204; +pub static WM_RBUTTONUP: UINT = 0x0205; pub static WM_SIZE: UINT = 0x0005; pub static WM_SIZING: UINT = 0x0214; diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 95df9a4..d5a0820 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -359,6 +359,42 @@ extern "stdcall" fn callback(window: ffi::HWND, msg: ffi::UINT, 0 }, + ffi::WM_LBUTTONDOWN => { + use events::{Pressed, Button0}; + send_event(window, Pressed(Button0)); + 0 + }, + + ffi::WM_LBUTTONUP => { + use events::{Released, Button0}; + send_event(window, Released(Button0)); + 0 + }, + + ffi::WM_RBUTTONDOWN => { + use events::{Pressed, Button1}; + send_event(window, Pressed(Button1)); + 0 + }, + + ffi::WM_RBUTTONUP => { + use events::{Released, Button1}; + send_event(window, Released(Button1)); + 0 + }, + + ffi::WM_MBUTTONDOWN => { + use events::{Pressed, Button2}; + send_event(window, Pressed(Button2)); + 0 + }, + + ffi::WM_MBUTTONUP => { + use events::{Released, Button2}; + send_event(window, Released(Button2)); + 0 + }, + _ => unsafe { ffi::DefWindowProcW(window, msg, wparam, lparam) } |