From 1c20ff87f1d58cb1a0f846ab961734291040b45a Mon Sep 17 00:00:00 2001 From: Ryan Stewart Date: Tue, 24 Mar 2015 13:24:07 -0700 Subject: honor top-left coordinates when requesting fullscreen to make sure window appears on the correct monitor --- src/win32/init.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/win32/init.rs b/src/win32/init.rs index b458d95..8ec8cb1 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -164,6 +164,12 @@ unsafe fn init(title: Vec, builder: BuilderAttribs<'static>, (None, None) }; + let (x, y) = if builder.monitor.is_some() { + (Some(rect.left), Some(rect.top)) + } else { + (None, None) + }; + let style = if !builder.visible || builder.headless { style } else { @@ -173,8 +179,7 @@ unsafe fn init(title: Vec, builder: BuilderAttribs<'static>, let handle = user32::CreateWindowExW(ex_style, class_name.as_ptr(), title.as_ptr() as winapi::LPCWSTR, style | winapi::WS_CLIPSIBLINGS | winapi::WS_CLIPCHILDREN, - if builder.monitor.is_some() { 0 } else { winapi::CW_USEDEFAULT }, - if builder.monitor.is_some() { 0 } else { winapi::CW_USEDEFAULT }, + x.unwrap_or(winapi::CW_USEDEFAULT), y.unwrap_or(winapi::CW_USEDEFAULT), width.unwrap_or(winapi::CW_USEDEFAULT), height.unwrap_or(winapi::CW_USEDEFAULT), ptr::null_mut(), ptr::null_mut(), kernel32::GetModuleHandleW(ptr::null()), ptr::null_mut()); -- cgit v1.2.3