From 822403d1ed6ad10e344e92743eb502adc6247308 Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Sun, 1 May 2016 10:28:34 +0200 Subject: [PATCH] Implemented get_size() on Windows --- src/os/windows/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/os/windows/mod.rs b/src/os/windows/mod.rs index c921250..c88af82 100644 --- a/src/os/windows/mod.rs +++ b/src/os/windows/mod.rs @@ -243,6 +243,13 @@ unsafe extern "system" fn wnd_proc(window: winapi::HWND, } } + winapi::winuser::WM_SIZE => { + let width = (lparam as u32) & 0xffff; + let height = ((lparam as u32) >> 16) & 0xffff; + wnd.width = width as i32; + wnd.height = height as i32; + } + winapi::winuser::WM_PAINT => { // if we have nothing to draw here we return the default function @@ -467,7 +474,7 @@ impl Window { #[inline] pub fn get_size(&self) -> (usize, usize) { - (0, 0) + (self.width as usize, self.height as usize) } pub fn get_mouse_pos(&self, mode: MouseMode) -> Option<(f32, f32)> {