diff options
-rw-r--r-- | glow/Cargo.toml | 1 | ||||
-rw-r--r-- | graphics/Cargo.toml | 2 | ||||
-rw-r--r-- | graphics/src/transformation.rs | 11 | ||||
-rw-r--r-- | native/src/widget/pane_grid/content.rs | 4 | ||||
-rw-r--r-- | native/src/widget/pane_grid/title_bar.rs | 12 | ||||
-rw-r--r-- | src/window/settings.rs | 5 | ||||
-rw-r--r-- | wgpu/Cargo.toml | 1 | ||||
-rw-r--r-- | winit/src/settings.rs | 5 |
8 files changed, 31 insertions, 10 deletions
diff --git a/glow/Cargo.toml b/glow/Cargo.toml index f1f491b3..11ca80e2 100644 --- a/glow/Cargo.toml +++ b/glow/Cargo.toml @@ -20,7 +20,6 @@ glow_glyph = "0.3" glyph_brush = "0.7" euclid = "0.20" bytemuck = "1.2" -glam = "0.8" log = "0.4" [dependencies.iced_native] diff --git a/graphics/Cargo.toml b/graphics/Cargo.toml index 8e078d75..723b9232 100644 --- a/graphics/Cargo.toml +++ b/graphics/Cargo.toml @@ -13,7 +13,7 @@ opengl = [] [dependencies] bytemuck = "1.2" -glam = "0.8" +glam = "0.9" raw-window-handle = "0.3" [dependencies.iced_native] diff --git a/graphics/src/transformation.rs b/graphics/src/transformation.rs index ff3b1d00..2a19caed 100644 --- a/graphics/src/transformation.rs +++ b/graphics/src/transformation.rs @@ -1,4 +1,4 @@ -use glam::{Mat4, Vec3, Vec4}; +use glam::{Mat4, Vec3}; use std::ops::Mul; /// A 2D transformation matrix. @@ -14,11 +14,10 @@ impl Transformation { /// Creates an orthographic projection. #[rustfmt::skip] pub fn orthographic(width: u32, height: u32) -> Transformation { - Transformation(Mat4::from_cols( - Vec4::new(2.0 / width as f32, 0.0, 0.0, 0.0), - Vec4::new(0.0, -2.0 / height as f32, 0.0, 0.0), - Vec4::new(0.0, 0.0, -1.0, 0.0), - Vec4::new(-1.0, 1.0, 0.0, 1.0) + Transformation(Mat4::orthographic_rh_gl( + 0.0, width as f32, + height as f32, 0.0, + -1.0, 1.0 )) } diff --git a/native/src/widget/pane_grid/content.rs b/native/src/widget/pane_grid/content.rs index 39a92186..1d339b75 100644 --- a/native/src/widget/pane_grid/content.rs +++ b/native/src/widget/pane_grid/content.rs @@ -183,6 +183,10 @@ where } 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); } diff --git a/native/src/widget/pane_grid/title_bar.rs b/native/src/widget/pane_grid/title_bar.rs index 1d4a32e9..9dfb9ae4 100644 --- a/native/src/widget/pane_grid/title_bar.rs +++ b/native/src/widget/pane_grid/title_bar.rs @@ -1,6 +1,8 @@ use crate::layout; 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`]. /// @@ -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( &self, renderer: &Renderer, diff --git a/src/window/settings.rs b/src/window/settings.rs index 2046f2d9..7bc49ce1 100644 --- a/src/window/settings.rs +++ b/src/window/settings.rs @@ -18,6 +18,9 @@ pub struct Settings { /// Whether the window should have a border, a title bar, etc. or not. pub decorations: bool, + /// Whether the window should be transparent + pub transparent: bool, + /// The icon of the window. pub icon: Option<Icon>, } @@ -30,6 +33,7 @@ impl Default for Settings { max_size: None, resizable: true, decorations: true, + transparent: false, icon: None, } } @@ -44,6 +48,7 @@ impl From<Settings> for iced_winit::settings::Window { max_size: settings.max_size, resizable: settings.resizable, decorations: settings.decorations, + transparent: settings.transparent, icon: settings.icon.map(Icon::into), platform_specific: Default::default(), } diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index db3104c4..6d9a1830 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -19,7 +19,6 @@ glyph_brush = "0.7" zerocopy = "0.3" bytemuck = "1.2" raw-window-handle = "0.3" -glam = "0.8" log = "0.4" guillotiere = "0.5" # Pin `gfx-memory` until https://github.com/gfx-rs/wgpu-rs/issues/261 is diff --git a/winit/src/settings.rs b/winit/src/settings.rs index 4155bf7d..92541e7d 100644 --- a/winit/src/settings.rs +++ b/winit/src/settings.rs @@ -45,6 +45,9 @@ pub struct Window { /// Whether the window should have a border, a title bar, etc. pub decorations: bool, + /// Whether the window should be transparent + pub transparent: bool, + /// The window icon, which is also usually used in the taskbar pub icon: Option<winit::window::Icon>, @@ -69,6 +72,7 @@ impl Window { .with_inner_size(winit::dpi::LogicalSize { width, height }) .with_resizable(self.resizable) .with_decorations(self.decorations) + .with_transparent(self.transparent) .with_window_icon(self.icon) .with_fullscreen(conversion::fullscreen(primary_monitor, mode)); @@ -103,6 +107,7 @@ impl Default for Window { max_size: None, resizable: true, decorations: true, + transparent: false, icon: None, platform_specific: Default::default(), } |