add with_taskbar to viewport builder (#3958)
Allows removing the taskbar icon of a viewport. This can be useful when making an overlay type viewport (window is always on top).
This commit is contained in:
parent
68eb3db648
commit
ee7fb47798
|
|
@ -1498,6 +1498,7 @@ pub fn create_winit_window_builder<T>(
|
|||
|
||||
// Windows:
|
||||
drag_and_drop: _drag_and_drop,
|
||||
taskbar: _taskbar,
|
||||
|
||||
// wayland:
|
||||
app_id: _app_id,
|
||||
|
|
@ -1575,9 +1576,14 @@ pub fn create_winit_window_builder<T>(
|
|||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
if let Some(enable) = _drag_and_drop {
|
||||
{
|
||||
use winit::platform::windows::WindowBuilderExtWindows as _;
|
||||
window_builder = window_builder.with_drag_and_drop(enable);
|
||||
if let Some(enable) = _drag_and_drop {
|
||||
window_builder = window_builder.with_drag_and_drop(enable);
|
||||
}
|
||||
if let Some(show) = _taskbar {
|
||||
window_builder = window_builder.with_skip_taskbar(!show);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
|
|
|||
|
|
@ -283,7 +283,6 @@ pub struct ViewportBuilder {
|
|||
pub icon: Option<Arc<IconData>>,
|
||||
pub active: Option<bool>,
|
||||
pub visible: Option<bool>,
|
||||
pub drag_and_drop: Option<bool>,
|
||||
|
||||
// macOS:
|
||||
pub fullsize_content_view: Option<bool>,
|
||||
|
|
@ -291,6 +290,10 @@ pub struct ViewportBuilder {
|
|||
pub titlebar_buttons_shown: Option<bool>,
|
||||
pub titlebar_shown: Option<bool>,
|
||||
|
||||
// windows:
|
||||
pub drag_and_drop: Option<bool>,
|
||||
pub taskbar: Option<bool>,
|
||||
|
||||
pub close_button: Option<bool>,
|
||||
pub minimize_button: Option<bool>,
|
||||
pub maximize_button: Option<bool>,
|
||||
|
|
@ -442,6 +445,13 @@ impl ViewportBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
/// windows: Whether show or hide the window icon in the taskbar.
|
||||
#[inline]
|
||||
pub fn with_taskbar(mut self, show: bool) -> Self {
|
||||
self.taskbar = Some(show);
|
||||
self
|
||||
}
|
||||
|
||||
/// Requests the window to be of specific dimensions.
|
||||
///
|
||||
/// If this is not set, some platform-specific dimensions will be used.
|
||||
|
|
@ -602,6 +612,7 @@ impl ViewportBuilder {
|
|||
maximize_button: new_maximize_button,
|
||||
window_level: new_window_level,
|
||||
mouse_passthrough: new_mouse_passthrough,
|
||||
taskbar: new_taskbar,
|
||||
} = new_vp_builder;
|
||||
|
||||
let mut commands = Vec::new();
|
||||
|
|
@ -758,6 +769,11 @@ impl ViewportBuilder {
|
|||
recreate_window = true;
|
||||
}
|
||||
|
||||
if new_taskbar.is_some() && self.taskbar != new_taskbar {
|
||||
self.taskbar = new_taskbar;
|
||||
recreate_window = true;
|
||||
}
|
||||
|
||||
if new_fullsize_content_view.is_some()
|
||||
&& self.fullsize_content_view != new_fullsize_content_view
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue