From f852813734124e65b1c13b23e9deb29752d9c39b Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 24 Jul 2018 22:49:37 +0300 Subject: [PATCH] Improved night mode switching. --- Telegram/SourceFiles/window/themes/window_theme.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index 813f6c4c58..18894dad4c 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -778,13 +778,9 @@ void ChatBackground::toggleNightMode() { // Theme editor could have already reverted the testing of this toggle. if (AreTestingTheme()) { _nightMode = newNightMode; - if (oldNightMode) { - _tileDayValue = _tileNightValue; - _tileNightValue = oldTileValue; - } else { - _tileNightValue = _tileDayValue; - _tileDayValue = oldTileValue; - } + + // Restore the value, it was set inside theme testing. + (oldNightMode ? _tileNightValue : _tileDayValue) = oldTileValue; // We don't call full KeepApplied() here, because // we don't need to write theme or overwrite current background.