diff --git a/Telegram/SourceFiles/platform/win/main_window_win.cpp b/Telegram/SourceFiles/platform/win/main_window_win.cpp index d74481ef6..c3bc6d4e2 100644 --- a/Telegram/SourceFiles/platform/win/main_window_win.cpp +++ b/Telegram/SourceFiles/platform/win/main_window_win.cpp @@ -646,10 +646,7 @@ int32 MainWindow::screenNameChecksum(const QString &name) const { } void MainWindow::psRefreshTaskbarIcon() { - auto refresher = object_ptr(this); - auto guard = gsl::finally([&refresher] { - refresher.destroy(); - }); + auto refresher = std::unique_ptr(this); refresher->setWindowFlags(static_cast(Qt::Tool) | Qt::FramelessWindowHint); refresher->setGeometry(x() + 1, y() + 1, 1, 1); auto palette = refresher->palette(); diff --git a/Telegram/SourceFiles/ui/twidget.cpp b/Telegram/SourceFiles/ui/twidget.cpp index 0f610cb8a..71f318229 100644 --- a/Telegram/SourceFiles/ui/twidget.cpp +++ b/Telegram/SourceFiles/ui/twidget.cpp @@ -215,6 +215,12 @@ QImage GrabWidgetToImage(not_null target, QRect rect, QColor bg) { return result; } +void ForceFullRepaint(not_null widget) { + const auto refresher = std::make_unique(widget); + refresher->setGeometry(widget->rect()); + refresher->show(); +} + } // namespace Ui void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) { diff --git a/Telegram/SourceFiles/ui/twidget.h b/Telegram/SourceFiles/ui/twidget.h index 22083be4d..f946ba7e7 100644 --- a/Telegram/SourceFiles/ui/twidget.h +++ b/Telegram/SourceFiles/ui/twidget.h @@ -57,6 +57,8 @@ QImage GrabWidgetToImage( QRect rect = QRect(), QColor bg = QColor(255, 255, 255, 0)); +void ForceFullRepaint(not_null widget); + } // namespace Ui enum class RectPart { diff --git a/Telegram/SourceFiles/ui/widgets/separate_panel.cpp b/Telegram/SourceFiles/ui/widgets/separate_panel.cpp index cbcbeb0b3..4a18632c5 100644 --- a/Telegram/SourceFiles/ui/widgets/separate_panel.cpp +++ b/Telegram/SourceFiles/ui/widgets/separate_panel.cpp @@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/toast/toast.h" #include "ui/widgets/tooltip.h" #include "window/layer_widget.h" +#include "window/themes/window_theme.h" #include "messenger.h" #include "styles/style_widgets.h" #include "styles/style_info.h" @@ -150,6 +151,13 @@ void SeparatePanel::initLayout() { setAttribute(Qt::WA_TranslucentBackground, true); createBorderImage(); + subscribe(Window::Theme::Background(), [=]( + const Window::Theme::BackgroundUpdate &update) { + if (update.paletteChanged()) { + createBorderImage(); + Ui::ForceFullRepaint(this); + } + }); Platform::InitOnTopPanel(this); } diff --git a/Telegram/SourceFiles/ui/widgets/separate_panel.h b/Telegram/SourceFiles/ui/widgets/separate_panel.h index 4dc21963f..77438d54b 100644 --- a/Telegram/SourceFiles/ui/widgets/separate_panel.h +++ b/Telegram/SourceFiles/ui/widgets/separate_panel.h @@ -23,7 +23,7 @@ class LayerStackWidget; namespace Ui { -class SeparatePanel : public Ui::RpWidget { +class SeparatePanel : public Ui::RpWidget, private base::Subscriber { public: SeparatePanel(); diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index cf6ecf3de..06fcb555b 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -60,9 +60,6 @@ MainWindow::MainWindow() , _titleText(qsl("Telegram")) { subscribe(Theme::Background(), [this](const Theme::BackgroundUpdate &data) { if (data.paletteChanged()) { - if (_title) { - _title->update(); - } updatePalette(); } }); @@ -242,6 +239,8 @@ void MainWindow::handleActiveChanged() { } void MainWindow::updatePalette() { + Ui::ForceFullRepaint(this); + auto p = palette(); p.setColor(QPalette::Window, st::windowBg->c); setPalette(p);