Allow manual style::complex_color refresh.

This commit is contained in:
John Preston 2021-10-22 18:33:00 +04:00
parent 48ebd65323
commit fb812fd748
3 changed files with 5 additions and 2 deletions

View file

@ -952,7 +952,7 @@ void prepareRound(
auto cornerHeight = cornerMasks[0].height(); auto cornerHeight = cornerMasks[0].height();
auto targetWidth = target.width(); auto targetWidth = target.width();
auto targetHeight = target.height(); auto targetHeight = target.height();
if (targetWidth < 2 * cornerWidth || targetHeight < 2 * cornerHeight) { if (targetWidth < cornerWidth || targetHeight < cornerHeight) {
return; return;
} }

View file

@ -31,7 +31,7 @@ void ColorData::set(uchar r, uchar g, uchar b, uchar a) {
void ComplexColor::subscribeToPaletteChanges() { void ComplexColor::subscribeToPaletteChanges() {
style::PaletteChanged( style::PaletteChanged(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
_owned.update(_generator()); refresh();
}, _lifetime); }, _lifetime);
} }

View file

@ -145,6 +145,9 @@ public:
[[nodiscard]] const Color &color() const { [[nodiscard]] const Color &color() const {
return _owned.color(); return _owned.color();
} }
void refresh() {
_owned.update(_generator());
}
private: private:
void subscribeToPaletteChanges(); void subscribeToPaletteChanges();