2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-10-07 13:26:47 +00:00

Update icons when icon theme on Linux changes

This commit is contained in:
Ilya Fedin
2023-05-27 12:35:17 +04:00
committed by John Preston
parent 6aef6d7f4e
commit 2ce9e610fa
4 changed files with 17 additions and 9 deletions

View File

@@ -179,6 +179,12 @@ MainWindow::MainWindow(not_null<Window::Controller*> controller)
}
void MainWindow::initHook() {
events() | rpl::start_with_next([=](not_null<QEvent*> e) {
if (e->type() == QEvent::ThemeChange) {
updateWindowIcon();
}
}, lifetime());
base::install_event_filter(windowHandle(), [=](not_null<QEvent*> e) {
if (e->type() == QEvent::Expose) {
auto ee = static_cast<QExposeEvent*>(e.get());
@@ -221,12 +227,7 @@ void MainWindow::updateWindowIcon() {
const auto session = sessionController()
? &sessionController()->session()
: nullptr;
const auto supportIcon = session && session->supportMode();
if (supportIcon != _usingSupportIcon || _icon.isNull()) {
_icon = Window::CreateIcon(session);
_usingSupportIcon = supportIcon;
}
setWindowIcon(_icon);
setWindowIcon(Window::CreateIcon(session));
}
void MainWindow::updateUnityCounter() {