From 5f5c342924a0d9a2856b2f2d6db373e25723f2b0 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Mon, 2 Nov 2020 07:00:18 +0100 Subject: Remove Windows 7, 8, and 8.1 codepaths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pick-to: 6.2 Task-number: QTBUG-84432 Change-Id: I970d7d7e9ebdcf246a5be32d60066b4e5e948c27 Reviewed-by: MÃ¥rten Nordheim --- src/corelib/global/qoperatingsystemversion_win.cpp | 16 ++----------- src/gui/rhi/qrhid3d11.cpp | 20 ++++++++-------- src/plugins/platforms/windows/qwindowscontext.cpp | 27 ++++++++-------------- .../styles/windowsvista/qwindowsvistastyle.cpp | 15 ------------ src/widgets/dialogs/qwizard_win.cpp | 4 +--- 5 files changed, 22 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qoperatingsystemversion_win.cpp b/src/corelib/global/qoperatingsystemversion_win.cpp index eb58b60788..c514aaf54d 100644 --- a/src/corelib/global/qoperatingsystemversion_win.cpp +++ b/src/corelib/global/qoperatingsystemversion_win.cpp @@ -90,25 +90,13 @@ OSVERSIONINFOEX qWindowsVersionInfo() result.wServicePackMinor = 0; const QByteArray winVerOverride = qgetenv("QT_WINVER_OVERRIDE"); - if (winVerOverride == "WINDOWS7" || winVerOverride == "2008_R2") { - result.dwMajorVersion = 6; - result.dwMinorVersion = 1; - } else if (winVerOverride == "WINDOWS8" || winVerOverride == "2012") { - result.dwMajorVersion = 6; - result.dwMinorVersion = 2; - } else if (winVerOverride == "WINDOWS8_1" || winVerOverride == "2012_R2") { - result.dwMajorVersion = 6; - result.dwMinorVersion = 3; - } else if (winVerOverride == "WINDOWS10" || winVerOverride == "2016") { + if (winVerOverride == "WINDOWS10" || winVerOverride == "2016") { result.dwMajorVersion = 10; } else { return realResult; } - if (winVerOverride == "2008_R2" - || winVerOverride == "2012" - || winVerOverride == "2012_R2" - || winVerOverride == "2016") { + if (winVerOverride == "2016") { // If the current host OS is a domain controller and the override OS // is also a server type OS, preserve that information if (result.wProductType == VER_NT_WORKSTATION) diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 6b4be76fef..93d3e30943 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -170,18 +170,16 @@ inline Int aligned(Int v, Int byteAlign) static IDXGIFactory1 *createDXGIFactory2() { IDXGIFactory1 *result = nullptr; - if (QOperatingSystemVersion::current() > QOperatingSystemVersion::Windows7) { - using PtrCreateDXGIFactory2 = HRESULT (WINAPI *)(UINT, REFIID, void **); - QSystemLibrary dxgilib(QStringLiteral("dxgi")); - if (auto createDXGIFactory2 = reinterpret_cast(dxgilib.resolve("CreateDXGIFactory2"))) { - const HRESULT hr = createDXGIFactory2(0, IID_IDXGIFactory2, reinterpret_cast(&result)); - if (FAILED(hr)) { - qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s", qPrintable(comErrorMessage(hr))); - result = nullptr; - } - } else { - qWarning("Unable to resolve CreateDXGIFactory2()"); + using PtrCreateDXGIFactory2 = HRESULT (WINAPI *)(UINT, REFIID, void **); + QSystemLibrary dxgilib(QStringLiteral("dxgi")); + if (auto createDXGIFactory2 = reinterpret_cast(dxgilib.resolve("CreateDXGIFactory2"))) { + const HRESULT hr = createDXGIFactory2(0, IID_IDXGIFactory2, reinterpret_cast(&result)); + if (FAILED(hr)) { + qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s", qPrintable(comErrorMessage(hr))); + result = nullptr; } + } else { + qWarning("Unable to resolve CreateDXGIFactory2()"); } return result; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 79db0b74e6..78961472b0 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -200,18 +200,16 @@ void QWindowsUser32DLL::init() getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences"); setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences"); - if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8) { - enableMouseInPointer = (EnableMouseInPointer)library.resolve("EnableMouseInPointer"); - getPointerType = (GetPointerType)library.resolve("GetPointerType"); - getPointerInfo = (GetPointerInfo)library.resolve("GetPointerInfo"); - getPointerDeviceRects = (GetPointerDeviceRects)library.resolve("GetPointerDeviceRects"); - getPointerTouchInfo = (GetPointerTouchInfo)library.resolve("GetPointerTouchInfo"); - getPointerFrameTouchInfo = (GetPointerFrameTouchInfo)library.resolve("GetPointerFrameTouchInfo"); - getPointerFrameTouchInfoHistory = (GetPointerFrameTouchInfoHistory)library.resolve("GetPointerFrameTouchInfoHistory"); - getPointerPenInfo = (GetPointerPenInfo)library.resolve("GetPointerPenInfo"); - getPointerPenInfoHistory = (GetPointerPenInfoHistory)library.resolve("GetPointerPenInfoHistory"); - skipPointerFrameMessages = (SkipPointerFrameMessages)library.resolve("SkipPointerFrameMessages"); - } + enableMouseInPointer = (EnableMouseInPointer)library.resolve("EnableMouseInPointer"); + getPointerType = (GetPointerType)library.resolve("GetPointerType"); + getPointerInfo = (GetPointerInfo)library.resolve("GetPointerInfo"); + getPointerDeviceRects = (GetPointerDeviceRects)library.resolve("GetPointerDeviceRects"); + getPointerTouchInfo = (GetPointerTouchInfo)library.resolve("GetPointerTouchInfo"); + getPointerFrameTouchInfo = (GetPointerFrameTouchInfo)library.resolve("GetPointerFrameTouchInfo"); + getPointerFrameTouchInfoHistory = (GetPointerFrameTouchInfoHistory)library.resolve("GetPointerFrameTouchInfoHistory"); + getPointerPenInfo = (GetPointerPenInfo)library.resolve("GetPointerPenInfo"); + getPointerPenInfoHistory = (GetPointerPenInfoHistory)library.resolve("GetPointerPenInfoHistory"); + skipPointerFrameMessages = (SkipPointerFrameMessages)library.resolve("SkipPointerFrameMessages"); if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 14393)) { @@ -232,8 +230,6 @@ bool QWindowsUser32DLL::supportsPointerApi() void QWindowsShcoreDLL::init() { - if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1) - return; QSystemLibrary library(QStringLiteral("SHCore")); getProcessDpiAwareness = (GetProcessDpiAwareness)library.resolve("GetProcessDpiAwareness"); setProcessDpiAwareness = (SetProcessDpiAwareness)library.resolve("SetProcessDpiAwareness"); @@ -405,9 +401,6 @@ bool QWindowsContext::initPointer(unsigned integrationOptions) if (integrationOptions & QWindowsIntegration::DontUseWMPointer) return false; - if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8) - return false; - if (!QWindowsContext::user32dll.supportsPointerApi()) return false; diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index f7496b62ca..67d6b0c460 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -1773,21 +1773,6 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT; theme.stateId = stateId; d->drawBackground(theme); - - if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8) { - const QRect gripperBounds = QWindowsXPStylePrivate::scrollBarGripperBounds(flags, widget, &theme); - // Draw gripper if there is enough space - if (!gripperBounds.isEmpty() && flags & State_Enabled) { - painter->save(); - XPThemeData grippBackground = theme; - grippBackground.partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; - theme.rect = gripperBounds; - painter->setClipRegion(d->region(theme));// Only change inside the region of the gripper - d->drawBackground(grippBackground);// The gutter is the grippers background - d->drawBackground(theme); // Transparent gripper ontop of background - painter->restore(); - } - } } } } diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 692583666d..24aa24de20 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -716,9 +716,7 @@ int QVistaHelper::topOffset(const QPaintDevice *device) { if (vistaState() != VistaAero) return titleBarSize() + 3; - static const int aeroOffset = - QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8 ? - QStyleHelper::dpiScaled(4, device) : QStyleHelper::dpiScaled(13, device); + static const int aeroOffset = QStyleHelper::dpiScaled(13, device); return aeroOffset + titleBarSize(); } -- cgit v1.2.3