Not specifiying dimensions on win32 now results in CW_USEDEFAULT

Close #11
This commit is contained in:
Tomaka17 2014-08-22 11:19:19 +02:00
parent 761d82cd60
commit 6b45d1ca25

View file

@ -228,12 +228,18 @@ pub fn new_window(builder: WindowBuilder) -> Result<Window, String> {
// creating the real window this time // creating the real window this time
let real_window = unsafe { let real_window = unsafe {
let (width, height) = if builder.monitor.is_some() || builder.dimensions.is_some() {
(Some(rect.right - rect.left), Some(rect.bottom - rect.top))
} else {
(None, None)
};
let handle = ffi::CreateWindowExW(ex_style, class_name.as_ptr(), let handle = ffi::CreateWindowExW(ex_style, class_name.as_ptr(),
title.as_ptr() as ffi::LPCWSTR, title.as_ptr() as ffi::LPCWSTR,
style | ffi::WS_VISIBLE | ffi::WS_CLIPSIBLINGS | ffi::WS_CLIPCHILDREN, style | ffi::WS_VISIBLE | ffi::WS_CLIPSIBLINGS | ffi::WS_CLIPCHILDREN,
if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT }, if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT },
if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT }, if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT },
rect.right - rect.left, rect.bottom - rect.top, width.unwrap_or(ffi::CW_USEDEFAULT), height.unwrap_or(ffi::CW_USEDEFAULT),
ptr::mut_null(), ptr::mut_null(), ffi::GetModuleHandleW(ptr::null()), ptr::mut_null(), ptr::mut_null(), ffi::GetModuleHandleW(ptr::null()),
ptr::mut_null()); ptr::mut_null());