From 72f973774a3c0fe0cba7db318f680bb80efa6a5a Mon Sep 17 00:00:00 2001 From: Adam Lamar Date: Thu, 19 Dec 2024 15:54:50 -0700 Subject: [PATCH] Fixes for Qt 6.4.3 on Windows --- kiwix-desktop.pro | 4 ++++ src/kiwixapp.cpp | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/kiwix-desktop.pro b/kiwix-desktop.pro index 166f3125..c1f4f93e 100644 --- a/kiwix-desktop.pro +++ b/kiwix-desktop.pro @@ -9,6 +9,10 @@ QT += webenginewidgets webchannel QT += printsupport qtHaveModule(texttospeech): QT += texttospeech +win32 { + QT += gui-private +} + # Avoid stripping incompatible files, due to false identification as executables, on WSL DETECT_WSL = $$system(test -f /proc/sys/fs/binfmt_misc/WSLInterop && echo true || echo false) equals(DETECT_WSL , "true"): CONFIG += nostrip diff --git a/src/kiwixapp.cpp b/src/kiwixapp.cpp index f6bad350..c11dca15 100644 --- a/src/kiwixapp.cpp +++ b/src/kiwixapp.cpp @@ -15,8 +15,13 @@ #include #include #include -#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if defined(Q_OS_WIN) +#include +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include +#else +#include +#endif #endif const QString DEFAULT_SAVE_DIR = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); @@ -95,12 +100,14 @@ void KiwixApp::init() #ifdef Q_OS_WIN QWindow *window = mp_mainWindow->windowHandle(); if (window) { - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QWindowsWindowFunctions::setHasBorderInFullScreen(window, true); - #else - HWND handle = reinterpret_cast(window->winId()); - SetWindowLongPtr(handle, GWL_STYLE, GetWindowLongPtr(handle, GWL_STYLE) | WS_BORDER); - #endif +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QWindowsWindowFunctions::setHasBorderInFullScreen(window, true); +#else + auto nativeWindow = window->nativeInterface(); + if (nativeWindow) { + nativeWindow->setHasBorderInFullScreen(true); + } +#endif } #endif connect(this, &QtSingleApplication::messageReceived, this, [=](const QString &message) {