mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-12 01:39:40 +00:00
parent
1ee71bbd5c
commit
3b956c598b
@ -646,10 +646,7 @@ int32 MainWindow::screenNameChecksum(const QString &name) const {
|
||||
}
|
||||
|
||||
void MainWindow::psRefreshTaskbarIcon() {
|
||||
auto refresher = object_ptr<QWidget>(this);
|
||||
auto guard = gsl::finally([&refresher] {
|
||||
refresher.destroy();
|
||||
});
|
||||
auto refresher = std::unique_ptr<QWidget>(this);
|
||||
refresher->setWindowFlags(static_cast<Qt::WindowFlags>(Qt::Tool) | Qt::FramelessWindowHint);
|
||||
refresher->setGeometry(x() + 1, y() + 1, 1, 1);
|
||||
auto palette = refresher->palette();
|
||||
|
@ -215,6 +215,12 @@ QImage GrabWidgetToImage(not_null<QWidget*> target, QRect rect, QColor bg) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void ForceFullRepaint(not_null<QWidget*> widget) {
|
||||
const auto refresher = std::make_unique<QWidget>(widget);
|
||||
refresher->setGeometry(widget->rect());
|
||||
refresher->show();
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) {
|
||||
|
@ -57,6 +57,8 @@ QImage GrabWidgetToImage(
|
||||
QRect rect = QRect(),
|
||||
QColor bg = QColor(255, 255, 255, 0));
|
||||
|
||||
void ForceFullRepaint(not_null<QWidget*> widget);
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
enum class RectPart {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class LayerStackWidget;
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class SeparatePanel : public Ui::RpWidget {
|
||||
class SeparatePanel : public Ui::RpWidget, private base::Subscriber {
|
||||
public:
|
||||
SeparatePanel();
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user