From 59a7b94ef4bb4d4cf6597d53bdacccbf5720e694 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 5 Dec 2022 16:17:31 +0400 Subject: [PATCH] Track palette version. --- ui/style/style_core.cpp | 6 ++++++ ui/style/style_core.h | 1 + 2 files changed, 7 insertions(+) diff --git a/ui/style/style_core.cpp b/ui/style/style_core.cpp index 48d1dd4..5764612 100644 --- a/ui/style/style_core.cpp +++ b/ui/style/style_core.cpp @@ -25,6 +25,7 @@ constexpr auto kMinContrastDistance = 64 * 64 * 4; constexpr auto kContrastDeltaL = 64; auto PaletteChanges = rpl::event_stream<>(); +auto PaletteVersion = 0; auto ShortAnimationRunning = rpl::variable(false); auto RunningShortAnimations = 0; @@ -73,7 +74,12 @@ rpl::producer<> PaletteChanged() { return internal::PaletteChanges.events(); } +int PaletteVersion() { + return internal::PaletteVersion; +} + void NotifyPaletteChanged() { + ++internal::PaletteVersion; internal::PaletteChanges.fire({}); } diff --git a/ui/style/style_core.h b/ui/style/style_core.h index cd9324f..035c20f 100644 --- a/ui/style/style_core.h +++ b/ui/style/style_core.h @@ -39,6 +39,7 @@ void startManager(int scale); void stopManager(); [[nodiscard]] rpl::producer<> PaletteChanged(); +[[nodiscard]] int PaletteVersion(); void NotifyPaletteChanged(); [[nodiscard]] rpl::producer ShortAnimationPlaying();