diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 4eb4b8e6747f..4603ac8e32d7 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -15565,19 +15565,6 @@ value: true mirror: always -# Whether to apply a workaround intended to prevent Windows from treating -# non-foreground-marked fullscreen windows as fullscreen on Windows 7 and -# earlier. (See bug 1732517.) -# -# Valid values: -# * -1: the workaround is never used. -# * 1: the workaround is always used. -# * 0: the workaround is used if we think it should be. (Default.) -- name: widget.windows.fullscreen_marking_workaround - type: RelaxedAtomicInt32 - value: 0 - mirror: always - # The number of messages of each type to keep for display in # about:windows-messages - name: widget.windows.messages_to_log diff --git a/tools/lint/mscom-init.yml b/tools/lint/mscom-init.yml index 8c0af6ffcf69..d96239cf0b36 100644 --- a/tools/lint/mscom-init.yml +++ b/tools/lint/mscom-init.yml @@ -36,7 +36,6 @@ forbid-mscom-init: - toolkit/crashreporter/google-breakpad/src/common/windows/pdb_source_line_writer.cc - toolkit/mozapps/defaultagent/main.cpp - uriloader/exthandler/win/nsOSHelperAppService.cpp - - widget/windows/InkCollector.cpp - widget/windows/TaskbarPreview.cpp - widget/windows/WinTaskbar.cpp - widget/windows/nsAppShell.cpp diff --git a/widget/tests/gtest/TestWinWindowOcclusionTracker.cpp b/widget/tests/gtest/TestWinWindowOcclusionTracker.cpp index b1f1114a3ad4..5ef7e3f81ce2 100644 --- a/widget/tests/gtest/TestWinWindowOcclusionTracker.cpp +++ b/widget/tests/gtest/TestWinWindowOcclusionTracker.cpp @@ -11,7 +11,6 @@ #include "MockWinWidget.h" #include "mozilla/widget/WinWindowOcclusionTracker.h" -#include "mozilla/WindowsVersion.h" using namespace mozilla; using namespace mozilla::widget; @@ -154,10 +153,6 @@ TEST_F(WinWindowOcclusionTrackerTest, PopupWindow) { } TEST_F(WinWindowOcclusionTrackerTest, CloakedWindow) { - // Cloaking is only supported in Windows 8 and above. - if (!IsWin8OrLater()) { - return; - } HWND hwnd = CreateNativeWindow(/* aStyle = */ 0, /* aExStyle = */ 0); LayoutDeviceIntRect winRect; BOOL cloak = TRUE; diff --git a/widget/windows/IMMHandler.cpp b/widget/windows/IMMHandler.cpp index 0fd33bdba25e..b6e6c7a40bca 100644 --- a/widget/windows/IMMHandler.cpp +++ b/widget/windows/IMMHandler.cpp @@ -18,7 +18,6 @@ #include "mozilla/MiscEvents.h" #include "mozilla/TextEvents.h" #include "mozilla/ToString.h" -#include "mozilla/WindowsVersion.h" #ifndef IME_PROP_ACCEPT_WIDE_VKEY # define IME_PROP_ACCEPT_WIDE_VKEY 0x20 @@ -224,8 +223,7 @@ bool IMMHandler::IsActiveIMEInBlockList() { // ATOK 2008 and ATOK 2009 crash when user just opens their open state. // ATOK 2010 isn't installable newly on Win 7 or later, but we have a lot of // crash reports. - if (IsWin8OrLater() && - (IsATOK2006Active() || IsATOK2007Active() || IsATOK2008Active() || + if ((IsATOK2006Active() || IsATOK2007Active() || IsATOK2008Active() || IsATOK2009Active() || IsATOK2010Active())) { return true; } diff --git a/widget/windows/InkCollector.cpp b/widget/windows/InkCollector.cpp deleted file mode 100644 index 2fcd2ea77d87..000000000000 --- a/widget/windows/InkCollector.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: set ts=2 sw=2 et tw=78: - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "InkCollector.h" -#include "nsDebug.h" -#include "nsISupportsUtils.h" - -// Msinkaut_i.c and Msinkaut.h should both be included -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms695519.aspx -#include - -mozilla::StaticAutoPtr InkCollector::sInkCollector; - -InkCollector::~InkCollector() { - Shutdown(); - MOZ_ASSERT(!mCookie && !mEnabled && !mComInitialized && !mMarshaller && - !mInkCollector && !mConnectionPoint && !mInkCollectorEvent); -} - -void InkCollector::Initialize() { - // Possibly, we can use mConnectionPoint for checking, - // But if errors exist (perhaps COM object is unavailable), - // Initialize() will be called more times. - static bool sInkCollectorCreated = false; - if (sInkCollectorCreated) { - return; - } - sInkCollectorCreated = true; - - // COM could get uninitialized due to previous initialization. - mComInitialized = SUCCEEDED(::CoInitialize(nullptr)); - - // Set up instance of InkCollectorEvent. - mInkCollectorEvent = new InkCollectorEvent(); - - // Set up a free threaded marshaler. - if (FAILED(::CoCreateFreeThreadedMarshaler(mInkCollectorEvent, - getter_AddRefs(mMarshaller)))) { - return; - } - - // Create the ink collector. - if (FAILED(::CoCreateInstance(CLSID_InkCollector, NULL, CLSCTX_INPROC_SERVER, - IID_IInkCollector, - getter_AddRefs(mInkCollector)))) { - return; - } - - // Set up connection between sink and InkCollector. - RefPtr connPointContainer; - - // Get the connection point container. - if (SUCCEEDED(mInkCollector->QueryInterface( - IID_IConnectionPointContainer, getter_AddRefs(connPointContainer)))) { - // Find the connection point for Ink Collector events. - if (SUCCEEDED(connPointContainer->FindConnectionPoint( - __uuidof(_IInkCollectorEvents), - getter_AddRefs(mConnectionPoint)))) { - // Hook up sink to connection point. - if (SUCCEEDED(mConnectionPoint->Advise(mInkCollectorEvent, &mCookie))) { - OnInitialize(); - } - } - } -} - -void InkCollector::Shutdown() { - Enable(false); - if (mConnectionPoint) { - // Remove the connection of the sink to the Ink Collector. - mConnectionPoint->Unadvise(mCookie); - mCookie = 0; - mConnectionPoint = nullptr; - } - mInkCollector = nullptr; - mMarshaller = nullptr; - mInkCollectorEvent = nullptr; - - // Let uninitialization get handled in a place where it got inited. - if (mComInitialized) { - CoUninitialize(); - mComInitialized = false; - } -} - -void InkCollector::OnInitialize() { - // Suppress all events to do not allow performance decreasing. - // https://msdn.microsoft.com/en-us/library/ms820347.aspx - mInkCollector->SetEventInterest(InkCollectorEventInterest::ICEI_AllEvents, - VARIANT_FALSE); - - // Sets a value that indicates whether an object or control has interest in a - // specified event. - mInkCollector->SetEventInterest( - InkCollectorEventInterest::ICEI_CursorOutOfRange, VARIANT_TRUE); - - // If the MousePointer property is set to IMP_Custom and the MouseIcon - // property is NULL, Then the ink collector no longer handles mouse cursor - // settings. - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms700686.aspx - mInkCollector->put_MouseIcon(nullptr); - mInkCollector->put_MousePointer(InkMousePointer::IMP_Custom); - - // This mode allows an ink collector to collect ink from any tablet attached - // to the Tablet PC. The Boolean value that indicates whether to use the mouse - // as an input device. If TRUE, the mouse is used for input. - // https://msdn.microsoft.com/en-us/library/ms820346.aspx - mInkCollector->SetAllTabletsMode(VARIANT_FALSE); - - // Sets the value that specifies whether ink is rendered as it is drawn. - // VARIANT_TRUE to render ink as it is drawn on the display. - // VARIANT_FALSE to not have the ink appear on the display as strokes are - // made. - // https://msdn.microsoft.com/en-us/library/windows/desktop/dd314598.aspx - mInkCollector->put_DynamicRendering(VARIANT_FALSE); - - // Set AutoRedraw to false to prevent repainting the ink when the window is - // invalidated. - mInkCollector->put_AutoRedraw(VARIANT_FALSE); -} - -// Sets a value that specifies whether the InkCollector object collects pen -// input. This property must be set to FALSE before setting or calling specific -// properties and methods of the object. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms701721.aspx -void InkCollector::Enable(bool aNewState) { - if (aNewState != mEnabled) { - if (mInkCollector) { - if (SUCCEEDED(mInkCollector->put_Enabled(aNewState ? VARIANT_TRUE - : VARIANT_FALSE))) { - mEnabled = aNewState; - } else { - NS_WARNING("InkCollector did not change status successfully"); - } - } else { - NS_WARNING("InkCollector should be exist"); - } - } -} - -HWND InkCollector::GetTarget() { return mTargetWindow; } - -void InkCollector::SetTarget(HWND aTargetWindow) { - NS_ASSERTION(aTargetWindow, "aTargetWindow should be exist"); - if (aTargetWindow && (aTargetWindow != mTargetWindow)) { - Initialize(); - if (mInkCollector) { - Enable(false); - if (SUCCEEDED(mInkCollector->put_hWnd((LONG_PTR)aTargetWindow))) { - mTargetWindow = aTargetWindow; - } else { - NS_WARNING("InkCollector did not change window property successfully"); - } - Enable(true); - } - } -} - -void InkCollector::ClearTarget() { - if (mTargetWindow && mInkCollector) { - Enable(false); - if (SUCCEEDED(mInkCollector->put_hWnd(0))) { - mTargetWindow = 0; - } else { - NS_WARNING("InkCollector did not clear window property successfully"); - } - } -} - -uint16_t InkCollector::GetPointerId() { return mPointerId; } - -void InkCollector::SetPointerId(uint16_t aPointerId) { - mPointerId = aPointerId; -} - -void InkCollector::ClearPointerId() { mPointerId = 0; } - -// The display and the digitizer have quite different properties. -// The display has CursorMustTouch, the mouse pointer alway touches the display -// surface. The digitizer lists Integrated and HardProximity. When the stylus is -// in the proximity of the tablet its movements are also detected. An external -// tablet will only list HardProximity. -bool InkCollectorEvent::IsHardProximityTablet(IInkTablet* aTablet) const { - if (aTablet) { - TabletHardwareCapabilities caps; - if (SUCCEEDED(aTablet->get_HardwareCapabilities(&caps))) { - return (TabletHardwareCapabilities::THWC_HardProximity & caps); - } - } - return false; -} - -HRESULT __stdcall InkCollectorEvent::QueryInterface(REFIID aRiid, - void** aObject) { - // Validate the input - if (!aObject) { - return E_POINTER; - } - HRESULT result = E_NOINTERFACE; - // This object supports IUnknown/IDispatch/IInkCollectorEvents - if ((IID_IUnknown == aRiid) || (IID_IDispatch == aRiid) || - (DIID__IInkCollectorEvents == aRiid)) { - *aObject = this; - // AddRef should be called when we give info about interface - NS_ADDREF_THIS(); - result = S_OK; - } - return result; -} - -HRESULT InkCollectorEvent::Invoke(DISPID aDispIdMember, REFIID /*aRiid*/, - LCID /*aId*/, WORD /*wFlags*/, - DISPPARAMS* aDispParams, - VARIANT* /*aVarResult*/, - EXCEPINFO* /*aExcepInfo*/, - UINT* /*aArgErr*/) { - switch (aDispIdMember) { - case DISPID_ICECursorOutOfRange: { - if (aDispParams && aDispParams->cArgs) { - CursorOutOfRange( - static_cast(aDispParams->rgvarg[0].pdispVal)); - } - break; - } - } - return S_OK; -} - -void InkCollectorEvent::CursorOutOfRange(IInkCursor* aCursor) const { - IInkTablet* curTablet = nullptr; - if (FAILED(aCursor->get_Tablet(&curTablet))) { - return; - } - // All events should be suppressed except - // from tablets with hard proximity. - if (!IsHardProximityTablet(curTablet)) { - return; - } - // Notify current target window. - if (HWND targetWindow = InkCollector::sInkCollector->GetTarget()) { - ::SendMessage(targetWindow, MOZ_WM_PEN_LEAVES_HOVER_OF_DIGITIZER, 0, 0); - } -} diff --git a/widget/windows/InkCollector.h b/widget/windows/InkCollector.h deleted file mode 100644 index 803eeb48410f..000000000000 --- a/widget/windows/InkCollector.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: set ts=2 sw=2 et tw=78: - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef InkCollector_h__ -#define InkCollector_h__ - -#include -#include -#include "mozilla/StaticPtr.h" - -#define MOZ_WM_PEN_LEAVES_HOVER_OF_DIGITIZER WM_USER + 0x83 - -class InkCollectorEvent final : public _IInkCollectorEvents { - public: - // IUnknown - HRESULT __stdcall QueryInterface(REFIID aRiid, void** aObject); - virtual ULONG STDMETHODCALLTYPE AddRef() { return ++mRefCount; } - virtual ULONG STDMETHODCALLTYPE Release() { - MOZ_ASSERT(mRefCount); - if (!--mRefCount) { - delete this; - return 0; - } - return mRefCount; - } - - protected: - // IDispatch - STDMETHOD(GetTypeInfoCount)(UINT* aInfo) { return E_NOTIMPL; } - STDMETHOD(GetTypeInfo)(UINT aInfo, LCID aId, ITypeInfo** aTInfo) { - return E_NOTIMPL; - } - STDMETHOD(GetIDsOfNames) - (REFIID aRiid, LPOLESTR* aStrNames, UINT aNames, LCID aId, DISPID* aDispId) { - return E_NOTIMPL; - } - STDMETHOD(Invoke) - (DISPID aDispIdMember, REFIID aRiid, LCID aId, WORD wFlags, - DISPPARAMS* aDispParams, VARIANT* aVarResult, EXCEPINFO* aExcepInfo, - UINT* aArgErr); - - // InkCollectorEvent - void CursorOutOfRange(IInkCursor* aCursor) const; - bool IsHardProximityTablet(IInkTablet* aTablet) const; - - private: - uint32_t mRefCount = 0; - - ~InkCollectorEvent() = default; -}; - -class InkCollector { - public: - ~InkCollector(); - void Shutdown(); - - HWND GetTarget(); - void SetTarget(HWND aTargetWindow); - void ClearTarget(); - - uint16_t GetPointerId(); // 0 shows that there is no existing pen. - void SetPointerId(uint16_t aPointerId); - void ClearPointerId(); - - static mozilla::StaticAutoPtr sInkCollector; - - protected: - void Initialize(); - void OnInitialize(); - void Enable(bool aNewState); - - private: - RefPtr mMarshaller; - RefPtr mInkCollector; - RefPtr mConnectionPoint; - RefPtr mInkCollectorEvent; - - HWND mTargetWindow = 0; - DWORD mCookie = 0; - bool mComInitialized = false; - bool mEnabled = false; - - // This value holds the previous pointerId of the pen, and is used by the - // nsWindow when processing a MOZ_WM_PEN_LEAVES_HOVER_OF_DIGITIZER which - // indicates that a pen leaves the digitizer. - - // TODO: If we move our implementation to window pointer input messages, then - // we no longer need this value, since the pointerId can be retrieved from the - // window message, please refer to - // https://msdn.microsoft.com/en-us/library/windows/desktop/hh454916(v=vs.85).aspx - - // NOTE: The pointerId of a pen shouldn't be 0 on a Windows platform, since 0 - // is reserved of the mouse, please refer to - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx - uint16_t mPointerId = 0; -}; - -#endif // InkCollector_h__ diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp index 0e55bf2c59f0..e80f9fe2f238 100644 --- a/widget/windows/TSFTextStore.cpp +++ b/widget/windows/TSFTextStore.cpp @@ -2675,7 +2675,7 @@ TSFTextStore::QueryInsert(LONG acpTestStart, LONG acpTestEnd, ULONG cch, // XXX need to adjust to cluster boundary // Assume we are given good offsets for now - if (IsWin8OrLater() && mComposition.isNothing() && + if (mComposition.isNothing() && ((StaticPrefs:: intl_tsf_hack_ms_traditional_chinese_query_insert_result() && TSFStaticSink::IsMSChangJieOrMSQuickActive()) || @@ -3881,9 +3881,8 @@ bool TSFTextStore::ShouldSetInputScopeOfURLBarToDefault() { case TextInputProcessorID::eMicrosoftPinyinNewExperienceInputStyle: case TextInputProcessorID::eMicrosoftOldHangul: case TextInputProcessorID::eMicrosoftWubi: - return true; case TextInputProcessorID::eMicrosoftIMEForKorean: - return IsWin8OrLater(); + return true; default: return false; } @@ -4808,8 +4807,7 @@ bool TSFTextStore::MaybeHackNoErrorLayoutBugs(LONG& aACPStart, LONG& aACPEnd) { } [[fallthrough]]; case TextInputProcessorID::eMicrosoftChangJie: - if (!IsWin8OrLater() || - !StaticPrefs:: + if (!StaticPrefs:: intl_tsf_hack_ms_traditional_chinese_do_not_return_no_layout_error()) { return false; } @@ -4826,8 +4824,7 @@ bool TSFTextStore::MaybeHackNoErrorLayoutBugs(LONG& aACPStart, LONG& aACPEnd) { // there is stateful cause or race in them. case TextInputProcessorID::eMicrosoftPinyin: case TextInputProcessorID::eMicrosoftWubi: - if (!IsWin8OrLater() || - !StaticPrefs:: + if (!StaticPrefs:: intl_tsf_hack_ms_simplified_chinese_do_not_return_no_layout_error()) { return false; } diff --git a/widget/windows/ToastNotification.cpp b/widget/windows/ToastNotification.cpp index ebf172ab7940..fd56f6a08ef6 100644 --- a/widget/windows/ToastNotification.cpp +++ b/widget/windows/ToastNotification.cpp @@ -23,7 +23,6 @@ #include "mozilla/Logging.h" #include "mozilla/Services.h" #include "mozilla/WidgetUtils.h" -#include "mozilla/WindowsVersion.h" #include "nsAppRunner.h" #include "nsComponentManagerUtils.h" #include "nsCOMPtr.h" @@ -37,7 +36,6 @@ #include "prenv.h" #include "ToastNotificationHandler.h" #include "ToastNotificationHeaderOnlyUtils.h" -#include "WinTaskbar.h" #include "WinUtils.h" namespace mozilla { @@ -67,10 +65,6 @@ ToastNotification::ToastNotification() = default; ToastNotification::~ToastNotification() = default; nsresult ToastNotification::Init() { - if (!IsWin8OrLater()) { - return NS_ERROR_NOT_IMPLEMENTED; - } - if (!PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR")) { // Windows Toast Notification requires AppId. But allow `xpcshell` to // create the service to test other functionality. @@ -108,18 +102,6 @@ bool ToastNotification::EnsureAumidRegistered() { return true; } - // Fall back to start menu shortcut for Windows 8; toast AUMID registration in - // the registry only works in Windows 10+. - if (!IsWin10OrLater()) { - nsAutoString aumid; - if (!WinTaskbar::GetAppUserModelID(aumid)) { - return false; - } - - mAumid = Some(aumid); - return true; - } - nsAutoString installHash; nsresult rv = gDirServiceProvider->GetInstallHash(installHash); NS_ENSURE_SUCCESS(rv, false); diff --git a/widget/windows/ToastNotificationHandler.cpp b/widget/windows/ToastNotificationHandler.cpp index fca9d756f5c7..2e3fe3ed27c6 100644 --- a/widget/windows/ToastNotificationHandler.cpp +++ b/widget/windows/ToastNotificationHandler.cpp @@ -490,9 +490,9 @@ ComPtr ToastNotificationHandler::CreateToastXmlDocument() { MOZ_LOG(sWASLog, LogLevel::Debug, ("launchArg: '%s'", NS_ConvertUTF16toUTF8(launchArg).get())); - // On modern Windows (10+), use newer toast layout, which makes images larger, - // for system (chrome-privileged) toasts. - if (IsWin10OrLater() && mIsSystemPrincipal) { + // Use newer toast layout, which makes images larger, for system + // (chrome-privileged) toasts. + if (mIsSystemPrincipal) { ComPtr bindingElements; hr = toastXml->GetElementsByTagName(HStringReference(L"binding").Get(), &bindingElements); @@ -769,19 +769,16 @@ bool ToastNotificationHandler::CreateWindowsNotificationFromXml( &mFailedToken); NS_ENSURE_TRUE(SUCCEEDED(hr), false); - // `IToastNotification2` not supported on versions older than Windows 10. - if (IsWin10OrLater()) { - ComPtr notification2; - hr = mNotification.As(¬ification2); - NS_ENSURE_TRUE(SUCCEEDED(hr), false); + ComPtr notification2; + hr = mNotification.As(¬ification2); + NS_ENSURE_TRUE(SUCCEEDED(hr), false); - HString hTag; - hr = hTag.Set(mWindowsTag.get()); - NS_ENSURE_TRUE(SUCCEEDED(hr), false); + HString hTag; + hr = hTag.Set(mWindowsTag.get()); + NS_ENSURE_TRUE(SUCCEEDED(hr), false); - hr = notification2->put_Tag(hTag.Get()); - NS_ENSURE_TRUE(SUCCEEDED(hr), false); - } + hr = notification2->put_Tag(hTag.Get()); + NS_ENSURE_TRUE(SUCCEEDED(hr), false); ComPtr toastNotificationManagerStatics = GetToastNotificationManagerStatics(); @@ -958,24 +955,20 @@ HRESULT ToastNotificationHandler::OnDismiss( const ComPtr& notification, const ComPtr& aArgs) { - // Multiple dismiss events only occur on Windows 10 and later, prior versions - // of Windows didn't include `IToastNotification2`. - if (IsWin10OrLater()) { - ComPtr notification2; - HRESULT hr = notification.As(¬ification2); - NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL); + ComPtr notification2; + HRESULT hr = notification.As(¬ification2); + NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL); - HString tagHString; - hr = notification2->get_Tag(tagHString.GetAddressOf()); - NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL); + HString tagHString; + hr = notification2->get_Tag(tagHString.GetAddressOf()); + NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL); - unsigned int len; - const wchar_t* tagPtr = tagHString.GetRawBuffer(&len); - nsAutoString tag(tagPtr, len); + unsigned int len; + const wchar_t* tagPtr = tagHString.GetRawBuffer(&len); + nsAutoString tag(tagPtr, len); - if (FindNotificationByTag(tag, mAumid)) { - return S_OK; - } + if (FindNotificationByTag(tag, mAumid)) { + return S_OK; } SendFinished(); diff --git a/widget/windows/WinHeaderOnlyUtils.h b/widget/windows/WinHeaderOnlyUtils.h index 93137defe976..c93ebb7fbf25 100644 --- a/widget/windows/WinHeaderOnlyUtils.h +++ b/widget/windows/WinHeaderOnlyUtils.h @@ -23,7 +23,6 @@ #include "mozilla/Maybe.h" #include "mozilla/ResultVariant.h" #include "mozilla/UniquePtr.h" -#include "mozilla/WindowsVersion.h" #include "nsWindowsHelpers.h" #if defined(MOZILLA_INTERNAL_API) @@ -522,15 +521,13 @@ class FileUniqueId final { private: void GetId(const nsAutoHandle& aFile) { FILE_ID_INFO fileIdInfo = {}; - if (IsWin8OrLater()) { - if (::GetFileInformationByHandleEx(aFile.get(), FileIdInfo, &fileIdInfo, - sizeof(fileIdInfo))) { - mId = fileIdInfo; - return; - } - // Only NTFS and ReFS support FileIdInfo. So we have to fallback if - // GetFileInformationByHandleEx failed. + if (::GetFileInformationByHandleEx(aFile.get(), FileIdInfo, &fileIdInfo, + sizeof(fileIdInfo))) { + mId = fileIdInfo; + return; } + // Only NTFS and ReFS support FileIdInfo. So we have to fallback if + // GetFileInformationByHandleEx failed. BY_HANDLE_FILE_INFORMATION info = {}; if (!::GetFileInformationByHandle(aFile.get(), &info)) { @@ -751,10 +748,6 @@ inline LauncherResult GetElevationType( } inline bool HasPackageIdentity() { - if (!IsWin8OrLater()) { - return false; - } - HMODULE kernel32Dll = ::GetModuleHandleW(L"kernel32"); if (!kernel32Dll) { return false; diff --git a/widget/windows/WinIMEHandler.cpp b/widget/windows/WinIMEHandler.cpp index 9daf1af40ceb..aaf4a72d31eb 100644 --- a/widget/windows/WinIMEHandler.cpp +++ b/widget/windows/WinIMEHandler.cpp @@ -698,7 +698,7 @@ bool IMEHandler::IsOnScreenKeyboardSupported() { return true; } #endif // NIGHTLY_BUILD - if (!IsWin8OrLater() || !Preferences::GetBool(kOskEnabled, true) || + if (!Preferences::GetBool(kOskEnabled, true) || !IMEHandler::NeedOnScreenKeyboard()) { return false; } @@ -706,7 +706,7 @@ bool IMEHandler::IsOnScreenKeyboardSupported() { // On Windows 10 we require tablet mode, unless the user has set the relevant // Windows setting to enable the on-screen keyboard in desktop mode. // We might be disabled specifically on Win8(.1), so we check that afterwards. - if (IsWin10OrLater() && !IsWin11OrLater()) { + if (!IsWin11OrLater()) { if (!IsInTabletMode() && !AutoInvokeOnScreenKeyboardInDesktopMode()) { return false; } @@ -738,10 +738,6 @@ void IMEHandler::MaybeDismissOnScreenKeyboard(nsWindow* aWindow, Sync aSync) { OSKVRManager::DismissOnScreenKeyboard(); } #endif // NIGHTLY_BUILD - if (!IsWin8OrLater()) { - return; - } - if (aSync == Sync::Yes) { DismissOnScreenKeyboard(aWindow); return; @@ -780,12 +776,6 @@ bool IMEHandler::WStringStartsWithCaseInsensitive(const std::wstring& aHaystack, // an on-screen keyboard for text input. // static bool IMEHandler::NeedOnScreenKeyboard() { - // This function is only supported for Windows 8 and up. - if (!IsWin8OrLater()) { - Preferences::SetString(kOskDebugReason, L"IKPOS: Requires Win8+."); - return false; - } - if (!Preferences::GetBool(kOskDetectPhysicalKeyboard, true)) { Preferences::SetString(kOskDebugReason, L"IKPOS: Detection disabled."); return true; diff --git a/widget/windows/WinPointerEvents.cpp b/widget/windows/WinPointerEvents.cpp index c0465da7d796..57e19a0c4b01 100644 --- a/widget/windows/WinPointerEvents.cpp +++ b/widget/windows/WinPointerEvents.cpp @@ -13,7 +13,6 @@ #include "WinUtils.h" #include "mozilla/MouseEvents.h" #include "mozilla/StaticPrefs_dom.h" -#include "mozilla/WindowsVersion.h" #include "mozilla/dom/MouseEventBinding.h" using namespace mozilla; @@ -31,10 +30,6 @@ WinPointerEvents::WinPointerEvents() { InitLibrary(); } /* Load and shutdown */ void WinPointerEvents::InitLibrary() { MOZ_ASSERT(XRE_IsParentProcess()); - if (!IsWin8OrLater()) { - // Only Win8 or later supports WM_POINTER* - return; - } if (getPointerType) { // Return if we already initialized the PointerEvent related interfaces return; @@ -110,12 +105,6 @@ bool WinPointerEvents::GetPointerPenInfo(uint32_t aPointerId, return getPointerPenInfo(aPointerId, aPenInfo); } -bool WinPointerEvents::ShouldEnableInkCollector() { - // We need InkCollector on Win7. For Win8 or later, we handle WM_POINTER* for - // pen. - return !IsWin8OrLater(); -} - bool WinPointerEvents::ShouldRollupOnPointerEvent(UINT aMsg, WPARAM aWParam) { MOZ_ASSERT(aMsg == WM_POINTERDOWN); // Only roll up popups when we handling WM_POINTER* to fire Gecko diff --git a/widget/windows/WinPointerEvents.h b/widget/windows/WinPointerEvents.h index 1d2f1a07cb7c..eaf20a7856de 100644 --- a/widget/windows/WinPointerEvents.h +++ b/widget/windows/WinPointerEvents.h @@ -119,7 +119,6 @@ class WinPointerEvents final { POINTER_INPUT_TYPE GetPointerType(uint32_t aPointerId); bool GetPointerInfo(uint32_t aPointerId, POINTER_INFO* aPointerInfo); bool GetPointerPenInfo(uint32_t aPointerId, POINTER_PEN_INFO* aPenInfo); - bool ShouldEnableInkCollector(); bool ShouldRollupOnPointerEvent(UINT aMsg, WPARAM aWParam); bool ShouldFirePointerEventByWinPointerMessages(); WinPointerInfo* GetCachedPointerInfo(UINT aMsg, WPARAM aWParam); diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index 9ea4d13dd0f8..18b27097ea23 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -28,7 +28,6 @@ #include "mozilla/RefPtr.h" #include "mozilla/SchedulerGroup.h" #include "mozilla/WinHeaderOnlyUtils.h" -#include "mozilla/WindowsVersion.h" #include "mozilla/Unused.h" #include "nsIContentPolicy.h" #include "WindowsUIUtils.h" @@ -99,7 +98,7 @@ void WinUtils::Initialize() { // Dpi-Awareness is not supported with Win32k Lockdown enabled, so we don't // initialize DPI-related members and assert later that nothing accidently // uses these static members - if (IsWin10OrLater() && !IsWin32kLockedDown()) { + if (!IsWin32kLockedDown()) { HMODULE user32Dll = ::GetModuleHandleW(L"user32"); if (user32Dll) { auto getThreadDpiAwarenessContext = @@ -128,9 +127,7 @@ void WinUtils::Initialize() { } } - if (IsWin8OrLater()) { - sHasPackageIdentity = mozilla::HasPackageIdentity(); - } + sHasPackageIdentity = mozilla::HasPackageIdentity(); } // static @@ -1468,10 +1465,6 @@ static bool IsTabletDevice() { // - It is used as a tablet which means that it has no keyboard connected. // On Windows 10 it means that it is verifying with ConvertibleSlateMode. - if (!IsWin8OrLater()) { - return false; - } - if (WindowsUIUtils::GetInTabletMode()) { return true; } @@ -2043,10 +2036,6 @@ static LONG SetRelativeScaleStep(LUID aAdapterId, int32_t aRelativeScaleStep) { } nsresult WinUtils::SetHiDPIMode(bool aHiDPI) { - if (!IsWin10OrLater()) { - return NS_ERROR_NOT_AVAILABLE; - } - auto config = GetDisplayConfig(); if (!config) { return NS_ERROR_NOT_AVAILABLE; @@ -2102,10 +2091,6 @@ nsresult WinUtils::SetHiDPIMode(bool aHiDPI) { } nsresult WinUtils::RestoreHiDPIMode() { - if (!IsWin10OrLater()) { - return NS_ERROR_NOT_AVAILABLE; - } - if (sCurRelativeScaleStep == std::numeric_limits::max()) { // The DPI setting hasn't been changed. return NS_ERROR_UNEXPECTED; diff --git a/widget/windows/WinWindowOcclusionTracker.cpp b/widget/windows/WinWindowOcclusionTracker.cpp index ff0b43f83310..da26abfbf7a1 100644 --- a/widget/windows/WinWindowOcclusionTracker.cpp +++ b/widget/windows/WinWindowOcclusionTracker.cpp @@ -880,10 +880,6 @@ void WinWindowOcclusionTracker::WindowOcclusionCalculator::Initialize() { CALC_LOG(LogLevel::Info, "Initialize()"); #ifndef __MINGW32__ - if (!IsWin10OrLater()) { - return; - } - RefPtr desktopManager; HRESULT hr = ::CoCreateInstance( CLSID_VirtualDesktopManager, NULL, CLSCTX_INPROC_SERVER, diff --git a/widget/windows/WindowsSMTCProvider.cpp b/widget/windows/WindowsSMTCProvider.cpp index 91eea77918c7..d0990fd135a9 100644 --- a/widget/windows/WindowsSMTCProvider.cpp +++ b/widget/windows/WindowsSMTCProvider.cpp @@ -20,7 +20,6 @@ # include "mozilla/Logging.h" # include "mozilla/Maybe.h" # include "mozilla/WidgetUtils.h" -# include "mozilla/WindowsVersion.h" # include "mozilla/ScopeExit.h" # include "mozilla/dom/MediaControlUtils.h" # include "mozilla/media/MediaUtils.h" @@ -138,11 +137,6 @@ bool WindowsSMTCProvider::Open() { LOG("Opening Source"); MOZ_ASSERT(!mInitialized); - if (!IsWin8Point1OrLater()) { - LOG("Windows 8.1 or later is required for Media Key Support"); - return false; - } - if (!InitDisplayAndControls()) { LOG("Failed to initialize the SMTC and its display"); return false; diff --git a/widget/windows/WindowsUIUtils.cpp b/widget/windows/WindowsUIUtils.cpp index b6db95055512..fed69949d72c 100644 --- a/widget/windows/WindowsUIUtils.cpp +++ b/widget/windows/WindowsUIUtils.cpp @@ -342,11 +342,6 @@ static IInspectable* GetUISettings() { // expected, sigh. static StaticRefPtr sUiSettingsAsInspectable; - if (!IsWin10OrLater()) { - // Windows.UI.ViewManagement.UISettings is Win10+ only. - return nullptr; - } - if (!sUiSettingsAsInspectable) { ComPtr uiSettingsAsInspectable; ::RoActivateInstance( @@ -589,10 +584,6 @@ bool WindowsUIUtils::ComputeTransparencyEffects() { void WindowsUIUtils::UpdateInTabletMode() { #ifndef __MINGW32__ - if (!IsWin10OrLater()) { - return; - } - nsresult rv; nsCOMPtr winMediator( do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv)); @@ -680,10 +671,6 @@ Result ConvertToWindowsString( static Result RequestShare( const std::function& aCallback) { - if (!IsWin10OrLater()) { - return Err(NS_ERROR_FAILURE); - } - HWND hwnd = GetForegroundWindow(); if (!hwnd) { return Err(NS_ERROR_FAILURE); diff --git a/widget/windows/docs/blocklist.rst b/widget/windows/docs/blocklist.rst index 1b7a1a67642d..5450faaa1b68 100644 --- a/widget/windows/docs/blocklist.rst +++ b/widget/windows/docs/blocklist.rst @@ -123,8 +123,6 @@ Parameters | | - A tuple consisting of four digits | | | - A 32-bit integer representing a Unix timestamp with PETimeStamp | +-----------+--------------------------------------------------------------------------------+ -| Flags | BLOCK_WIN8_AND_OLDER \| BLOCK_WIN7_AND_OLDER | -+-----------+--------------------------------------------------------------------------------+ Variable ******** @@ -175,15 +173,6 @@ To specify a version, you can use either of the following formats: - | A 32-bit integer representing a Unix timestamp with PETimeStamp. This is compared to an integer of IMAGE_FILE_HEADER::TimeDateStamp. | Example: PETimeStamp(0x12345678) -Flags -***** - -If you know a problem happens only on older Windows versions, you can use one of -the following flags to narrow down the affected platform. - -- BLOCK_WIN8_AND_OLDER -- BLOCK_WIN7_AND_OLDER - ----------------- Technical details diff --git a/widget/windows/moz.build b/widget/windows/moz.build index 14b218c3d570..b8e3acf239a7 100644 --- a/widget/windows/moz.build +++ b/widget/windows/moz.build @@ -70,7 +70,6 @@ UNIFIED_SOURCES += [ "GfxInfo.cpp", "IEnumFE.cpp", "IMMHandler.cpp", - "InkCollector.cpp", "JumpListItem.cpp", "KeyboardLayout.cpp", "LSPAnnotator.cpp", diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp index 34e3771a314d..2ef6e85e4730 100644 --- a/widget/windows/nsAppShell.cpp +++ b/widget/windows/nsAppShell.cpp @@ -30,7 +30,6 @@ #include "mozilla/widget/ScreenManager.h" #include "mozilla/Atomics.h" #include "mozilla/WindowsProcessMitigations.h" -#include "mozilla/WindowsVersion.h" #ifdef MOZ_BACKGROUNDTASKS # include "mozilla/BackgroundTasks.h" @@ -212,66 +211,13 @@ class WinWakeLockListener final : public nsIDOMMozWakeLockListener { HANDLE mNonDisplayHandle = nullptr; }; NS_IMPL_ISUPPORTS(WinWakeLockListener, nsIDOMMozWakeLockListener) - -// This wakelock is used for the version older than Windows7. -class LegacyWinWakeLockListener final : public nsIDOMMozWakeLockListener { - public: - NS_DECL_ISUPPORTS - LegacyWinWakeLockListener() { MOZ_ASSERT(XRE_IsParentProcess()); } - - private: - ~LegacyWinWakeLockListener() {} - - NS_IMETHOD Callback(const nsAString& aTopic, - const nsAString& aState) override { - WAKE_LOCK_LOG("WinWakeLock: topic=%s, state=%s", - NS_ConvertUTF16toUTF8(aTopic).get(), - NS_ConvertUTF16toUTF8(aState).get()); - if (!aTopic.EqualsASCII("screen") && !aTopic.EqualsASCII("audio-playing") && - !aTopic.EqualsASCII("video-playing")) { - return NS_OK; - } - - // Check what kind of lock we will require, if both display lock and non - // display lock are needed, we would require display lock because it has - // higher priority. - if (aTopic.EqualsASCII("audio-playing")) { - mRequireForNonDisplayLock = aState.EqualsASCII("locked-foreground") || - aState.EqualsASCII("locked-background"); - } else if (aTopic.EqualsASCII("screen") || - aTopic.EqualsASCII("video-playing")) { - mRequireForDisplayLock = aState.EqualsASCII("locked-foreground"); - } - - if (mRequireForDisplayLock) { - WAKE_LOCK_LOG("WinWakeLock: Request display lock"); - SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_CONTINUOUS); - } else if (mRequireForNonDisplayLock) { - WAKE_LOCK_LOG("WinWakeLock: Request non-display lock"); - SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_CONTINUOUS); - } else { - WAKE_LOCK_LOG("WinWakeLock: reset lock"); - SetThreadExecutionState(ES_CONTINUOUS); - } - return NS_OK; - } - - bool mRequireForDisplayLock = false; - bool mRequireForNonDisplayLock = false; -}; - -NS_IMPL_ISUPPORTS(LegacyWinWakeLockListener, nsIDOMMozWakeLockListener) StaticRefPtr sWakeLockListener; static void AddScreenWakeLockListener() { nsCOMPtr sPowerManagerService = do_GetService(POWERMANAGERSERVICE_CONTRACTID); if (sPowerManagerService) { - if (IsWin7SP1OrLater()) { - sWakeLockListener = new WinWakeLockListener(); - } else { - sWakeLockListener = new LegacyWinWakeLockListener(); - } + sWakeLockListener = new WinWakeLockListener(); sPowerManagerService->AddWakeLockListener(sWakeLockListener); } else { NS_WARNING( diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp index 7ea7c9399346..7ed517236463 100644 --- a/widget/windows/nsLookAndFeel.cpp +++ b/widget/windows/nsLookAndFeel.cpp @@ -15,7 +15,6 @@ #include "WindowsUIUtils.h" #include "mozilla/FontPropertyTypes.h" #include "mozilla/Telemetry.h" -#include "mozilla/WindowsVersion.h" #include "gfxFontConstants.h" #include "gfxWindowsPlatform.h" @@ -39,11 +38,6 @@ static int32_t GetSystemParam(long flag, int32_t def) { } static nsresult SystemWantsDarkTheme(int32_t& darkThemeEnabled) { - if (!IsWin10OrLater()) { - darkThemeEnabled = 0; - return NS_OK; - } - nsresult rv = NS_OK; nsCOMPtr personalizeKey = do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv); diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index 550b186238ea..19fe2772351a 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -19,7 +19,6 @@ #include "mozilla/RelativeLuminanceUtils.h" #include "mozilla/StaticPrefs_layout.h" #include "mozilla/StaticPrefs_widget.h" -#include "mozilla/WindowsVersion.h" #include "mozilla/dom/XULButtonElement.h" #include "nsColor.h" #include "nsComboboxControlFrame.h" @@ -981,8 +980,8 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, static bool AssumeThemePartAndStateAreTransparent(int32_t aPart, int32_t aState) { - if (!(IsWin8Point1OrLater() && nsUXThemeData::IsHighContrastOn()) && - aPart == MENU_POPUPITEM && aState == MBI_NORMAL) { + if (!nsUXThemeData::IsHighContrastOn() && aPart == MENU_POPUPITEM && + aState == MBI_NORMAL) { return true; } return false; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 6b8807613735..1c9bc14d6988 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -205,8 +205,6 @@ #include -#include "InkCollector.h" - // ERROR from wingdi.h (below) gets undefined by some code. // #define ERROR 0 // #define RGN_ERROR ERROR @@ -300,8 +298,7 @@ static SystemTimeConverter& TimeConverter() { // Global event hook for window cloaking. Never deregistered. // - `Nothing` if not yet set. // - `Some(nullptr)` if no attempt should be made to set it. -static mozilla::Maybe sWinCloakEventHook = - IsWin8OrLater() ? Nothing() : Some(HWINEVENTHOOK(nullptr)); +static mozilla::Maybe sWinCloakEventHook = Nothing(); static mozilla::LazyLogModule sCloakingLog("DWMCloaking"); namespace mozilla { @@ -420,10 +417,6 @@ class TIPMessageHandler { } static void Initialize() { - if (!IsWin8OrLater()) { - return; - } - if (sInstance) { return; } @@ -457,16 +450,6 @@ class TIPMessageHandler { ::GetCurrentThreadId()); MOZ_ASSERT(mHook); - // On touchscreen devices, tiptsf.dll will have been loaded when STA COM was - // first initialized. - if (!IsWin10OrLater() && GetModuleHandle(L"tiptsf.dll") && - !sProcessCaretEventsStub) { - sTipTsfInterceptor.Init("tiptsf.dll"); - DebugOnly ok = sProcessCaretEventsStub.Set( - sTipTsfInterceptor, "ProcessCaretEvents", &ProcessCaretEventsHook); - MOZ_ASSERT(ok); - } - if (!sSendMessageTimeoutWStub) { sUser32Intercept.Init("user32.dll"); DebugOnly hooked = sSendMessageTimeoutWStub.Set( @@ -513,16 +496,6 @@ class TIPMessageHandler { return ::CallNextHookEx(nullptr, aCode, aWParam, aLParam); } - static void CALLBACK ProcessCaretEventsHook(HWINEVENTHOOK aWinEventHook, - DWORD aEvent, HWND aHwnd, - LONG aObjectId, LONG aChildId, - DWORD aGeneratingTid, - DWORD aEventTime) { - A11yInstantiationBlocker block; - sProcessCaretEventsStub(aWinEventHook, aEvent, aHwnd, aObjectId, aChildId, - aGeneratingTid, aEventTime); - } - static LRESULT WINAPI SendMessageTimeoutWHook(HWND aHwnd, UINT aMsgCode, WPARAM aWParam, LPARAM aLParam, UINT aFlags, UINT aTimeout, @@ -546,9 +519,6 @@ class TIPMessageHandler { return static_cast(TRUE); } - static WindowsDllInterceptor sTipTsfInterceptor; - static WindowsDllInterceptor::FuncHookType - sProcessCaretEventsStub; static WindowsDllInterceptor::FuncHookType sSendMessageTimeoutWStub; static StaticAutoPtr sInstance; @@ -558,9 +528,6 @@ class TIPMessageHandler { uint32_t mA11yBlockCount; }; -WindowsDllInterceptor TIPMessageHandler::sTipTsfInterceptor; -WindowsDllInterceptor::FuncHookType - TIPMessageHandler::sProcessCaretEventsStub; WindowsDllInterceptor::FuncHookType TIPMessageHandler::sSendMessageTimeoutWStub; StaticAutoPtr TIPMessageHandler::sInstance; @@ -591,10 +558,6 @@ class InitializeVirtualDesktopManagerTask : public Task { #endif virtual bool Run() override { - if (!IsWin10OrLater()) { - return true; - } - RefPtr desktopManager; HRESULT hr = ::CoCreateInstance( CLSID_VirtualDesktopManager, NULL, CLSCTX_INPROC_SERVER, @@ -766,9 +729,6 @@ nsWindow::nsWindow(bool aIsChildWindow) // Init theme data nsUXThemeData::UpdateNativeThemeInfo(); RedirectedKeyDownMessageManager::Forget(); - if (mPointerEvents.ShouldEnableInkCollector()) { - InkCollector::sInkCollector = new InkCollector(); - } } // !sInstanceCount sInstanceCount++; @@ -793,10 +753,6 @@ nsWindow::~nsWindow() { // Global shutdown if (sInstanceCount == 0) { - if (InkCollector::sInkCollector) { - InkCollector::sInkCollector->Shutdown(); - InkCollector::sInkCollector = nullptr; - } IMEHandler::Terminate(); sCurrentCursor = {}; if (sIsOleInitialized) { @@ -884,13 +840,6 @@ void nsWindow::RecreateDirectManipulationIfNeeded() { return; } - if (!IsWin10OrLater()) { - // Chrome source said the Windows Direct Manipulation implementation had - // important bugs until Windows 10 (although IE on Windows 8.1 seems to use - // Direct Manipulation). - return; - } - mDmOwner = MakeUnique(this); LayoutDeviceIntRect bounds(mBounds.X(), mBounds.Y(), mBounds.Width(), @@ -959,24 +908,10 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, DWORD style = WindowStyle(); DWORD extendedStyle = WindowExStyle(); - // When window is PiP window on Windows7, WS_EX_COMPOSITED is set to suppress - // flickering during resizing with hardware acceleration. - bool isPIPWindow = aInitData && aInitData->mPIPWindow; - if (isPIPWindow && !IsWin8OrLater() && - gfxConfig::IsEnabled(gfx::Feature::HW_COMPOSITING) && - WidgetTypeSupportsAcceleration()) { - extendedStyle |= WS_EX_COMPOSITED; - } - if (mWindowType == WindowType::Popup) { if (!aParent) { parent = nullptr; } - - if (!IsWin8OrLater() && HasBogusPopupsDropShadowOnMultiMonitor() && - ShouldUseOffMainThreadCompositing()) { - extendedStyle |= WS_EX_COMPOSITED; - } } else if (mWindowType == WindowType::Invisible) { // Make sure CreateWindowEx succeeds at creating a toplevel window style &= ~0x40000000; // WS_CHILDWINDOW @@ -2691,9 +2626,6 @@ void nsWindow::UpdateGetWindowInfoCaptionStatus(bool aActiveCaption) { #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 void nsWindow::UpdateDarkModeToolbar() { - if (!IsWin10OrLater()) { - return; - } LookAndFeel::EnsureColorSchemesInitialized(); BOOL dark = LookAndFeel::ColorSchemeForChrome() == ColorScheme::Dark; DwmSetWindowAttribute(mWnd, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &dark, @@ -2873,14 +2805,12 @@ bool nsWindow::UpdateNonClientMargins(bool aReflowWindow) { mNonClientOffset.bottom -= kHiddenTaskbarSize; } - // On Windows 10+, when we are drawing the non-client region, we need + // When we are drawing the non-client region, we need // to clear the portion of the NC region that is exposed by the // hidden taskbar. As above, we clear the bottom of the NC region // when the taskbar is at the top of the screen. - if (IsWin10OrLater()) { - UINT clearEdge = (edge == ABE_TOP) ? ABE_BOTTOM : edge; - mClearNCEdge = Some(clearEdge); - } + UINT clearEdge = (edge == ABE_TOP) ? ABE_BOTTOM : edge; + mClearNCEdge = Some(clearEdge); } } else { mNonClientOffset = NormalWindowNonClientOffset(); @@ -4418,17 +4348,6 @@ bool nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam, uint32_t pointerId = aPointerInfo ? aPointerInfo->pointerId : MOUSE_POINTERID(); - // Since it is unclear whether a user will use the digitizer, - // Postpone initialization until first PEN message will be found. - if (MouseEvent_Binding::MOZ_SOURCE_PEN == aInputSource - // Messages should be only at topLevel window. - && WindowType::TopLevel == mWindowType - // Currently this scheme is used only when pointer events is enabled. - && InkCollector::sInkCollector) { - InkCollector::sInkCollector->SetTarget(mWnd); - InkCollector::sInkCollector->SetPointerId(pointerId); - } - switch (aEventMessage) { case eMouseDown: CaptureMouse(true); @@ -5595,21 +5514,6 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam, MouseButton::ePrimary, MOUSE_INPUT_SOURCE()); } break; - case MOZ_WM_PEN_LEAVES_HOVER_OF_DIGITIZER: { - LPARAM pos = lParamToClient(::GetMessagePos()); - MOZ_ASSERT(InkCollector::sInkCollector); - uint16_t pointerId = InkCollector::sInkCollector->GetPointerId(); - if (pointerId != 0) { - WinPointerInfo pointerInfo; - pointerInfo.pointerId = pointerId; - DispatchMouseEvent(eMouseExitFromWidget, wParam, pos, false, - MouseButton::ePrimary, - MouseEvent_Binding::MOZ_SOURCE_PEN, &pointerInfo); - InkCollector::sInkCollector->ClearTarget(); - InkCollector::sInkCollector->ClearPointerId(); - } - } break; - case WM_CONTEXTMENU: { // If the context menu is brought up by a touch long-press, then // the APZ code is responsible for dealing with this, so we don't @@ -7486,7 +7390,6 @@ void nsWindow::OnDPIChanged(int32_t x, int32_t y, int32_t width, /* static */ void nsWindow::OnCloakEvent(HWND aWnd, bool aCloaked) { MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(IsWin8OrLater()); const char* const kEventName = aCloaked ? "CLOAKED" : "UNCLOAKED"; nsWindow* pWin = WinUtils::GetNSWindowPtr(aWnd); @@ -9098,25 +9001,6 @@ nsresult nsWindow::RestoreHiDPIMode() { return WinUtils::RestoreHiDPIMode(); } mozilla::Maybe nsWindow::GetHiddenTaskbarEdge() { HMONITOR windowMonitor = ::MonitorFromWindow(mWnd, MONITOR_DEFAULTTONEAREST); - if (!IsWin8OrLater()) { - // Per-monitor taskbar information is not available. - APPBARDATA appBarData; - appBarData.cbSize = sizeof(appBarData); - UINT taskbarState = SHAppBarMessage(ABM_GETSTATE, &appBarData); - if (ABS_AUTOHIDE & taskbarState) { - appBarData.hWnd = FindWindow(L"Shell_TrayWnd", nullptr); - if (appBarData.hWnd) { - HMONITOR taskbarMonitor = - ::MonitorFromWindow(appBarData.hWnd, MONITOR_DEFAULTTOPRIMARY); - if (taskbarMonitor == windowMonitor) { - SHAppBarMessage(ABM_GETTASKBARPOS, &appBarData); - return Some(appBarData.uEdge); - } - } - } - return Nothing(); - } - // Check all four sides of our monitor for an appbar. Skip any that aren't // the system taskbar. MONITORINFO mi; diff --git a/widget/windows/nsWindowTaskbarConcealer.cpp b/widget/windows/nsWindowTaskbarConcealer.cpp index 075da707bb38..71c6ad163bb5 100644 --- a/widget/windows/nsWindowTaskbarConcealer.cpp +++ b/widget/windows/nsWindowTaskbarConcealer.cpp @@ -10,7 +10,6 @@ #include "mozilla/Logging.h" #include "mozilla/StaticPrefs_widget.h" -#include "mozilla/WindowsVersion.h" #include "WinUtils.h" using namespace mozilla; @@ -264,69 +263,6 @@ void nsWindow::TaskbarConcealer::UpdateAllState( // Mark this window as requesting to occlude the taskbar. (The caller is // responsible for keeping any local state up-to-date.) void TaskbarConcealerImpl::MarkAsHidingTaskbar(HWND aWnd, bool aMark) { - // USE OF UNDOCUMENTED BEHAVIOR: - // - // `MarkFullscreenWindow` is documented not to be sufficient. It will indeed - // cause a window to be treated as fullscreen; but, in its absence, Windows - // will also use explicitly undocumented heuristics to determine whether or - // not to treat a given window as full-screen. - // - // In Windows 8.1 and later, these heuristics don't seem to apply to us. - // However, in Windows 7, they do -- they determine that our fullscreen - // windows are, indeed, fullscreen. (That this is technically correct is of - // little importance, given that Windows then goes on to do the wrong thing - // with that knowledge.) - // - // Fortunately, `MarkFullscreenWindow` does have a converse: the `NonRudeHWND` - // window property. A window with this property set will not be treated as - // fullscreen. - // - // === - // - // DIFFERENCE FROM DOCUMENTED BEHAVIOR: - // - // The documentation, as it was at the time of writing, is archived at: - // https://web.archive.org/web/20211223073250/https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist2-markfullscreenwindow - // - // The most relevant paragraph follows: - // - // > **Since Windows 7**, call `SetProp(hwnd, L”NonRudeHWND”, - // > reinterpret_cast(TRUE))` before showing a window to indicate to - // > the Shell that the window should not be treated as full-screen. - // - // The key words in that paragraph are "before showing a window". On Windows 7 - // this has no particular effect, but it completely changes the behavior on - // Windows 8.1 and Windows 10 -- if `NonRudeHWND` is set on a window before it - // is shown, that window will not be treated as fullscreen **even if the - // property is later removed!** - // - // `NonRudeHWND` isn't actually documented to do anything at all if it's set - // after the window has already been shown. That it seems to do exactly what - // we need on Windows 7 -- prevent a window from being detected as fullscreen - // while it's set, and only then -- is a stroke of fortune. - - static const bool kUseWin7MarkingHack = [&] { - switch (StaticPrefs::widget_windows_fullscreen_marking_workaround()) { - case -1: - return false; - case 1: - return true; - default: - // The behavior on Windows 8 is not known. Hopefully there are no - // side effects there. - return !mozilla::IsWin8Point1OrLater(); - } - }(); - - if (kUseWin7MarkingHack) { - constexpr static LPCWSTR kPropName = L"NonRudeHWND"; - if (aMark) { - ::RemovePropW(aWnd, kPropName); - } else { - ::SetPropW(aWnd, kPropName, reinterpret_cast(TRUE)); - } - } - const char* const sMark = aMark ? "true" : "false"; if (!mTaskbarInfo) {