summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuhang Zhao <[email protected]>2022-10-14 16:08:23 +0800
committerYuhang Zhao <[email protected]>2022-10-24 13:22:24 +0800
commitbea5649cd18b75a88aba235b5def55c422d9d1e7 (patch)
tree3b1861289e7e599d94a08f79289b1550fe3c8bb6
parent0ae36affedd553640a282086c1703de48b1b449e (diff)
Windows: bump NTDDI_VERSION to latest version and remove some duplicated code
We have NTDDI_WIN10_NI (0x0A00000C) in the Win11 SDK (10.0.22621) so bump the value in Qt (currently 0x0A00000B) to it. And when searching for _WIN32_WINNT/WINVER/NTDDI_VERSION throughout the whole qtbase codebase, I found some duplicated code, mostly leftovers from the legacy time. Replace them with our own windows header can achieve the same effect: we have defined all the necessary macros to unblock the latest features. And place the header at the top most place to include the macros as early as possible. Change-Id: I37d9ac40ca9748208c7b2e89f374eda362dbefd6 Reviewed-by: Oliver Wolff <[email protected]>
-rw-r--r--src/corelib/global/qt_windows.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowssystemtrayicon.cpp9
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp4
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp3
7 files changed, 5 insertions, 27 deletions
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 17ed094c1d6..5586d0b9272 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -19,7 +19,7 @@
# define _WIN32_IE 0x0A00
#endif
#ifndef NTDDI_VERSION
-# define NTDDI_VERSION 0x0A00000B // NTDDI_WIN10_CO
+# define NTDDI_VERSION 0x0A00000C // NTDDI_WIN10_NI
#endif
#ifndef NOMINMAX
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 488020ec0c4..c81e53e7abb 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -3,10 +3,6 @@
#define QT_NO_URL_CAST_FROM_STRING 1
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0A00
-#endif
-
#include <QtCore/qt_windows.h>
#include "qwindowscombase.h"
#include "qwindowsdialoghelpers.h"
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index 488d5f89b55..89f236b8eef 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -1,9 +1,7 @@
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef WINVER
-# define WINVER 0x0A00 // Enable pointer functions for MinGW
-#endif
+#include <QtCore/qt_windows.h>
#include "qwindowspointerhandler.h"
#include "qwindowsmousehandler.h"
diff --git a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
index cf150b5772a..3903b8462ba 100644
--- a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
+++ b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
@@ -1,13 +1,7 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef WINVER
-# define WINVER 0x0A00 // required for NOTIFYICONDATA_V2_SIZE, ChangeWindowMessageFilterEx() (MinGW 5.3)
-#endif
-
-#ifndef NTDDI_VERSION
-# define NTDDI_VERSION 0x0A00000B // required for Shell_NotifyIconGetRect (MinGW 5.3)
-#endif
+#include <QtCore/qt_windows.h>
#include "qwindowssystemtrayicon.h"
#include "qwindowscontext.h"
@@ -23,7 +17,6 @@
#include <QtCore/qsettings.h>
#include <qpa/qwindowsysteminterface.h>
-#include <qt_windows.h>
#include <commctrl.h>
#include <shellapi.h>
#include <shlobj.h>
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index eeb4ac40678..07485cc7951 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -1,10 +1,7 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-// SHSTOCKICONINFO is only available since Vista
-#ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0A00
-#endif
+#include <QtCore/qt_windows.h>
#include "qwindowstheme.h"
#include "qwindowsmenu.h"
@@ -15,7 +12,6 @@
# include "qwindowssystemtrayicon.h"
#endif
#include "qwindowsscreen.h"
-#include "qt_windows.h"
#include <commctrl.h>
#include <objbase.h>
#ifndef Q_CC_MINGW
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 468b028b8b6..241579d9f93 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1,9 +1,7 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef WINVER
-# define WINVER 0x0A00 // Enable touch functions for MinGW
-#endif
+#include <QtCore/qt_windows.h>
#include "qwindowswindow.h"
#include "qwindowscontext.h"
diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
index c4d4265d4fc..7ebe880ab13 100644
--- a/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
+++ b/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
@@ -51,9 +51,6 @@ void NativeMutexUnlock(NativeMutexType *mutex)
}
#endif
#elif defined(Q_OS_WIN)
-# if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0A00
-# endif
# include <qt_windows.h>
typedef CRITICAL_SECTION NativeMutexType;
void NativeMutexInitialize(NativeMutexType *mutex)