Rename cx.global_default_mut
to cx.global_default
This commit is contained in:
parent
4ca7ddfc42
commit
d6bd000aa8
14 changed files with 52 additions and 50 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -8080,6 +8080,7 @@ dependencies = [
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"strum",
|
"strum",
|
||||||
"theme",
|
"theme",
|
||||||
|
"theme2",
|
||||||
"ui2",
|
"ui2",
|
||||||
"util",
|
"util",
|
||||||
]
|
]
|
||||||
|
|
|
@ -379,7 +379,7 @@ impl settings2::Setting for TelemetrySettings {
|
||||||
fn load(
|
fn load(
|
||||||
default_value: &Self::FileContent,
|
default_value: &Self::FileContent,
|
||||||
user_values: &[&Self::FileContent],
|
user_values: &[&Self::FileContent],
|
||||||
_: &AppContext,
|
_: &mut AppContext,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
diagnostics: user_values.first().and_then(|v| v.diagnostics).unwrap_or(
|
diagnostics: user_values.first().and_then(|v| v.diagnostics).unwrap_or(
|
||||||
|
|
|
@ -52,13 +52,13 @@ pub trait FeatureFlagAppExt {
|
||||||
|
|
||||||
impl FeatureFlagAppExt for AppContext {
|
impl FeatureFlagAppExt for AppContext {
|
||||||
fn update_flags(&mut self, staff: bool, flags: Vec<String>) {
|
fn update_flags(&mut self, staff: bool, flags: Vec<String>) {
|
||||||
let feature_flags = self.default_global_mut::<FeatureFlags>();
|
let feature_flags = self.default_global::<FeatureFlags>();
|
||||||
feature_flags.staff = staff;
|
feature_flags.staff = staff;
|
||||||
feature_flags.flags = flags;
|
feature_flags.flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_staff(&mut self, staff: bool) {
|
fn set_staff(&mut self, staff: bool) {
|
||||||
let feature_flags = self.default_global_mut::<FeatureFlags>();
|
let feature_flags = self.default_global::<FeatureFlags>();
|
||||||
feature_flags.staff = staff;
|
feature_flags.staff = staff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -554,7 +554,7 @@ impl AppContext {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_global_mut<G: 'static + Default + Sync + Send>(&mut self) -> &mut G {
|
pub fn default_global<G: 'static + Default + Sync + Send>(&mut self) -> &mut G {
|
||||||
let global_type = TypeId::of::<G>();
|
let global_type = TypeId::of::<G>();
|
||||||
self.push_effect(Effect::NotifyGlobalObservers { global_type });
|
self.push_effect(Effect::NotifyGlobalObservers { global_type });
|
||||||
self.globals_by_type
|
self.globals_by_type
|
||||||
|
|
|
@ -764,7 +764,7 @@ pub struct GroupBounds(HashMap<SharedString, SmallVec<[Bounds<Pixels>; 1]>>);
|
||||||
|
|
||||||
impl GroupBounds {
|
impl GroupBounds {
|
||||||
pub fn get(name: &SharedString, cx: &mut AppContext) -> Option<Bounds<Pixels>> {
|
pub fn get(name: &SharedString, cx: &mut AppContext) -> Option<Bounds<Pixels>> {
|
||||||
cx.default_global_mut::<Self>()
|
cx.default_global::<Self>()
|
||||||
.0
|
.0
|
||||||
.get(name)
|
.get(name)
|
||||||
.and_then(|bounds_stack| bounds_stack.last())
|
.and_then(|bounds_stack| bounds_stack.last())
|
||||||
|
@ -772,7 +772,7 @@ impl GroupBounds {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn push(name: SharedString, bounds: Bounds<Pixels>, cx: &mut AppContext) {
|
pub fn push(name: SharedString, bounds: Bounds<Pixels>, cx: &mut AppContext) {
|
||||||
cx.default_global_mut::<Self>()
|
cx.default_global::<Self>()
|
||||||
.0
|
.0
|
||||||
.entry(name)
|
.entry(name)
|
||||||
.or_default()
|
.or_default()
|
||||||
|
@ -780,7 +780,7 @@ impl GroupBounds {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pop(name: &SharedString, cx: &mut AppContext) {
|
pub fn pop(name: &SharedString, cx: &mut AppContext) {
|
||||||
cx.default_global_mut::<Self>()
|
cx.default_global::<Self>()
|
||||||
.0
|
.0
|
||||||
.get_mut(name)
|
.get_mut(name)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -262,7 +262,7 @@ impl settings2::Setting for AllLanguageSettings {
|
||||||
fn load(
|
fn load(
|
||||||
default_value: &Self::FileContent,
|
default_value: &Self::FileContent,
|
||||||
user_settings: &[&Self::FileContent],
|
user_settings: &[&Self::FileContent],
|
||||||
_: &AppContext,
|
_: &mut AppContext,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
// A default is provided for all settings.
|
// A default is provided for all settings.
|
||||||
let mut defaults: LanguageSettings =
|
let mut defaults: LanguageSettings =
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl Setting for ProjectSettings {
|
||||||
fn load(
|
fn load(
|
||||||
default_value: &Self::FileContent,
|
default_value: &Self::FileContent,
|
||||||
user_values: &[&Self::FileContent],
|
user_values: &[&Self::FileContent],
|
||||||
_: &AppContext,
|
_: &mut AppContext,
|
||||||
) -> anyhow::Result<Self> {
|
) -> anyhow::Result<Self> {
|
||||||
Self::load_via_json_merge(default_value, user_values)
|
Self::load_via_json_merge(default_value, user_values)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub trait Setting: 'static + Send + Sync {
|
||||||
fn load(
|
fn load(
|
||||||
default_value: &Self::FileContent,
|
default_value: &Self::FileContent,
|
||||||
user_values: &[&Self::FileContent],
|
user_values: &[&Self::FileContent],
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<Self>
|
) -> Result<Self>
|
||||||
where
|
where
|
||||||
Self: Sized;
|
Self: Sized;
|
||||||
|
@ -121,7 +121,7 @@ trait AnySettingValue: 'static + Send + Sync {
|
||||||
&self,
|
&self,
|
||||||
default_value: &DeserializedSetting,
|
default_value: &DeserializedSetting,
|
||||||
custom: &[DeserializedSetting],
|
custom: &[DeserializedSetting],
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<Box<dyn Any>>;
|
) -> Result<Box<dyn Any>>;
|
||||||
fn value_for_path(&self, path: Option<(usize, &Path)>) -> &dyn Any;
|
fn value_for_path(&self, path: Option<(usize, &Path)>) -> &dyn Any;
|
||||||
fn set_global_value(&mut self, value: Box<dyn Any>);
|
fn set_global_value(&mut self, value: Box<dyn Any>);
|
||||||
|
@ -138,7 +138,7 @@ struct DeserializedSetting(Box<dyn Any>);
|
||||||
|
|
||||||
impl SettingsStore {
|
impl SettingsStore {
|
||||||
/// Add a new type of setting to the store.
|
/// Add a new type of setting to the store.
|
||||||
pub fn register_setting<T: Setting>(&mut self, cx: &AppContext) {
|
pub fn register_setting<T: Setting>(&mut self, cx: &mut AppContext) {
|
||||||
let setting_type_id = TypeId::of::<T>();
|
let setting_type_id = TypeId::of::<T>();
|
||||||
let entry = self.setting_values.entry(setting_type_id);
|
let entry = self.setting_values.entry(setting_type_id);
|
||||||
if matches!(entry, hash_map::Entry::Occupied(_)) {
|
if matches!(entry, hash_map::Entry::Occupied(_)) {
|
||||||
|
@ -205,7 +205,7 @@ impl SettingsStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub fn test(cx: &AppContext) -> Self {
|
pub fn test(cx: &mut AppContext) -> Self {
|
||||||
let mut this = Self::default();
|
let mut this = Self::default();
|
||||||
this.set_default_settings(&crate::test_settings(), cx)
|
this.set_default_settings(&crate::test_settings(), cx)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -220,7 +220,7 @@ impl SettingsStore {
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub fn update_user_settings<T: Setting>(
|
pub fn update_user_settings<T: Setting>(
|
||||||
&mut self,
|
&mut self,
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
update: impl FnOnce(&mut T::FileContent),
|
update: impl FnOnce(&mut T::FileContent),
|
||||||
) {
|
) {
|
||||||
let old_text = serde_json::to_string(&self.raw_user_settings).unwrap();
|
let old_text = serde_json::to_string(&self.raw_user_settings).unwrap();
|
||||||
|
@ -317,7 +317,7 @@ impl SettingsStore {
|
||||||
pub fn set_default_settings(
|
pub fn set_default_settings(
|
||||||
&mut self,
|
&mut self,
|
||||||
default_settings_content: &str,
|
default_settings_content: &str,
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let settings: serde_json::Value = parse_json_with_comments(default_settings_content)?;
|
let settings: serde_json::Value = parse_json_with_comments(default_settings_content)?;
|
||||||
if settings.is_object() {
|
if settings.is_object() {
|
||||||
|
@ -333,7 +333,7 @@ impl SettingsStore {
|
||||||
pub fn set_user_settings(
|
pub fn set_user_settings(
|
||||||
&mut self,
|
&mut self,
|
||||||
user_settings_content: &str,
|
user_settings_content: &str,
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let settings: serde_json::Value = parse_json_with_comments(user_settings_content)?;
|
let settings: serde_json::Value = parse_json_with_comments(user_settings_content)?;
|
||||||
if settings.is_object() {
|
if settings.is_object() {
|
||||||
|
@ -351,7 +351,7 @@ impl SettingsStore {
|
||||||
root_id: usize,
|
root_id: usize,
|
||||||
path: Arc<Path>,
|
path: Arc<Path>,
|
||||||
settings_content: Option<&str>,
|
settings_content: Option<&str>,
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if let Some(content) = settings_content {
|
if let Some(content) = settings_content {
|
||||||
self.raw_local_settings
|
self.raw_local_settings
|
||||||
|
@ -364,7 +364,7 @@ impl SettingsStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add or remove a set of local settings via a JSON string.
|
/// Add or remove a set of local settings via a JSON string.
|
||||||
pub fn clear_local_settings(&mut self, root_id: usize, cx: &AppContext) -> Result<()> {
|
pub fn clear_local_settings(&mut self, root_id: usize, cx: &mut AppContext) -> Result<()> {
|
||||||
self.raw_local_settings.retain(|k, _| k.0 != root_id);
|
self.raw_local_settings.retain(|k, _| k.0 != root_id);
|
||||||
self.recompute_values(Some((root_id, "".as_ref())), cx)?;
|
self.recompute_values(Some((root_id, "".as_ref())), cx)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -456,7 +456,7 @@ impl SettingsStore {
|
||||||
fn recompute_values(
|
fn recompute_values(
|
||||||
&mut self,
|
&mut self,
|
||||||
changed_local_path: Option<(usize, &Path)>,
|
changed_local_path: Option<(usize, &Path)>,
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// Reload the global and local values for every setting.
|
// Reload the global and local values for every setting.
|
||||||
let mut user_settings_stack = Vec::<DeserializedSetting>::new();
|
let mut user_settings_stack = Vec::<DeserializedSetting>::new();
|
||||||
|
@ -557,7 +557,7 @@ impl<T: Setting> AnySettingValue for SettingValue<T> {
|
||||||
&self,
|
&self,
|
||||||
default_value: &DeserializedSetting,
|
default_value: &DeserializedSetting,
|
||||||
user_values: &[DeserializedSetting],
|
user_values: &[DeserializedSetting],
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<Box<dyn Any>> {
|
) -> Result<Box<dyn Any>> {
|
||||||
let default_value = default_value.0.downcast_ref::<T::FileContent>().unwrap();
|
let default_value = default_value.0.downcast_ref::<T::FileContent>().unwrap();
|
||||||
let values: SmallVec<[&T::FileContent; 6]> = user_values
|
let values: SmallVec<[&T::FileContent; 6]> = user_values
|
||||||
|
|
|
@ -24,6 +24,7 @@ simplelog = "0.9"
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
strum = { version = "0.25.0", features = ["derive"] }
|
strum = { version = "0.25.0", features = ["derive"] }
|
||||||
theme = { path = "../theme" }
|
theme = { path = "../theme" }
|
||||||
|
theme2 = { path = "../theme2" }
|
||||||
ui = { package = "ui2", path = "../ui2", features = ["stories"] }
|
ui = { package = "ui2", path = "../ui2", features = ["stories"] }
|
||||||
util = { path = "../util" }
|
util = { path = "../util" }
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ fn main() {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
let story_selector = args.story.clone();
|
let story_selector = args.story.clone();
|
||||||
|
|
||||||
let theme_name = args.theme.unwrap_or("One Dark".to_string());
|
let theme_name = args.theme.unwrap_or("One Dark".to_string());
|
||||||
let theme = themes::load_theme(theme_name).unwrap();
|
let theme = themes::load_theme(theme_name).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ impl settings2::Setting for TerminalSettings {
|
||||||
fn load(
|
fn load(
|
||||||
default_value: &Self::FileContent,
|
default_value: &Self::FileContent,
|
||||||
user_values: &[&Self::FileContent],
|
user_values: &[&Self::FileContent],
|
||||||
_: &AppContext,
|
_: &mut AppContext,
|
||||||
) -> anyhow::Result<Self> {
|
) -> anyhow::Result<Self> {
|
||||||
Self::load_via_json_merge(default_value, user_values)
|
Self::load_via_json_merge(default_value, user_values)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,6 @@ pub struct ThemeRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ThemeRegistry {
|
impl ThemeRegistry {
|
||||||
pub fn new() -> Self {
|
|
||||||
let mut this = Self {
|
|
||||||
themes: HashMap::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
this.insert_themes([one_dark()]);
|
|
||||||
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
fn insert_themes(&mut self, themes: impl IntoIterator<Item = Theme>) {
|
fn insert_themes(&mut self, themes: impl IntoIterator<Item = Theme>) {
|
||||||
for theme in themes.into_iter() {
|
for theme in themes.into_iter() {
|
||||||
self.themes
|
self.themes
|
||||||
|
@ -33,11 +23,22 @@ impl ThemeRegistry {
|
||||||
self.themes.values().map(|theme| theme.metadata.clone())
|
self.themes.values().map(|theme| theme.metadata.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&self, name: impl Into<SharedString>) -> Result<Arc<Theme>> {
|
pub fn get(&self, name: &str) -> Result<Arc<Theme>> {
|
||||||
let name = name.into();
|
|
||||||
self.themes
|
self.themes
|
||||||
.get(&name)
|
.get(name)
|
||||||
.ok_or_else(|| anyhow!("theme not found: {}", name))
|
.ok_or_else(|| anyhow!("theme not found: {}", name))
|
||||||
.cloned()
|
.cloned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ThemeRegistry {
|
||||||
|
fn default() -> Self {
|
||||||
|
let mut this = Self {
|
||||||
|
themes: HashMap::default(),
|
||||||
|
};
|
||||||
|
|
||||||
|
this.insert_themes([one_dark()]);
|
||||||
|
|
||||||
|
this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl BufferLineHeight {
|
||||||
impl ThemeSettings {
|
impl ThemeSettings {
|
||||||
pub fn buffer_font_size(&self, cx: &mut AppContext) -> Pixels {
|
pub fn buffer_font_size(&self, cx: &mut AppContext) -> Pixels {
|
||||||
let font_size = *cx
|
let font_size = *cx
|
||||||
.default_global_mut::<AdjustedBufferFontSize>()
|
.default_global::<AdjustedBufferFontSize>()
|
||||||
.0
|
.0
|
||||||
.get_or_insert(self.buffer_font_size.into());
|
.get_or_insert(self.buffer_font_size.into());
|
||||||
font_size.max(MIN_FONT_SIZE)
|
font_size.max(MIN_FONT_SIZE)
|
||||||
|
@ -74,7 +74,7 @@ impl ThemeSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn adjusted_font_size(size: Pixels, cx: &mut AppContext) -> Pixels {
|
pub fn adjusted_font_size(size: Pixels, cx: &mut AppContext) -> Pixels {
|
||||||
if let Some(adjusted_size) = cx.default_global_mut::<AdjustedBufferFontSize>().0 {
|
if let Some(adjusted_size) = cx.default_global::<AdjustedBufferFontSize>().0 {
|
||||||
let buffer_font_size = settings2::get::<ThemeSettings>(cx).buffer_font_size;
|
let buffer_font_size = settings2::get::<ThemeSettings>(cx).buffer_font_size;
|
||||||
let delta = adjusted_size - buffer_font_size;
|
let delta = adjusted_size - buffer_font_size;
|
||||||
size + delta
|
size + delta
|
||||||
|
@ -87,7 +87,7 @@ pub fn adjusted_font_size(size: Pixels, cx: &mut AppContext) -> Pixels {
|
||||||
pub fn adjust_font_size(cx: &mut AppContext, f: fn(&mut Pixels)) {
|
pub fn adjust_font_size(cx: &mut AppContext, f: fn(&mut Pixels)) {
|
||||||
let buffer_font_size = settings2::get::<ThemeSettings>(cx).buffer_font_size;
|
let buffer_font_size = settings2::get::<ThemeSettings>(cx).buffer_font_size;
|
||||||
let adjusted_size = cx
|
let adjusted_size = cx
|
||||||
.default_global_mut::<AdjustedBufferFontSize>()
|
.default_global::<AdjustedBufferFontSize>()
|
||||||
.0
|
.0
|
||||||
.get_or_insert(buffer_font_size);
|
.get_or_insert(buffer_font_size);
|
||||||
f(adjusted_size);
|
f(adjusted_size);
|
||||||
|
@ -110,9 +110,9 @@ impl settings2::Setting for ThemeSettings {
|
||||||
fn load(
|
fn load(
|
||||||
defaults: &Self::FileContent,
|
defaults: &Self::FileContent,
|
||||||
user_values: &[&Self::FileContent],
|
user_values: &[&Self::FileContent],
|
||||||
cx: &AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let themes = cx.global::<Arc<ThemeRegistry>>();
|
let themes = cx.default_global::<Arc<ThemeRegistry>>();
|
||||||
|
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
buffer_font: Font {
|
buffer_font: Font {
|
||||||
|
@ -123,7 +123,7 @@ impl settings2::Setting for ThemeSettings {
|
||||||
},
|
},
|
||||||
buffer_font_size: defaults.buffer_font_size.unwrap().into(),
|
buffer_font_size: defaults.buffer_font_size.unwrap().into(),
|
||||||
buffer_line_height: defaults.buffer_line_height.unwrap(),
|
buffer_line_height: defaults.buffer_line_height.unwrap(),
|
||||||
theme: themes.get(defaults.theme.as_ref().unwrap().clone()).unwrap(),
|
theme: themes.get(defaults.theme.as_ref().unwrap()).unwrap(),
|
||||||
};
|
};
|
||||||
|
|
||||||
for value in user_values.into_iter().copied().cloned() {
|
for value in user_values.into_iter().copied().cloned() {
|
||||||
|
@ -135,7 +135,7 @@ impl settings2::Setting for ThemeSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(value) = &value.theme {
|
if let Some(value) = &value.theme {
|
||||||
if let Some(theme) = themes.get(value.clone()).log_err() {
|
if let Some(theme) = themes.get(value).log_err() {
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,9 +137,9 @@ where
|
||||||
E: Element,
|
E: Element,
|
||||||
F: FnOnce(&mut ViewContext<E::ViewState>) -> E,
|
F: FnOnce(&mut ViewContext<E::ViewState>) -> E,
|
||||||
{
|
{
|
||||||
cx.default_global_mut::<ThemeStack>().0.push(theme.clone());
|
cx.default_global::<ThemeStack>().0.push(theme.clone());
|
||||||
let child = build_child(cx);
|
let child = build_child(cx);
|
||||||
cx.default_global_mut::<ThemeStack>().0.pop();
|
cx.default_global::<ThemeStack>().0.pop();
|
||||||
Themed { theme, child }
|
Themed { theme, child }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,11 +178,11 @@ where
|
||||||
element_state: Option<Self::ElementState>,
|
element_state: Option<Self::ElementState>,
|
||||||
cx: &mut ViewContext<Self::ViewState>,
|
cx: &mut ViewContext<Self::ViewState>,
|
||||||
) -> Self::ElementState {
|
) -> Self::ElementState {
|
||||||
cx.default_global_mut::<ThemeStack>()
|
cx.default_global::<ThemeStack>()
|
||||||
.0
|
.0
|
||||||
.push(self.theme.clone());
|
.push(self.theme.clone());
|
||||||
let element_state = self.child.initialize(view_state, element_state, cx);
|
let element_state = self.child.initialize(view_state, element_state, cx);
|
||||||
cx.default_global_mut::<ThemeStack>().0.pop();
|
cx.default_global::<ThemeStack>().0.pop();
|
||||||
element_state
|
element_state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,11 +195,11 @@ where
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
cx.default_global_mut::<ThemeStack>()
|
cx.default_global::<ThemeStack>()
|
||||||
.0
|
.0
|
||||||
.push(self.theme.clone());
|
.push(self.theme.clone());
|
||||||
let layout_id = self.child.layout(view_state, element_state, cx);
|
let layout_id = self.child.layout(view_state, element_state, cx);
|
||||||
cx.default_global_mut::<ThemeStack>().0.pop();
|
cx.default_global::<ThemeStack>().0.pop();
|
||||||
layout_id
|
layout_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,11 +212,11 @@ where
|
||||||
) where
|
) where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
cx.default_global_mut::<ThemeStack>()
|
cx.default_global::<ThemeStack>()
|
||||||
.0
|
.0
|
||||||
.push(self.theme.clone());
|
.push(self.theme.clone());
|
||||||
self.child.paint(bounds, view_state, frame_state, cx);
|
self.child.paint(bounds, view_state, frame_state, cx);
|
||||||
cx.default_global_mut::<ThemeStack>().0.pop();
|
cx.default_global::<ThemeStack>().0.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue