summaryrefslogtreecommitdiffstats
path: root/winit
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--winit/Cargo.toml5
-rw-r--r--winit/src/application.rs12
-rw-r--r--winit/src/lib.rs8
-rw-r--r--winit/src/multi_window.rs23
4 files changed, 18 insertions, 30 deletions
diff --git a/winit/Cargo.toml b/winit/Cargo.toml
index 9d65cc1b..dccb7c07 100644
--- a/winit/Cargo.toml
+++ b/winit/Cargo.toml
@@ -10,6 +10,9 @@ homepage.workspace = true
categories.workspace = true
keywords.workspace = true
+[lints]
+workspace = true
+
[features]
default = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]
debug = ["iced_runtime/debug"]
@@ -26,6 +29,7 @@ iced_graphics.workspace = true
iced_runtime.workspace = true
log.workspace = true
+rustc-hash.workspace = true
thiserror.workspace = true
tracing.workspace = true
window_clipboard.workspace = true
@@ -40,3 +44,4 @@ winapi.workspace = true
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys.workspace = true
web-sys.features = ["Document", "Window"]
+
diff --git a/winit/src/application.rs b/winit/src/application.rs
index d68523fa..1ca80609 100644
--- a/winit/src/application.rs
+++ b/winit/src/application.rs
@@ -220,13 +220,11 @@ where
};
}
- let compositor = C::new(graphics_settings, window.clone()).await?;
- let mut renderer = compositor.create_renderer();
+ let mut compositor = C::new(graphics_settings, window.clone()).await?;
+ let renderer = compositor.create_renderer();
for font in settings.fonts {
- use crate::core::text::Renderer;
-
- renderer.load_font(font);
+ compositor.load_font(font);
}
let (mut event_sender, event_receiver) = mpsc::unbounded();
@@ -950,10 +948,8 @@ pub fn run_command<A, C, E>(
*cache = current_cache;
}
command::Action::LoadFont { bytes, tagger } => {
- use crate::core::text::Renderer;
-
// TODO: Error handling (?)
- renderer.load_font(bytes);
+ compositor.load_font(bytes);
proxy
.send_event(tagger(Ok(())))
diff --git a/winit/src/lib.rs b/winit/src/lib.rs
index 64912b3f..3619cde8 100644
--- a/winit/src/lib.rs
+++ b/winit/src/lib.rs
@@ -17,14 +17,6 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
-#![forbid(rust_2018_idioms)]
-#![deny(
- missing_debug_implementations,
- missing_docs,
- unused_results,
- unsafe_code,
- rustdoc::broken_intra_doc_links
-)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use iced_graphics as graphics;
pub use iced_runtime as runtime;
diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs
index b4c25411..3537ac18 100644
--- a/winit/src/multi_window.rs
+++ b/winit/src/multi_window.rs
@@ -27,7 +27,7 @@ use crate::{Clipboard, Error, Proxy, Settings};
pub use crate::application::{default, Appearance, DefaultStyle};
-use std::collections::HashMap;
+use rustc_hash::FxHashMap;
use std::mem::ManuallyDrop;
use std::sync::Arc;
use std::time::Instant;
@@ -381,12 +381,12 @@ async fn run_instance<A, E, C>(
)]
};
- let mut ui_caches = HashMap::new();
+ let mut ui_caches = FxHashMap::default();
let mut user_interfaces = ManuallyDrop::new(build_user_interfaces(
&application,
&mut debug,
&mut window_manager,
- HashMap::from_iter([(
+ FxHashMap::from_iter([(
window::Id::MAIN,
user_interface::Cache::default(),
)]),
@@ -759,7 +759,7 @@ async fn run_instance<A, E, C>(
// TODO mw application update returns which window IDs to update
if !messages.is_empty() || uis_stale {
- let mut cached_interfaces: HashMap<
+ let mut cached_interfaces: FxHashMap<
window::Id,
user_interface::Cache,
> = ManuallyDrop::into_inner(user_interfaces)
@@ -849,7 +849,7 @@ fn update<A: Application, C, E: Executor>(
debug: &mut Debug,
messages: &mut Vec<A::Message>,
window_manager: &mut WindowManager<A, C>,
- ui_caches: &mut HashMap<window::Id, user_interface::Cache>,
+ ui_caches: &mut FxHashMap<window::Id, user_interface::Cache>,
) where
C: Compositor<Renderer = A::Renderer> + 'static,
A::Theme: DefaultStyle,
@@ -890,7 +890,7 @@ fn run_command<A, C, E>(
proxy: &mut winit::event_loop::EventLoopProxy<A::Message>,
debug: &mut Debug,
window_manager: &mut WindowManager<A, C>,
- ui_caches: &mut HashMap<window::Id, user_interface::Cache>,
+ ui_caches: &mut FxHashMap<window::Id, user_interface::Cache>,
) where
A: Application,
E: Executor,
@@ -1194,13 +1194,8 @@ fn run_command<A, C, E>(
uis.drain().map(|(id, ui)| (id, ui.into_cache())).collect();
}
command::Action::LoadFont { bytes, tagger } => {
- use crate::core::text::Renderer;
-
- // TODO change this once we change each renderer to having a single backend reference.. :pain:
// TODO: Error handling (?)
- for (_, window) in window_manager.iter_mut() {
- window.renderer.load_font(bytes.clone());
- }
+ compositor.load_font(bytes.clone());
proxy
.send_event(tagger(Ok(())))
@@ -1218,8 +1213,8 @@ pub fn build_user_interfaces<'a, A: Application, C: Compositor>(
application: &'a A,
debug: &mut Debug,
window_manager: &mut WindowManager<A, C>,
- mut cached_user_interfaces: HashMap<window::Id, user_interface::Cache>,
-) -> HashMap<window::Id, UserInterface<'a, A::Message, A::Theme, A::Renderer>>
+ mut cached_user_interfaces: FxHashMap<window::Id, user_interface::Cache>,
+) -> FxHashMap<window::Id, UserInterface<'a, A::Message, A::Theme, A::Renderer>>
where
C: Compositor<Renderer = A::Renderer>,
A::Theme: DefaultStyle,