fix: Use globals instead of thread-locals
Better support for multi-threaded applications, especially cosmic-comp rendering in parallel on multiple threads, each potentially accessing global configurations such as the active theme, icon_theme and more...
This commit is contained in:
parent
f655710d55
commit
b40839638a
16 changed files with 183 additions and 216 deletions
|
|
@ -48,7 +48,6 @@ pub mod message {
|
|||
pub use self::command::Command;
|
||||
pub use self::core::Core;
|
||||
pub use self::settings::Settings;
|
||||
use crate::config::CosmicTk;
|
||||
use crate::prelude::*;
|
||||
use crate::theme::THEME;
|
||||
use crate::widget::{context_drawer, id_container, menu, nav_bar, popover};
|
||||
|
|
@ -58,7 +57,6 @@ use iced::Subscription;
|
|||
use iced::{multi_window::Application as IcedApplication, window};
|
||||
#[cfg(any(not(feature = "winit"), not(feature = "multi-window")))]
|
||||
use iced::{window, Application as IcedApplication};
|
||||
use iced_core::mouse;
|
||||
pub use message::Message;
|
||||
use url::Url;
|
||||
#[cfg(feature = "single-instance")]
|
||||
|
|
@ -87,10 +85,7 @@ pub(crate) fn iced_settings<App: Application>(
|
|||
crate::icon_theme::set_default(crate::config::icon_theme());
|
||||
}
|
||||
|
||||
THEME.with(move |t| {
|
||||
let mut cosmic_theme = t.borrow_mut();
|
||||
cosmic_theme.set_theme(settings.theme.theme_type);
|
||||
});
|
||||
THEME.lock().unwrap().set_theme(settings.theme.theme_type);
|
||||
|
||||
let mut iced = iced::Settings::with_flags((core, flags));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue