Fix overlay counter on taskbar when native decorations are enabled (#47)

This commit is contained in:
ilya-fedin 2020-05-18 12:54:38 +04:00 committed by GitHub
parent 8ce21aa87f
commit 7de92734cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View file

@ -633,20 +633,19 @@ UINT MainWindow::_taskbarCreatedMsgId = 0;
MainWindow::MainWindow(not_null<Window::Controller*> controller) MainWindow::MainWindow(not_null<Window::Controller*> controller)
: Window::MainWindow(controller) : Window::MainWindow(controller)
, ps_tbHider_hWnd(createTaskbarHider()) { , ps_tbHider_hWnd(createTaskbarHider()) {
if (!UseNativeDecorations()) { QCoreApplication::instance()->installNativeEventFilter(
QCoreApplication::instance()->installNativeEventFilter( EventFilter::CreateInstance(this));
EventFilter::CreateInstance(this));
if (!_taskbarCreatedMsgId) {
_taskbarCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated");
}
if (!UseNativeDecorations()) {
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) { if (update.paletteChanged()) {
_psShadowWindows.setColor(st::windowShadowFg->c); _psShadowWindows.setColor(st::windowShadowFg->c);
} }
}); });
} }
if (!_taskbarCreatedMsgId) {
_taskbarCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated");
}
} }
void MainWindow::TaskbarCreated() { void MainWindow::TaskbarCreated() {
@ -1008,9 +1007,7 @@ MainWindow::~MainWindow() {
} }
if (ps_tbHider_hWnd) DestroyWindow(ps_tbHider_hWnd); if (ps_tbHider_hWnd) DestroyWindow(ps_tbHider_hWnd);
if (!UseNativeDecorations()) { EventFilter::Destroy();
EventFilter::Destroy();
}
} }
} // namespace Platform } // namespace Platform

View file

@ -92,6 +92,10 @@ bool EventFilter::mainWindowEvent(
} }
} }
if (UseNativeDecorations()) {
return false;
}
switch (msg) { switch (msg) {
case WM_TIMECHANGE: { case WM_TIMECHANGE: {