fix(theme change): make sure that all theme variables are in sync after a change
This commit is contained in:
parent
c40eb87611
commit
1b988ed1e9
1 changed files with 8 additions and 4 deletions
|
|
@ -690,10 +690,11 @@ impl<T: Application> Cosmic<T> {
|
||||||
let mut cmds = vec![self.app.system_theme_mode_update(&keys, &mode)];
|
let mut cmds = vec![self.app.system_theme_mode_update(&keys, &mode)];
|
||||||
|
|
||||||
let core = self.app.core_mut();
|
let core = self.app.core_mut();
|
||||||
let prev_is_dark = core.system_is_dark();
|
|
||||||
core.system_theme_mode = mode;
|
core.system_theme_mode = mode;
|
||||||
let is_dark = core.system_is_dark();
|
let is_dark = core.system_is_dark();
|
||||||
let changed = prev_is_dark != is_dark;
|
let changed = core.system_theme_mode.is_dark != is_dark
|
||||||
|
|| core.portal_is_dark != Some(is_dark)
|
||||||
|
|| core.system_theme.cosmic().is_dark != is_dark;
|
||||||
if changed {
|
if changed {
|
||||||
core.theme_sub_counter += 1;
|
core.theme_sub_counter += 1;
|
||||||
let mut new_theme = if is_dark {
|
let mut new_theme = if is_dark {
|
||||||
|
|
@ -784,10 +785,13 @@ impl<T: Application> Cosmic<T> {
|
||||||
ColorScheme::PreferLight => Some(false),
|
ColorScheme::PreferLight => Some(false),
|
||||||
};
|
};
|
||||||
let core = self.app.core_mut();
|
let core = self.app.core_mut();
|
||||||
let prev_is_dark = core.system_is_dark();
|
|
||||||
core.portal_is_dark = is_dark;
|
core.portal_is_dark = is_dark;
|
||||||
let is_dark = core.system_is_dark();
|
let is_dark = core.system_is_dark();
|
||||||
let changed = prev_is_dark != is_dark;
|
let changed = core.system_theme_mode.is_dark != is_dark
|
||||||
|
|| core.portal_is_dark != Some(is_dark)
|
||||||
|
|| core.system_theme.cosmic().is_dark != is_dark;
|
||||||
|
|
||||||
if changed {
|
if changed {
|
||||||
core.theme_sub_counter += 1;
|
core.theme_sub_counter += 1;
|
||||||
let new_theme = if is_dark {
|
let new_theme = if is_dark {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue