mirror of
https://github.com/storytold/winit.git
synced 2026-11-24 21:30:44 +01:00
fix: ensure window type is always set when using WS_EX_TOPMOST (#4659)
This commit is contained in:
1 parent
0692d399f5
commit
475f5e2363
2 files changed
+17
-3
No files matched your search
@@ -332,9 +332,6 @@ impl WindowFlags {
|
||||
if self.contains(WindowFlags::VISIBLE) {
|
||||
style |= WS_VISIBLE;
|
||||
}
|
||||
if self.contains(WindowFlags::ALWAYS_ON_TOP) {
|
||||
style_ex |= WS_EX_TOPMOST;
|
||||
}
|
||||
if self.contains(WindowFlags::NO_BACK_BUFFER) {
|
||||
style_ex |= WS_EX_NOREDIRECTIONBITMAP;
|
||||
}
|
||||
@@ -366,6 +363,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_POPUP, 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)
|
||||
}
|
||||
|
||||
|
||||
@@ -39,3 +39,7 @@ The migration guide could reference other migration examples in the current
|
||||
changelog entry.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- On Windows, fix a crash occurring when trying to create a DXGI surface on a window that is both fullscreen and always on top.
|
||||
Reference in new issue
Block a user