diff options
author | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-07-27 22:36:44 +0200 |
---|---|---|
committer | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-07-27 22:36:55 +0200 |
commit | 14a697b272ab74058e9aa375851c13c18f07731e (patch) | |
tree | 639ac1b59a1fe7a4744597f3e9b70c54bbdaa0a4 /src/win32/mod.rs | |
parent | d4e334aecb1f6d6f85752ddbbf0a2da688036109 (diff) | |
download | glutin-14a697b272ab74058e9aa375851c13c18f07731e.tar.gz glutin-14a697b272ab74058e9aa375851c13c18f07731e.zip |
Implement get_*_size() for win32
Diffstat (limited to 'src/win32/mod.rs')
-rw-r--r-- | src/win32/mod.rs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/win32/mod.rs b/src/win32/mod.rs index b5e507b..8f3ae91 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -222,11 +222,31 @@ impl Window { } pub fn get_inner_size(&self) -> (uint, uint) { - unimplemented!() + use std::{mem, os}; + let mut rect: ffi::RECT = unsafe { mem::uninitialized() }; + + if unsafe { ffi::GetClientRect(self.window, &mut rect) } == 0 { + fail!("GetClientRect failed: {}", os::error_string(os::errno() as uint)); + } + + ( + (rect.right - rect.left) as uint, + (rect.bottom - rect.top) as uint + ) } pub fn get_outer_size(&self) -> (uint, uint) { - unimplemented!() + use std::{mem, os}; + let mut rect: ffi::RECT = unsafe { mem::uninitialized() }; + + if unsafe { ffi::GetWindowRect(self.window, &mut rect) } == 0 { + fail!("GetWindowRect failed: {}", os::error_string(os::errno() as uint)); + } + + ( + (rect.right - rect.left) as uint, + (rect.bottom - rect.top) as uint + ) } pub fn set_inner_size(&self, x: uint, y: uint) { |