mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-02-02 14:56:34 +11:00
Implement get_*_size() for win32
This commit is contained in:
parent
d4e334aecb
commit
14a697b272
2 changed files with 28 additions and 2 deletions
|
@ -603,6 +603,9 @@ extern "system" {
|
|||
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd162719(v=vs.85).aspx
|
||||
pub fn FillRect(hDC: HDC, lprc: *const RECT, hbr: HBRUSH) -> libc::c_int;
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633503(v=vs.85).aspx
|
||||
pub fn GetClientRect(hWnd: HWND, lpRect: *mut RECT) -> BOOL;
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/dd144871(v=vs.85).aspx
|
||||
pub fn GetDC(hWnd: HWND) -> HDC;
|
||||
|
||||
|
@ -618,6 +621,9 @@ extern "system" {
|
|||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms683212(v=vs.85).aspx
|
||||
pub fn GetProcAddress(hModule: HMODULE, lpProcName: LPCSTR) -> *const libc::c_void;
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519(v=vs.85).aspx
|
||||
pub fn GetWindowRect(hWnd: HWND, lpRect: *mut RECT) -> BOOL;
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx
|
||||
pub fn LoadLibraryW(lpFileName: LPCWSTR) -> HMODULE;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue