Skip to content

Commit

Permalink
fix(windows): remove WS_CAPTION and WS_EX_WINDOWEDGE for child wi…
Browse files Browse the repository at this point in the history
…ndows (#864)

* fix(windows): remove `WS_CAPTION` and `WS_EX_WINDOWEDGE` for child windows

* remove when decorations disabled only

* actually remove
  • Loading branch information
amrbashir authored Jan 25, 2024
1 parent 585f05b commit ae4b693
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/child-styles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

On Windows, Remove `WS_CAPTION` and `WS_EX_WINDOWEDGE` window styles when creating a child window.
11 changes: 8 additions & 3 deletions src/platform_impl/windows/window_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit ae4b693

Please sign in to comment.