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 <oliver.wolff@qt.io>
This commit is contained in:
Yuhang Zhao 2022-10-14 16:08:23 +08:00
parent 0ae36affed
commit bea5649cd1
7 changed files with 5 additions and 27 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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>

View File

@ -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

View File

@ -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"

View File

@ -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)