aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-08-22 11:19:19 +0200
committerTomaka17 <pierre.krieger1708@gmail.com>2014-08-22 11:19:19 +0200
commit6b45d1ca25e2d4cafa8b0ca9441eaeeadd5ff37d (patch)
treecc9664980b93c5c99ca8681357aac2faee3ee2db /src
parent761d82cd607cc0c6c4a9008a6bed3ab1992804b4 (diff)
downloadglutin-6b45d1ca25e2d4cafa8b0ca9441eaeeadd5ff37d.tar.gz
glutin-6b45d1ca25e2d4cafa8b0ca9441eaeeadd5ff37d.zip
Not specifiying dimensions on win32 now results in CW_USEDEFAULT
Close #11
Diffstat (limited to 'src')
-rw-r--r--src/win32/init.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/win32/init.rs b/src/win32/init.rs
index 14c61a4..21d9612 100644
--- a/src/win32/init.rs
+++ b/src/win32/init.rs
@@ -228,12 +228,18 @@ pub fn new_window(builder: WindowBuilder) -> Result<Window, String> {
// creating the real window this time
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(),
title.as_ptr() as ffi::LPCWSTR,
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},
- rect.right - rect.left, rect.bottom - rect.top,
+ if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT },
+ if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT },
+ 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());