summaryrefslogtreecommitdiffstats
path: root/winit/src/settings.rs
diff options
context:
space:
mode:
Diffstat (limited to 'winit/src/settings.rs')
-rw-r--r--winit/src/settings.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/winit/src/settings.rs b/winit/src/settings.rs
index be0ab329..40b3d487 100644
--- a/winit/src/settings.rs
+++ b/winit/src/settings.rs
@@ -22,7 +22,7 @@ mod platform;
pub use platform::PlatformSpecific;
use crate::conversion;
-use crate::core::window::Icon;
+use crate::core::window::{Icon, Level};
use crate::Position;
use winit::monitor::MonitorHandle;
@@ -81,8 +81,8 @@ pub struct Window {
/// Whether the window should be transparent.
pub transparent: bool,
- /// Whether the window will always be on top of other windows.
- pub always_on_top: bool,
+ /// The window [`Level`].
+ pub level: Level,
/// The window icon, which is also usually used in the taskbar
pub icon: Option<Icon>,
@@ -102,7 +102,7 @@ impl fmt::Debug for Window {
.field("resizable", &self.resizable)
.field("decorations", &self.decorations)
.field("transparent", &self.transparent)
- .field("always_on_top", &self.always_on_top)
+ .field("level", &self.level)
.field("icon", &self.icon.is_some())
.field("platform_specific", &self.platform_specific)
.finish()
@@ -128,7 +128,7 @@ impl Window {
.with_decorations(self.decorations)
.with_transparent(self.transparent)
.with_window_icon(self.icon.and_then(conversion::icon))
- .with_always_on_top(self.always_on_top)
+ .with_window_level(conversion::window_level(self.level))
.with_visible(self.visible);
if let Some(position) = conversion::position(
@@ -157,7 +157,9 @@ impl Window {
target_os = "openbsd"
))]
{
- use ::winit::platform::unix::WindowBuilderExtUnix;
+ // `with_name` is available on both `WindowBuilderExtWayland` and `WindowBuilderExtX11` and they do
+ // exactly the same thing. We arbitrarily choose `WindowBuilderExtWayland` here.
+ use ::winit::platform::wayland::WindowBuilderExtWayland;
if let Some(id) = _id {
window_builder = window_builder.with_name(id.clone(), id);
@@ -167,11 +169,11 @@ impl Window {
#[cfg(target_os = "windows")]
{
use winit::platform::windows::WindowBuilderExtWindows;
-
- if let Some(parent) = self.platform_specific.parent {
- window_builder = window_builder.with_parent_window(parent);
+ #[allow(unsafe_code)]
+ unsafe {
+ window_builder = window_builder
+ .with_parent_window(self.platform_specific.parent);
}
-
window_builder = window_builder
.with_drag_and_drop(self.platform_specific.drag_and_drop);
}
@@ -205,7 +207,7 @@ impl Default for Window {
resizable: true,
decorations: true,
transparent: false,
- always_on_top: false,
+ level: Level::default(),
icon: None,
platform_specific: Default::default(),
}