diff --git a/src/lib.rs b/src/lib.rs index 0f46ca2..9dd5667 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -182,8 +182,13 @@ pub struct WindowOptions { pub topmost: bool, /// Specifies whether or not the window is allowed to draw transparent pixels (default: false) /// Requires borderless to be 'true' - /// TODO: Currently not implemented on Windows and OSX + /// TODO: Currently not implemented on OSX. + /// TODO: Make it work without none option on windows. pub transparency: bool, + /// Required for transparency on windows. + /// Should be mutually exclusive to resize, automatically assumes borderless. + /// Not supported on OSX. + pub none: bool, } impl Window { @@ -1039,6 +1044,7 @@ impl Default for WindowOptions { scale: Scale::X1, scale_mode: ScaleMode::Stretch, topmost: false, + none: false, } } } diff --git a/src/os/posix/wayland.rs b/src/os/posix/wayland.rs index b637c56..73c61cc 100644 --- a/src/os/posix/wayland.rs +++ b/src/os/posix/wayland.rs @@ -520,13 +520,13 @@ impl Window { let (display, input) = DisplayInfo::new( (width as i32 * scale, height as i32 * scale), opts.transparency, - !opts.borderless, + !opts.borderless || opts.none, )?; if opts.title { display.set_title(name); } - if !opts.resize { + if !opts.resize || opts.none { display.set_no_resize((width as i32 * scale, height as i32 * scale)); } @@ -558,7 +558,7 @@ impl Window { menu_counter: MenuHandle(0), menus: Vec::new(), input, - resizable: opts.resize, + resizable: opts.resize && !opts.none, buffer: Vec::with_capacity(width * height * scale as usize * scale as usize), toplevel_info: (resolution, closed), pointer_visibility: false, diff --git a/src/os/posix/x11.rs b/src/os/posix/x11.rs index 0cd1916..dbb78a8 100644 --- a/src/os/posix/x11.rs +++ b/src/os/posix/x11.rs @@ -403,7 +403,7 @@ impl Window { | xlib::FocusChangeMask, ); - if !opts.resize { + if !opts.resize || opts.none { let mut size_hints: xlib::XSizeHints = mem::zeroed(); size_hints.flags = xlib::PMinSize | xlib::PMaxSize; @@ -419,7 +419,7 @@ impl Window { ); } - if opts.borderless { + if opts.borderless || opts.none { let hints_property = (d.lib.XInternAtom)( d.display, "_MOTIF_WM_HINTS\0" as *const _ as *const c_char, diff --git a/src/os/redox/mod.rs b/src/os/redox/mod.rs index 91c9280..1a21969 100644 --- a/src/os/redox/mod.rs +++ b/src/os/redox/mod.rs @@ -61,7 +61,7 @@ impl Window { let window_height = height as u32 * window_scale as u32; let mut window_flags = vec![orbclient::WindowFlag::Async]; - if opts.resize { + if opts.resize && !opts.none { window_flags.push(orbclient::WindowFlag::Resizable); } if !opts.title { diff --git a/src/os/windows/mod.rs b/src/os/windows/mod.rs index 37a6973..40dc29e 100644 --- a/src/os/windows/mod.rs +++ b/src/os/windows/mod.rs @@ -541,6 +541,10 @@ impl Window { flags &= winuser::WS_EX_LAYERED; } + if opts.none { + flags = winuser::WS_VISIBLE | winuser::WS_POPUP; + } + let handle = winuser::CreateWindowExW( 0, class_name.as_ptr(),