diff --git a/src/librssguard/CMakeLists.txt b/src/librssguard/CMakeLists.txt index 410735201..c2dc72eae 100644 --- a/src/librssguard/CMakeLists.txt +++ b/src/librssguard/CMakeLists.txt @@ -654,6 +654,12 @@ if(QT_VERSION_MAJOR EQUAL 6) ) endif() +if(WIN32) + target_link_libraries(rssguard PUBLIC + Qt${QT_VERSION_MAJOR}::GuiPrivate + ) +endif() + if(USE_WEBENGINE) target_link_libraries(rssguard PUBLIC Qt${QT_VERSION_MAJOR}::WebEngineWidgets diff --git a/src/librssguard/miscellaneous/application.cpp b/src/librssguard/miscellaneous/application.cpp index 1a6d759ba..7d28703aa 100644 --- a/src/librssguard/miscellaneous/application.cpp +++ b/src/librssguard/miscellaneous/application.cpp @@ -54,6 +54,15 @@ #endif #endif +#if defined(Q_OS_WIN) +#if QT_VERSION_MAJOR == 5 +#include +#else +#include +#include +#endif +#endif + #if defined(Q_OS_WIN) #include @@ -623,13 +632,25 @@ void Application::showTrayIcon() { if (SystemTrayIcon::isSystemTrayAreaAvailable()) { qWarningNN << LOGSEC_GUI << "Tray icon is available, showing now."; trayIcon()->show(); - - offerChanges(); - offerPolls(); } else { m_feedReader->feedsModel()->notifyWithCounts(); } + + // NOTE: Below things have to be performed after tray icon is (if enabled) + // initialized. + offerChanges(); + offerPolls(); + +#if defined(Q_OS_WIN) +#if QT_VERSION_MAJOR == 6 + // NOTE: Fixes https://github.com/martinrotter/rssguard/issues/953 for Qt 6. + using QWindowsWindow = QNativeInterface::Private::QWindowsWindow; + if (auto w_w = qApp->mainForm()->windowHandle()->nativeInterface()) { + w_w->setHasBorderInFullScreen(true); + } +#endif +#endif }); } else { diff --git a/src/rssguard/CMakeLists.txt b/src/rssguard/CMakeLists.txt index 7a0383823..7af935acd 100644 --- a/src/rssguard/CMakeLists.txt +++ b/src/rssguard/CMakeLists.txt @@ -28,12 +28,6 @@ if(QT_VERSION_MAJOR EQUAL 6) target_link_libraries(app PUBLIC Qt${QT_VERSION_MAJOR}::Core5Compat ) - - if(WIN32) - target_link_libraries(app PUBLIC - Qt${QT_VERSION_MAJOR}::GuiPrivate - ) - endif() endif() if(APPLE) diff --git a/src/rssguard/main.cpp b/src/rssguard/main.cpp index 620b20450..907c18558 100644 --- a/src/rssguard/main.cpp +++ b/src/rssguard/main.cpp @@ -13,7 +13,6 @@ #include #else #include -#include #endif #endif @@ -118,15 +117,5 @@ int main(int argc, char* argv[]) { qApp ->parseCmdArgumentsFromOtherInstance(qApp->cmdParser()->positionalArguments().join(QSL(ARGUMENTS_LIST_SEPARATOR))); -#if defined(Q_OS_WIN) -#if QT_VERSION_MAJOR == 6 - // NOTE: Fixes https://github.com/martinrotter/rssguard/issues/953 for Qt 6. - using QWindowsWindow = QNativeInterface::Private::QWindowsWindow; - if (auto w_w = main_window.windowHandle()->nativeInterface()) { - w_w->setHasBorderInFullScreen(true); - } -#endif -#endif - return Application::exec(); }