diff --git a/winit-win32/src/window_state.rs b/winit-win32/src/window_state.rs index 78b36e5221..31c51fa385 100644 --- a/winit-win32/src/window_state.rs +++ b/winit-win32/src/window_state.rs @@ -295,12 +295,13 @@ impl WindowFlags { } if self.contains(WindowFlags::CHILD) { style |= WS_CHILD; // This is incompatible with WS_POPUP if that gets added eventually. - - // Remove decorations window styles for child - if !self.contains(WindowFlags::MARKER_DECORATIONS) { - style &= !(WS_CAPTION | WS_BORDER); - style_ex &= !WS_EX_WINDOWEDGE; - } + } + if !self.contains(WindowFlags::MARKER_DECORATIONS) { + // WS_CAPTION is equal to (WS_BORDER | WS_DLGFRAME) + // The former is intended for overlapped windows, + // the latter are for child windows. + style &= !(WS_CAPTION | WS_SIZEBOX); + style_ex &= !WS_EX_WINDOWEDGE; } if self.contains(WindowFlags::POPUP) { style |= WS_POPUP; diff --git a/winit/src/changelog/unreleased.md b/winit/src/changelog/unreleased.md index c59decc82a..79622c67ce 100644 --- a/winit/src/changelog/unreleased.md +++ b/winit/src/changelog/unreleased.md @@ -264,3 +264,4 @@ changelog entry. - On Windows, `Window::theme` will return the correct theme after setting it through `Window::set_theme`. - On Windows, `Window::set_theme` will change the title bar color immediately now. - On Windows 11, prevent incorrect shifting when dragging window onto a monitor with different DPI. +- On Windows, `with_decoration(false)` works for overlapped (non child) windows.