Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions winit-win32/src/window_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,6 @@ impl WindowFlags {
if self.contains(WindowFlags::ON_TASKBAR) {
style_ex |= WS_EX_APPWINDOW;
}
if self.contains(WindowFlags::ALWAYS_ON_TOP) {
style_ex |= WS_EX_TOPMOST;
}
if self.contains(WindowFlags::NO_BACK_BUFFER) {
style_ex |= WS_EX_NOREDIRECTIONBITMAP;
}
Expand Down Expand Up @@ -338,6 +335,19 @@ impl WindowFlags {
style &= !WS_OVERLAPPEDWINDOW;
}

if self.contains(WindowFlags::ALWAYS_ON_TOP) {
style_ex |= WS_EX_TOPMOST;

// A window with WS_EX_TOPMOST set must have one of the following style flags:
// WS_BORDER, WS_CAPTION, WS_SYSMENU, WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME,
// WS_EX_CLIENTEDGE, WS_EX_CONTEXTHELP, WS_EX_DLGMODALFRAME, WS_EX_TOOLWINDOW,
// WS_EX_WINDOWEDGE.
// If none of them are set, it will cause a DXGI error when creating a swapchain.
if style & WS_CAPTION == 0 {
style |= WS_POPUP;
}
}

(style, style_ex)
}

Expand Down
Loading