summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock9
-rw-r--r--Cargo.toml1
-rw-r--r--core/Cargo.toml1
-rw-r--r--core/src/theme.rs6
-rw-r--r--core/src/theme/palette.rs91
-rw-r--r--core/src/window/settings.rs8
-rw-r--r--examples/loading_spinners/Cargo.toml1
-rw-r--r--examples/loading_spinners/src/easing.rs15
-rw-r--r--examples/scrollable/Cargo.toml2
-rw-r--r--examples/scrollable/src/main.rs5
-rw-r--r--examples/todos/src/main.rs4
-rw-r--r--examples/visible_bounds/Cargo.toml2
-rw-r--r--examples/visible_bounds/src/main.rs10
-rw-r--r--examples/websocket/Cargo.toml1
-rw-r--r--examples/websocket/src/main.rs5
-rw-r--r--graphics/Cargo.toml1
-rw-r--r--graphics/src/text.rs5
-rw-r--r--graphics/src/text/paragraph.rs4
-rw-r--r--highlighter/Cargo.toml1
-rw-r--r--highlighter/src/lib.rs10
-rw-r--r--runtime/src/window.rs60
-rw-r--r--wgpu/Cargo.toml1
-rw-r--r--widget/Cargo.toml1
-rw-r--r--widget/src/helpers.rs4
-rw-r--r--winit/src/conversion.rs6
-rw-r--r--winit/src/program.rs41
26 files changed, 182 insertions, 113 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 85fab142..d1f4aaca 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2435,7 +2435,6 @@ dependencies = [
"glam",
"log",
"num-traits",
- "once_cell",
"palette",
"rustc-hash 2.1.0",
"smol_str",
@@ -2472,7 +2471,6 @@ dependencies = [
"kamadak-exif",
"log",
"lyon_path",
- "once_cell",
"raw-window-handle 0.6.2",
"rustc-hash 2.1.0",
"thiserror 1.0.69",
@@ -2484,7 +2482,6 @@ name = "iced_highlighter"
version = "0.14.0-dev"
dependencies = [
"iced_core",
- "once_cell",
"syntect",
]
@@ -2549,7 +2546,6 @@ dependencies = [
"iced_graphics",
"log",
"lyon",
- "once_cell",
"resvg",
"rustc-hash 2.1.0",
"thiserror 1.0.69",
@@ -2564,7 +2560,6 @@ dependencies = [
"iced_renderer",
"iced_runtime",
"num-traits",
- "once_cell",
"ouroboros",
"pulldown-cmark",
"qrcode",
@@ -3066,7 +3061,6 @@ version = "0.1.0"
dependencies = [
"iced",
"lyon_algorithms",
- "once_cell",
]
[[package]]
@@ -4738,7 +4732,6 @@ name = "scrollable"
version = "0.1.0"
dependencies = [
"iced",
- "once_cell",
]
[[package]]
@@ -5936,7 +5929,6 @@ name = "visible_bounds"
version = "0.1.0"
dependencies = [
"iced",
- "once_cell",
]
[[package]]
@@ -6290,7 +6282,6 @@ version = "1.0.0"
dependencies = [
"async-tungstenite",
"iced",
- "once_cell",
"tokio",
"warp",
]
diff --git a/Cargo.toml b/Cargo.toml
index eb2251c8..9059cfd9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -162,7 +162,6 @@ log = "0.4"
lyon = "1.0"
lyon_path = "1.0"
num-traits = "0.2"
-once_cell = "1.0"
ouroboros = "0.18"
palette = "0.7"
png = "0.17"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index a1228909..a3bc6745 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -23,7 +23,6 @@ bytes.workspace = true
glam.workspace = true
log.workspace = true
num-traits.workspace = true
-once_cell.workspace = true
palette.workspace = true
rustc-hash.workspace = true
smol_str.workspace = true
diff --git a/core/src/theme.rs b/core/src/theme.rs
index 23480cec..1f9e4fdf 100644
--- a/core/src/theme.rs
+++ b/core/src/theme.rs
@@ -166,10 +166,10 @@ impl Default for Theme {
fn default() -> Self {
#[cfg(feature = "auto-detect-theme")]
{
- use once_cell::sync::Lazy;
+ use std::sync::LazyLock;
- static DEFAULT: Lazy<Theme> =
- Lazy::new(|| match dark_light::detect() {
+ static DEFAULT: LazyLock<Theme> =
+ LazyLock::new(|| match dark_light::detect() {
dark_light::Mode::Dark => Theme::Dark,
dark_light::Mode::Light | dark_light::Mode::Default => {
Theme::Light
diff --git a/core/src/theme/palette.rs b/core/src/theme/palette.rs
index 00c38019..696c01d0 100644
--- a/core/src/theme/palette.rs
+++ b/core/src/theme/palette.rs
@@ -1,11 +1,12 @@
//! Define the colors of a theme.
use crate::{color, Color};
-use once_cell::sync::Lazy;
use palette::color_difference::Wcag21RelativeContrast;
use palette::rgb::Rgb;
use palette::{FromColor, Hsl, Mix};
+use std::sync::LazyLock;
+
/// A color palette.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Palette {
@@ -341,92 +342,92 @@ pub struct Extended {
}
/// The built-in light variant of an [`Extended`] palette.
-pub static EXTENDED_LIGHT: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::LIGHT));
+pub static EXTENDED_LIGHT: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::LIGHT));
/// The built-in dark variant of an [`Extended`] palette.
-pub static EXTENDED_DARK: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::DARK));
+pub static EXTENDED_DARK: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::DARK));
/// The built-in Dracula variant of an [`Extended`] palette.
-pub static EXTENDED_DRACULA: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::DRACULA));
+pub static EXTENDED_DRACULA: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::DRACULA));
/// The built-in Nord variant of an [`Extended`] palette.
-pub static EXTENDED_NORD: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::NORD));
+pub static EXTENDED_NORD: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::NORD));
/// The built-in Solarized Light variant of an [`Extended`] palette.
-pub static EXTENDED_SOLARIZED_LIGHT: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::SOLARIZED_LIGHT));
+pub static EXTENDED_SOLARIZED_LIGHT: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::SOLARIZED_LIGHT));
/// The built-in Solarized Dark variant of an [`Extended`] palette.
-pub static EXTENDED_SOLARIZED_DARK: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::SOLARIZED_DARK));
+pub static EXTENDED_SOLARIZED_DARK: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::SOLARIZED_DARK));
/// The built-in Gruvbox Light variant of an [`Extended`] palette.
-pub static EXTENDED_GRUVBOX_LIGHT: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::GRUVBOX_LIGHT));
+pub static EXTENDED_GRUVBOX_LIGHT: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::GRUVBOX_LIGHT));
/// The built-in Gruvbox Dark variant of an [`Extended`] palette.
-pub static EXTENDED_GRUVBOX_DARK: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::GRUVBOX_DARK));
+pub static EXTENDED_GRUVBOX_DARK: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::GRUVBOX_DARK));
/// The built-in Catppuccin Latte variant of an [`Extended`] palette.
-pub static EXTENDED_CATPPUCCIN_LATTE: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_LATTE));
+pub static EXTENDED_CATPPUCCIN_LATTE: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::CATPPUCCIN_LATTE));
/// The built-in Catppuccin Frappé variant of an [`Extended`] palette.
-pub static EXTENDED_CATPPUCCIN_FRAPPE: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_FRAPPE));
+pub static EXTENDED_CATPPUCCIN_FRAPPE: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::CATPPUCCIN_FRAPPE));
/// The built-in Catppuccin Macchiato variant of an [`Extended`] palette.
-pub static EXTENDED_CATPPUCCIN_MACCHIATO: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_MACCHIATO));
+pub static EXTENDED_CATPPUCCIN_MACCHIATO: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::CATPPUCCIN_MACCHIATO));
/// The built-in Catppuccin Mocha variant of an [`Extended`] palette.
-pub static EXTENDED_CATPPUCCIN_MOCHA: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_MOCHA));
+pub static EXTENDED_CATPPUCCIN_MOCHA: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::CATPPUCCIN_MOCHA));
/// The built-in Tokyo Night variant of an [`Extended`] palette.
-pub static EXTENDED_TOKYO_NIGHT: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::TOKYO_NIGHT));
+pub static EXTENDED_TOKYO_NIGHT: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::TOKYO_NIGHT));
/// The built-in Tokyo Night Storm variant of an [`Extended`] palette.
-pub static EXTENDED_TOKYO_NIGHT_STORM: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::TOKYO_NIGHT_STORM));
+pub static EXTENDED_TOKYO_NIGHT_STORM: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::TOKYO_NIGHT_STORM));
/// The built-in Tokyo Night variant of an [`Extended`] palette.
-pub static EXTENDED_TOKYO_NIGHT_LIGHT: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::TOKYO_NIGHT_LIGHT));
+pub static EXTENDED_TOKYO_NIGHT_LIGHT: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::TOKYO_NIGHT_LIGHT));
/// The built-in Kanagawa Wave variant of an [`Extended`] palette.
-pub static EXTENDED_KANAGAWA_WAVE: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::KANAGAWA_WAVE));
+pub static EXTENDED_KANAGAWA_WAVE: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::KANAGAWA_WAVE));
/// The built-in Kanagawa Dragon variant of an [`Extended`] palette.
-pub static EXTENDED_KANAGAWA_DRAGON: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::KANAGAWA_DRAGON));
+pub static EXTENDED_KANAGAWA_DRAGON: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::KANAGAWA_DRAGON));
/// The built-in Kanagawa Lotus variant of an [`Extended`] palette.
-pub static EXTENDED_KANAGAWA_LOTUS: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::KANAGAWA_LOTUS));
+pub static EXTENDED_KANAGAWA_LOTUS: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::KANAGAWA_LOTUS));
/// The built-in Moonfly variant of an [`Extended`] palette.
-pub static EXTENDED_MOONFLY: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::MOONFLY));
+pub static EXTENDED_MOONFLY: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::MOONFLY));
/// The built-in Nightfly variant of an [`Extended`] palette.
-pub static EXTENDED_NIGHTFLY: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::NIGHTFLY));
+pub static EXTENDED_NIGHTFLY: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::NIGHTFLY));
/// The built-in Oxocarbon variant of an [`Extended`] palette.
-pub static EXTENDED_OXOCARBON: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::OXOCARBON));
+pub static EXTENDED_OXOCARBON: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::OXOCARBON));
/// The built-in Ferra variant of an [`Extended`] palette.
-pub static EXTENDED_FERRA: Lazy<Extended> =
- Lazy::new(|| Extended::generate(Palette::FERRA));
+pub static EXTENDED_FERRA: LazyLock<Extended> =
+ LazyLock::new(|| Extended::generate(Palette::FERRA));
impl Extended {
/// Generates an [`Extended`] palette from a simple [`Palette`].
diff --git a/core/src/window/settings.rs b/core/src/window/settings.rs
index c1f36a6c..9432eaaa 100644
--- a/core/src/window/settings.rs
+++ b/core/src/window/settings.rs
@@ -35,6 +35,12 @@ pub struct Settings {
/// The initial logical dimensions of the window.
pub size: Size,
+ /// Whether the window should start maximized.
+ pub maximized: bool,
+
+ /// Whether the window should start fullscreen.
+ pub fullscreen: bool,
+
/// The initial position of the window.
pub position: Position,
@@ -80,6 +86,8 @@ impl Default for Settings {
fn default() -> Self {
Self {
size: Size::new(1024.0, 768.0),
+ maximized: false,
+ fullscreen: false,
position: Position::default(),
min_size: None,
max_size: None,
diff --git a/examples/loading_spinners/Cargo.toml b/examples/loading_spinners/Cargo.toml
index a32da386..abd28aec 100644
--- a/examples/loading_spinners/Cargo.toml
+++ b/examples/loading_spinners/Cargo.toml
@@ -10,4 +10,3 @@ iced.workspace = true
iced.features = ["advanced", "canvas"]
lyon_algorithms = "1.0"
-once_cell.workspace = true \ No newline at end of file
diff --git a/examples/loading_spinners/src/easing.rs b/examples/loading_spinners/src/easing.rs
index 45089ef6..8caf282d 100644
--- a/examples/loading_spinners/src/easing.rs
+++ b/examples/loading_spinners/src/easing.rs
@@ -2,40 +2,41 @@ use iced::Point;
use lyon_algorithms::measure::PathMeasurements;
use lyon_algorithms::path::{builder::NoAttributes, path::BuilderImpl, Path};
-use once_cell::sync::Lazy;
-pub static EMPHASIZED: Lazy<Easing> = Lazy::new(|| {
+use std::sync::LazyLock;
+
+pub static EMPHASIZED: LazyLock<Easing> = LazyLock::new(|| {
Easing::builder()
.cubic_bezier_to([0.05, 0.0], [0.133333, 0.06], [0.166666, 0.4])
.cubic_bezier_to([0.208333, 0.82], [0.25, 1.0], [1.0, 1.0])
.build()
});
-pub static EMPHASIZED_DECELERATE: Lazy<Easing> = Lazy::new(|| {
+pub static EMPHASIZED_DECELERATE: LazyLock<Easing> = LazyLock::new(|| {
Easing::builder()
.cubic_bezier_to([0.05, 0.7], [0.1, 1.0], [1.0, 1.0])
.build()
});
-pub static EMPHASIZED_ACCELERATE: Lazy<Easing> = Lazy::new(|| {
+pub static EMPHASIZED_ACCELERATE: LazyLock<Easing> = LazyLock::new(|| {
Easing::builder()
.cubic_bezier_to([0.3, 0.0], [0.8, 0.15], [1.0, 1.0])
.build()
});
-pub static STANDARD: Lazy<Easing> = Lazy::new(|| {
+pub static STANDARD: LazyLock<Easing> = LazyLock::new(|| {
Easing::builder()
.cubic_bezier_to([0.2, 0.0], [0.0, 1.0], [1.0, 1.0])
.build()
});
-pub static STANDARD_DECELERATE: Lazy<Easing> = Lazy::new(|| {
+pub static STANDARD_DECELERATE: LazyLock<Easing> = LazyLock::new(|| {
Easing::builder()
.cubic_bezier_to([0.0, 0.0], [0.0, 1.0], [1.0, 1.0])
.build()
});
-pub static STANDARD_ACCELERATE: Lazy<Easing> = Lazy::new(|| {
+pub static STANDARD_ACCELERATE: LazyLock<Easing> = LazyLock::new(|| {
Easing::builder()
.cubic_bezier_to([0.3, 0.0], [1.0, 1.0], [1.0, 1.0])
.build()
diff --git a/examples/scrollable/Cargo.toml b/examples/scrollable/Cargo.toml
index f8c735c0..ba291520 100644
--- a/examples/scrollable/Cargo.toml
+++ b/examples/scrollable/Cargo.toml
@@ -8,5 +8,3 @@ publish = false
[dependencies]
iced.workspace = true
iced.features = ["debug"]
-
-once_cell.workspace = true
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs
index de4f2f9a..6359fb5a 100644
--- a/examples/scrollable/src/main.rs
+++ b/examples/scrollable/src/main.rs
@@ -4,9 +4,10 @@ use iced::widget::{
};
use iced::{Border, Center, Color, Element, Fill, Task, Theme};
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
-static SCROLLABLE_ID: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);
+static SCROLLABLE_ID: LazyLock<scrollable::Id> =
+ LazyLock::new(scrollable::Id::unique);
pub fn main() -> iced::Result {
iced::application(
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index a5bca235..e86e23b5 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -149,9 +149,7 @@ impl Todos {
}
}
Message::ToggleFullscreen(mode) => window::get_latest()
- .and_then(move |window| {
- window::change_mode(window, mode)
- }),
+ .and_then(move |window| window::set_mode(window, mode)),
Message::Loaded(_) => Command::none(),
};
diff --git a/examples/visible_bounds/Cargo.toml b/examples/visible_bounds/Cargo.toml
index 37594b84..1193334d 100644
--- a/examples/visible_bounds/Cargo.toml
+++ b/examples/visible_bounds/Cargo.toml
@@ -8,5 +8,3 @@ publish = false
[dependencies]
iced.workspace = true
iced.features = ["debug"]
-
-once_cell.workspace = true
diff --git a/examples/visible_bounds/src/main.rs b/examples/visible_bounds/src/main.rs
index 77fec65e..f8f9f420 100644
--- a/examples/visible_bounds/src/main.rs
+++ b/examples/visible_bounds/src/main.rs
@@ -157,9 +157,9 @@ impl Example {
}
}
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
-static OUTER_CONTAINER: Lazy<container::Id> =
- Lazy::new(|| container::Id::new("outer"));
-static INNER_CONTAINER: Lazy<container::Id> =
- Lazy::new(|| container::Id::new("inner"));
+static OUTER_CONTAINER: LazyLock<container::Id> =
+ LazyLock::new(|| container::Id::new("outer"));
+static INNER_CONTAINER: LazyLock<container::Id> =
+ LazyLock::new(|| container::Id::new("inner"));
diff --git a/examples/websocket/Cargo.toml b/examples/websocket/Cargo.toml
index c7075fb3..787dbbe1 100644
--- a/examples/websocket/Cargo.toml
+++ b/examples/websocket/Cargo.toml
@@ -9,7 +9,6 @@ publish = false
iced.workspace = true
iced.features = ["debug", "tokio"]
-once_cell.workspace = true
warp = "0.3"
[dependencies.async-tungstenite]
diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs
index 8b1efb41..ae658471 100644
--- a/examples/websocket/src/main.rs
+++ b/examples/websocket/src/main.rs
@@ -4,7 +4,7 @@ use iced::widget::{
self, button, center, column, row, scrollable, text, text_input,
};
use iced::{color, Center, Element, Fill, Subscription, Task};
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
pub fn main() -> iced::Result {
iced::application("WebSocket - Iced", WebSocket::update, WebSocket::view)
@@ -138,4 +138,5 @@ enum State {
Connected(echo::Connection),
}
-static MESSAGE_LOG: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);
+static MESSAGE_LOG: LazyLock<scrollable::Id> =
+ LazyLock::new(scrollable::Id::unique);
diff --git a/graphics/Cargo.toml b/graphics/Cargo.toml
index 7e2d767b..43191a59 100644
--- a/graphics/Cargo.toml
+++ b/graphics/Cargo.toml
@@ -33,7 +33,6 @@ bytemuck.workspace = true
cosmic-text.workspace = true
half.workspace = true
log.workspace = true
-once_cell.workspace = true
raw-window-handle.workspace = true
rustc-hash.workspace = true
thiserror.workspace = true
diff --git a/graphics/src/text.rs b/graphics/src/text.rs
index ca3fc6fc..7694ff1f 100644
--- a/graphics/src/text.rs
+++ b/graphics/src/text.rs
@@ -14,10 +14,9 @@ use crate::core::font::{self, Font};
use crate::core::text::{Shaping, Wrapping};
use crate::core::{Color, Pixels, Point, Rectangle, Size, Transformation};
-use once_cell::sync::OnceCell;
use std::borrow::Cow;
use std::collections::HashSet;
-use std::sync::{Arc, RwLock, Weak};
+use std::sync::{Arc, OnceLock, RwLock, Weak};
/// A text primitive.
#[derive(Debug, Clone, PartialEq)]
@@ -157,7 +156,7 @@ pub const FIRA_SANS_REGULAR: &[u8] =
/// Returns the global [`FontSystem`].
pub fn font_system() -> &'static RwLock<FontSystem> {
- static FONT_SYSTEM: OnceCell<RwLock<FontSystem>> = OnceCell::new();
+ static FONT_SYSTEM: OnceLock<RwLock<FontSystem>> = OnceLock::new();
FONT_SYSTEM.get_or_init(|| {
RwLock::new(FontSystem {
diff --git a/graphics/src/text/paragraph.rs b/graphics/src/text/paragraph.rs
index 07ddbb82..48c8e9e6 100644
--- a/graphics/src/text/paragraph.rs
+++ b/graphics/src/text/paragraph.rs
@@ -80,6 +80,8 @@ impl core::text::Paragraph for Paragraph {
Some(text.bounds.height),
);
+ buffer.set_wrap(font_system.raw(), text::to_wrap(text.wrapping));
+
buffer.set_text(
font_system.raw(),
text.content,
@@ -122,6 +124,8 @@ impl core::text::Paragraph for Paragraph {
Some(text.bounds.height),
);
+ buffer.set_wrap(font_system.raw(), text::to_wrap(text.wrapping));
+
buffer.set_rich_text(
font_system.raw(),
text.content.iter().enumerate().map(|(i, span)| {
diff --git a/highlighter/Cargo.toml b/highlighter/Cargo.toml
index 7962b89d..4c20a678 100644
--- a/highlighter/Cargo.toml
+++ b/highlighter/Cargo.toml
@@ -16,5 +16,4 @@ workspace = true
[dependencies]
iced_core.workspace = true
-once_cell.workspace = true
syntect.workspace = true
diff --git a/highlighter/src/lib.rs b/highlighter/src/lib.rs
index 83a15cb1..d2abc6b1 100644
--- a/highlighter/src/lib.rs
+++ b/highlighter/src/lib.rs
@@ -5,16 +5,16 @@ use crate::core::font::{self, Font};
use crate::core::text::highlighter::{self, Format};
use crate::core::Color;
-use once_cell::sync::Lazy;
use std::ops::Range;
+use std::sync::LazyLock;
use syntect::highlighting;
use syntect::parsing;
-static SYNTAXES: Lazy<parsing::SyntaxSet> =
- Lazy::new(parsing::SyntaxSet::load_defaults_nonewlines);
+static SYNTAXES: LazyLock<parsing::SyntaxSet> =
+ LazyLock::new(parsing::SyntaxSet::load_defaults_nonewlines);
-static THEMES: Lazy<highlighting::ThemeSet> =
- Lazy::new(highlighting::ThemeSet::load_defaults);
+static THEMES: LazyLock<highlighting::ThemeSet> =
+ LazyLock::new(highlighting::ThemeSet::load_defaults);
const LINES_PER_SNAPSHOT: usize = 50;
diff --git a/runtime/src/window.rs b/runtime/src/window.rs
index 0ebdba2f..94ee0ae5 100644
--- a/runtime/src/window.rs
+++ b/runtime/src/window.rs
@@ -68,7 +68,7 @@ pub enum Action {
Move(Id, Point),
/// Change the [`Mode`] of the window.
- ChangeMode(Id, Mode),
+ SetMode(Id, Mode),
/// Get the current [`Mode`] of the window.
GetMode(Id, oneshot::Sender<Mode>),
@@ -111,7 +111,7 @@ pub enum Action {
GainFocus(Id),
/// Change the window [`Level`].
- ChangeLevel(Id, Level),
+ SetLevel(Id, Level),
/// Show the system menu at cursor position.
///
@@ -136,7 +136,7 @@ pub enum Action {
///
/// - **X11:** Has no universal guidelines for icon sizes, so you're at the whims of the WM. That
/// said, it's usually in the same ballpark as on Windows.
- ChangeIcon(Id, Icon),
+ SetIcon(Id, Icon),
/// Runs the closure with the native window handle of the window with the given [`Id`].
RunWithHandle(Id, Box<dyn FnOnce(WindowHandle<'_>) + Send>),
@@ -155,6 +155,18 @@ pub enum Action {
/// This enables mouse events for the window and stops mouse events
/// from being passed to whatever is underneath.
DisableMousePassthrough(Id),
+
+ /// Set the minimum inner window size.
+ SetMinSize(Id, Option<Size>),
+
+ /// Set the maximum inner window size.
+ SetMaxSize(Id, Option<Size>),
+
+ /// Set the window to be resizable or not.
+ SetResizable(Id, bool),
+
+ /// Set the window size increment.
+ SetResizeIncrements(Id, Option<Size>),
}
/// Subscribes to the frames of the window of the running application.
@@ -265,6 +277,30 @@ pub fn resize<T>(id: Id, new_size: Size) -> Task<T> {
task::effect(crate::Action::Window(Action::Resize(id, new_size)))
}
+/// Set the window to be resizable or not.
+pub fn set_resizable<T>(id: Id, resizable: bool) -> Task<T> {
+ task::effect(crate::Action::Window(Action::SetResizable(id, resizable)))
+}
+
+/// Set the inner maximum size of the window.
+pub fn set_max_size<T>(id: Id, size: Option<Size>) -> Task<T> {
+ task::effect(crate::Action::Window(Action::SetMaxSize(id, size)))
+}
+
+/// Set the inner minimum size of the window.
+pub fn set_min_size<T>(id: Id, size: Option<Size>) -> Task<T> {
+ task::effect(crate::Action::Window(Action::SetMinSize(id, size)))
+}
+
+/// Set the window size increment.
+///
+/// This is usually used by apps such as terminal emulators that need "blocky" resizing.
+pub fn set_resize_increments<T>(id: Id, increments: Option<Size>) -> Task<T> {
+ task::effect(crate::Action::Window(Action::SetResizeIncrements(
+ id, increments,
+ )))
+}
+
/// Get the window's size in logical dimensions.
pub fn get_size(id: Id) -> Task<Size> {
task::oneshot(move |channel| {
@@ -315,11 +351,6 @@ pub fn move_to<T>(id: Id, position: Point) -> Task<T> {
task::effect(crate::Action::Window(Action::Move(id, position)))
}
-/// Changes the [`Mode`] of the window.
-pub fn change_mode<T>(id: Id, mode: Mode) -> Task<T> {
- task::effect(crate::Action::Window(Action::ChangeMode(id, mode)))
-}
-
/// Gets the current [`Mode`] of the window.
pub fn get_mode(id: Id) -> Task<Mode> {
task::oneshot(move |channel| {
@@ -327,6 +358,11 @@ pub fn get_mode(id: Id) -> Task<Mode> {
})
}
+/// Changes the [`Mode`] of the window.
+pub fn set_mode<T>(id: Id, mode: Mode) -> Task<T> {
+ task::effect(crate::Action::Window(Action::SetMode(id, mode)))
+}
+
/// Toggles the window to maximized or back.
pub fn toggle_maximize<T>(id: Id) -> Task<T> {
task::effect(crate::Action::Window(Action::ToggleMaximize(id)))
@@ -364,8 +400,8 @@ pub fn gain_focus<T>(id: Id) -> Task<T> {
}
/// Changes the window [`Level`].
-pub fn change_level<T>(id: Id, level: Level) -> Task<T> {
- task::effect(crate::Action::Window(Action::ChangeLevel(id, level)))
+pub fn set_level<T>(id: Id, level: Level) -> Task<T> {
+ task::effect(crate::Action::Window(Action::SetLevel(id, level)))
}
/// Show the [system menu] at cursor position.
@@ -384,8 +420,8 @@ pub fn get_raw_id<Message>(id: Id) -> Task<u64> {
}
/// Changes the [`Icon`] of the window.
-pub fn change_icon<T>(id: Id, icon: Icon) -> Task<T> {
- task::effect(crate::Action::Window(Action::ChangeIcon(id, icon)))
+pub fn set_icon<T>(id: Id, icon: Icon) -> Task<T> {
+ task::effect(crate::Action::Window(Action::SetIcon(id, icon)))
}
/// Runs the given callback with the native window handle for the window with the given id.
diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml
index a8ebf3aa..4b6b0483 100644
--- a/wgpu/Cargo.toml
+++ b/wgpu/Cargo.toml
@@ -35,7 +35,6 @@ glam.workspace = true
glyphon.workspace = true
guillotiere.workspace = true
log.workspace = true
-once_cell.workspace = true
rustc-hash.workspace = true
thiserror.workspace = true
wgpu.workspace = true
diff --git a/widget/Cargo.toml b/widget/Cargo.toml
index 98a81145..e19cad08 100644
--- a/widget/Cargo.toml
+++ b/widget/Cargo.toml
@@ -33,7 +33,6 @@ iced_renderer.workspace = true
iced_runtime.workspace = true
num-traits.workspace = true
-once_cell.workspace = true
rustc-hash.workspace = true
thiserror.workspace = true
unicode-segmentation.workspace = true
diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs
index cdfd2daf..5a0f8107 100644
--- a/widget/src/helpers.rs
+++ b/widget/src/helpers.rs
@@ -1708,9 +1708,9 @@ where
{
use crate::core::{Alignment, Font};
use crate::svg;
- use once_cell::sync::Lazy;
+ use std::sync::LazyLock;
- static LOGO: Lazy<svg::Handle> = Lazy::new(|| {
+ static LOGO: LazyLock<svg::Handle> = LazyLock::new(|| {
svg::Handle::from_memory(include_bytes!("../assets/iced-logo.svg"))
});
diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs
index 8e6f7aae..01c6abc8 100644
--- a/winit/src/conversion.rs
+++ b/winit/src/conversion.rs
@@ -23,6 +23,12 @@ pub fn window_attributes(
width: settings.size.width,
height: settings.size.height,
})
+ .with_maximized(settings.maximized)
+ .with_fullscreen(
+ settings
+ .fullscreen
+ .then_some(winit::window::Fullscreen::Borderless(None)),
+ )
.with_resizable(settings.resizable)
.with_enabled_buttons(if settings.resizable {
winit::window::WindowButtons::all()
diff --git a/winit/src/program.rs b/winit/src/program.rs
index 0f1ea042..dddaf33d 100644
--- a/winit/src/program.rs
+++ b/winit/src/program.rs
@@ -1275,6 +1275,41 @@ fn run_action<P, C>(
);
}
}
+ window::Action::SetMinSize(id, size) => {
+ if let Some(window) = window_manager.get_mut(id) {
+ window.raw.set_min_inner_size(size.map(|size| {
+ winit::dpi::LogicalSize {
+ width: size.width,
+ height: size.height,
+ }
+ }));
+ }
+ }
+ window::Action::SetMaxSize(id, size) => {
+ if let Some(window) = window_manager.get_mut(id) {
+ window.raw.set_max_inner_size(size.map(|size| {
+ winit::dpi::LogicalSize {
+ width: size.width,
+ height: size.height,
+ }
+ }));
+ }
+ }
+ window::Action::SetResizeIncrements(id, increments) => {
+ if let Some(window) = window_manager.get_mut(id) {
+ window.raw.set_resize_increments(increments.map(|size| {
+ winit::dpi::LogicalSize {
+ width: size.width,
+ height: size.height,
+ }
+ }));
+ }
+ }
+ window::Action::SetResizable(id, resizable) => {
+ if let Some(window) = window_manager.get_mut(id) {
+ window.raw.set_resizable(resizable);
+ }
+ }
window::Action::GetSize(id, channel) => {
if let Some(window) = window_manager.get_mut(id) {
let size = window
@@ -1338,7 +1373,7 @@ fn run_action<P, C>(
);
}
}
- window::Action::ChangeMode(id, mode) => {
+ window::Action::SetMode(id, mode) => {
if let Some(window) = window_manager.get_mut(id) {
window.raw.set_visible(conversion::visible(mode));
window.raw.set_fullscreen(conversion::fullscreen(
@@ -1347,7 +1382,7 @@ fn run_action<P, C>(
));
}
}
- window::Action::ChangeIcon(id, icon) => {
+ window::Action::SetIcon(id, icon) => {
if let Some(window) = window_manager.get_mut(id) {
window.raw.set_window_icon(conversion::icon(icon));
}
@@ -1385,7 +1420,7 @@ fn run_action<P, C>(
window.raw.focus_window();
}
}
- window::Action::ChangeLevel(id, level) => {
+ window::Action::SetLevel(id, level) => {
if let Some(window) = window_manager.get_mut(id) {
window
.raw