Send mouse position after focused/cursorenter events (#349)

* Update mouse pos after cursor enter event

* Update mouse position on windows focus

* Send device_id

* Update other device id

* Fix windows import

* Remove deque for vec

* Just send event

* Use correct push_back method

* Push correct event
This commit is contained in:
stuart nelson 2017-11-26 15:43:13 -05:00 committed by Victor Berger
parent fae10c6072
commit 0f14e63b34
3 changed files with 48 additions and 4 deletions

View file

@ -673,11 +673,19 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
},
winapi::WM_SETFOCUS => {
use events::WindowEvent::Focused;
use events::WindowEvent::{Focused, CursorMoved};
send_event(Event::WindowEvent {
window_id: SuperWindowId(WindowId(window)),
event: Focused(true)
});
let x = winapi::GET_X_LPARAM(lparam) as f64;
let y = winapi::GET_Y_LPARAM(lparam) as f64;
send_event(Event::WindowEvent {
window_id: SuperWindowId(WindowId(window)),
event: CursorMoved { device_id: DEVICE_ID, position: (x, y) },
});
0
},