From 6133e17b9a77d21a33f4dc30c3409aa19129cd08 Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Sun, 27 Jul 2014 20:08:31 +0200 Subject: [PATCH] Add moved events for win32 --- src/events.rs | 3 +++ src/win32/ffi.rs | 1 + src/win32/mod.rs | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/src/events.rs b/src/events.rs index f42d8aac..332867ad 100644 --- a/src/events.rs +++ b/src/events.rs @@ -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, diff --git a/src/win32/ffi.rs b/src/win32/ffi.rs index 96f09d41..8ff7c432 100644 --- a/src/win32/ffi.rs +++ b/src/win32/ffi.rs @@ -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; diff --git a/src/win32/mod.rs b/src/win32/mod.rs index be6014e9..481436c5 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -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;