From a59bfdb2f8d20b9d4a73c8217c6d954cfdefc5d1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 27 Jun 2021 19:09:02 +0400 Subject: [PATCH] Fix handleNativeSurfaceChanged when dbus integration is disabled --- .../platform/linux/main_window_linux.cpp | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 9c86af83f..4d7bc96bb 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -558,6 +558,27 @@ MainWindow::MainWindow(not_null controller) } void MainWindow::initHook() { + base::install_event_filter(windowHandle(), [=](not_null e) { + if (e->type() == QEvent::Expose) { + auto ee = static_cast(e.get()); + if (ee->region().isNull()) { + return base::EventFilterResult::Continue; + } + if (!windowHandle() + || windowHandle()->parent() + || !windowHandle()->isVisible()) { + return base::EventFilterResult::Continue; + } + handleNativeSurfaceChanged(true); + } else if (e->type() == QEvent::Hide) { + if (!windowHandle() || windowHandle()->parent()) { + return base::EventFilterResult::Continue; + } + handleNativeSurfaceChanged(false); + } + return base::EventFilterResult::Continue; + }); + #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION _sniAvailable = IsSNIAvailable(); @@ -601,27 +622,6 @@ void MainWindow::initHook() { } catch (...) { } - base::install_event_filter(windowHandle(), [=](not_null e) { - if (e->type() == QEvent::Expose) { - auto ee = static_cast(e.get()); - if (ee->region().isNull()) { - return base::EventFilterResult::Continue; - } - if (!windowHandle() - || windowHandle()->parent() - || !windowHandle()->isVisible()) { - return base::EventFilterResult::Continue; - } - handleNativeSurfaceChanged(true); - } else if (e->type() == QEvent::Hide) { - if (!windowHandle() || windowHandle()->parent()) { - return base::EventFilterResult::Continue; - } - handleNativeSurfaceChanged(false); - } - return base::EventFilterResult::Continue; - }); - if (UseUnityCounter()) { LOG(("Using Unity launcher counter.")); } else {