diff --git a/.changes/child-styles.md b/.changes/child-styles.md new file mode 100644 index 00000000..a7972ea9 --- /dev/null +++ b/.changes/child-styles.md @@ -0,0 +1,5 @@ +--- +"tao": "patch" +--- + +On Windows, Remove `WS_CAPTION` and `WS_EX_WINDOWEDGE` window styles when creating a child window. diff --git a/src/platform_impl/windows/window_state.rs b/src/platform_impl/windows/window_state.rs index 5d5c96b6..563d7116 100644 --- a/src/platform_impl/windows/window_state.rs +++ b/src/platform_impl/windows/window_state.rs @@ -231,9 +231,8 @@ impl WindowFlags { pub fn to_window_styles(self) -> (WINDOW_STYLE, WINDOW_EX_STYLE) { let (mut style, mut style_ex) = (Default::default(), Default::default()); - style |= WS_CLIPSIBLINGS | WS_SYSMENU | WS_CAPTION; - style_ex |= WS_EX_ACCEPTFILES | WS_EX_WINDOWEDGE; - + style |= WS_CAPTION | WS_CLIPSIBLINGS | WS_SYSMENU; + style_ex |= WS_EX_WINDOWEDGE | WS_EX_ACCEPTFILES; if self.contains(WindowFlags::RESIZABLE) { style |= WS_SIZEBOX; } @@ -257,6 +256,12 @@ 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; + style_ex &= !WS_EX_WINDOWEDGE; + } } if self.contains(WindowFlags::POPUP) { style |= WS_POPUP;