Add moved events for win32

This commit is contained in:
Tomaka17 2014-07-27 20:08:31 +02:00
parent 1e615b59a6
commit 6133e17b9a
3 changed files with 12 additions and 0 deletions

View file

@ -7,6 +7,9 @@ pub enum Event {
/// The size of the window has changed.
SizeChanged(uint, uint),
/// The position of the window has changed.
Moved(uint, uint),
/// The window has been closed.
Closed,

View file

@ -309,6 +309,7 @@ pub static WM_KILLFOCUS: UINT = 0x0008;
pub static WM_MBUTTONDOWN: UINT = 0x0207;
pub static WM_MBUTTONUP: UINT = 0x0208;
pub static WM_MOUSEMOVE: UINT = 0x0200;
pub static WM_MOVE: UINT = 0x0003;
pub static WM_PAINT: UINT = 0x000F;
pub static WM_RBUTTONDOWN: UINT = 0x0204;
pub static WM_RBUTTONUP: UINT = 0x0205;

View file

@ -299,6 +299,14 @@ extern "stdcall" fn callback(window: ffi::HWND, msg: ffi::UINT,
0
},
ffi::WM_MOVE => {
use events::Moved;
let x = ffi::LOWORD(lparam as ffi::DWORD) as uint;
let y = ffi::HIWORD(lparam as ffi::DWORD) as uint;
send_event(window, Moved(x, y));
0
},
ffi::WM_CHAR => {
use std::mem;
use events::ReceivedCharacter;