Merge branch 'master' into improvement/viewport-aware-drawing

This commit is contained in:
Héctor Ramón Jiménez 2020-08-19 02:05:41 +02:00
commit 3a0eea0dcd
4 changed files with 25 additions and 1 deletions

View File

@ -183,6 +183,10 @@ where
} }
pub(crate) fn hash_layout(&self, state: &mut Hasher) { pub(crate) fn hash_layout(&self, state: &mut Hasher) {
if let Some(title_bar) = &self.title_bar {
title_bar.hash_layout(state);
}
self.body.hash_layout(state); self.body.hash_layout(state);
} }

View File

@ -1,6 +1,8 @@
use crate::layout; use crate::layout;
use crate::pane_grid; use crate::pane_grid;
use crate::{Clipboard, Element, Event, Layout, Point, Rectangle, Size}; use crate::{
Clipboard, Element, Event, Hasher, Layout, Point, Rectangle, Size,
};
/// The title bar of a [`Pane`]. /// The title bar of a [`Pane`].
/// ///
@ -176,6 +178,14 @@ where
} }
} }
pub(crate) fn hash_layout(&self, hasher: &mut Hasher) {
use std::hash::Hash;
self.title.hash(hasher);
self.title_size.hash(hasher);
self.padding.hash(hasher);
}
pub(crate) fn layout( pub(crate) fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,

View File

@ -18,6 +18,9 @@ pub struct Settings {
/// Whether the window should have a border, a title bar, etc. or not. /// Whether the window should have a border, a title bar, etc. or not.
pub decorations: bool, pub decorations: bool,
/// Whether the window should be transparent
pub transparent: bool,
/// The icon of the window. /// The icon of the window.
pub icon: Option<Icon>, pub icon: Option<Icon>,
} }
@ -30,6 +33,7 @@ impl Default for Settings {
max_size: None, max_size: None,
resizable: true, resizable: true,
decorations: true, decorations: true,
transparent: false,
icon: None, icon: None,
} }
} }
@ -44,6 +48,7 @@ impl From<Settings> for iced_winit::settings::Window {
max_size: settings.max_size, max_size: settings.max_size,
resizable: settings.resizable, resizable: settings.resizable,
decorations: settings.decorations, decorations: settings.decorations,
transparent: settings.transparent,
icon: settings.icon.map(Icon::into), icon: settings.icon.map(Icon::into),
platform_specific: Default::default(), platform_specific: Default::default(),
} }

View File

@ -45,6 +45,9 @@ pub struct Window {
/// Whether the window should have a border, a title bar, etc. /// Whether the window should have a border, a title bar, etc.
pub decorations: bool, pub decorations: bool,
/// Whether the window should be transparent
pub transparent: bool,
/// The window icon, which is also usually used in the taskbar /// The window icon, which is also usually used in the taskbar
pub icon: Option<winit::window::Icon>, pub icon: Option<winit::window::Icon>,
@ -69,6 +72,7 @@ impl Window {
.with_inner_size(winit::dpi::LogicalSize { width, height }) .with_inner_size(winit::dpi::LogicalSize { width, height })
.with_resizable(self.resizable) .with_resizable(self.resizable)
.with_decorations(self.decorations) .with_decorations(self.decorations)
.with_transparent(self.transparent)
.with_window_icon(self.icon) .with_window_icon(self.icon)
.with_fullscreen(conversion::fullscreen(primary_monitor, mode)); .with_fullscreen(conversion::fullscreen(primary_monitor, mode));
@ -103,6 +107,7 @@ impl Default for Window {
max_size: None, max_size: None,
resizable: true, resizable: true,
decorations: true, decorations: true,
transparent: false,
icon: None, icon: None,
platform_specific: Default::default(), platform_specific: Default::default(),
} }