mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1844908 - Remove pre-Win10-specific codepath from widget/. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D184307
This commit is contained in:
parent
f37aa4efb5
commit
9ec38aeba1
@ -15564,19 +15564,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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 <msinkaut_i.c>
|
||||
|
||||
mozilla::StaticAutoPtr<InkCollector> 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<IConnectionPointContainer> 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<IInkCursor*>(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);
|
||||
}
|
||||
}
|
@ -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 <objbase.h>
|
||||
#include <msinkaut.h>
|
||||
#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<InkCollector> sInkCollector;
|
||||
|
||||
protected:
|
||||
void Initialize();
|
||||
void OnInitialize();
|
||||
void Enable(bool aNewState);
|
||||
|
||||
private:
|
||||
RefPtr<IUnknown> mMarshaller;
|
||||
RefPtr<IInkCollector> mInkCollector;
|
||||
RefPtr<IConnectionPoint> mConnectionPoint;
|
||||
RefPtr<InkCollectorEvent> 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__
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -490,9 +490,9 @@ ComPtr<IXmlDocument> 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<IXmlNodeList> 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<IToastNotification2> notification2;
|
||||
hr = mNotification.As(¬ification2);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), false);
|
||||
ComPtr<IToastNotification2> 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<IToastNotificationManagerStatics> toastNotificationManagerStatics =
|
||||
GetToastNotificationManagerStatics();
|
||||
@ -958,24 +955,20 @@ HRESULT
|
||||
ToastNotificationHandler::OnDismiss(
|
||||
const ComPtr<IToastNotification>& notification,
|
||||
const ComPtr<IToastDismissedEventArgs>& aArgs) {
|
||||
// Multiple dismiss events only occur on Windows 10 and later, prior versions
|
||||
// of Windows didn't include `IToastNotification2`.
|
||||
if (IsWin10OrLater()) {
|
||||
ComPtr<IToastNotification2> notification2;
|
||||
HRESULT hr = notification.As(¬ification2);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL);
|
||||
ComPtr<IToastNotification2> 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();
|
||||
|
@ -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<TOKEN_ELEVATION_TYPE> GetElevationType(
|
||||
}
|
||||
|
||||
inline bool HasPackageIdentity() {
|
||||
if (!IsWin8OrLater()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HMODULE kernel32Dll = ::GetModuleHandleW(L"kernel32");
|
||||
if (!kernel32Dll) {
|
||||
return false;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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<int>::max()) {
|
||||
// The DPI setting hasn't been changed.
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
@ -880,10 +880,6 @@ void WinWindowOcclusionTracker::WindowOcclusionCalculator::Initialize() {
|
||||
CALC_LOG(LogLevel::Info, "Initialize()");
|
||||
|
||||
#ifndef __MINGW32__
|
||||
if (!IsWin10OrLater()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<IVirtualDesktopManager> desktopManager;
|
||||
HRESULT hr = ::CoCreateInstance(
|
||||
CLSID_VirtualDesktopManager, NULL, CLSCTX_INPROC_SERVER,
|
||||
|
@ -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;
|
||||
|
@ -342,11 +342,6 @@ static IInspectable* GetUISettings() {
|
||||
// expected, sigh.
|
||||
static StaticRefPtr<IInspectable> sUiSettingsAsInspectable;
|
||||
|
||||
if (!IsWin10OrLater()) {
|
||||
// Windows.UI.ViewManagement.UISettings is Win10+ only.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!sUiSettingsAsInspectable) {
|
||||
ComPtr<IInspectable> uiSettingsAsInspectable;
|
||||
::RoActivateInstance(
|
||||
@ -589,10 +584,6 @@ bool WindowsUIUtils::ComputeTransparencyEffects() {
|
||||
|
||||
void WindowsUIUtils::UpdateInTabletMode() {
|
||||
#ifndef __MINGW32__
|
||||
if (!IsWin10OrLater()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWindowMediator> winMediator(
|
||||
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv));
|
||||
@ -680,10 +671,6 @@ Result<HStringUniquePtr, HRESULT> ConvertToWindowsString(
|
||||
|
||||
static Result<Ok, nsresult> RequestShare(
|
||||
const std::function<HRESULT(IDataRequestedEventArgs* pArgs)>& aCallback) {
|
||||
if (!IsWin10OrLater()) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
HWND hwnd = GetForegroundWindow();
|
||||
if (!hwnd) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
|
@ -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
|
||||
|
@ -70,7 +70,6 @@ UNIFIED_SOURCES += [
|
||||
"GfxInfo.cpp",
|
||||
"IEnumFE.cpp",
|
||||
"IMMHandler.cpp",
|
||||
"InkCollector.cpp",
|
||||
"JumpListItem.cpp",
|
||||
"KeyboardLayout.cpp",
|
||||
"LSPAnnotator.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<nsIDOMMozWakeLockListener> sWakeLockListener;
|
||||
|
||||
static void AddScreenWakeLockListener() {
|
||||
nsCOMPtr<nsIPowerManagerService> 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(
|
||||
|
@ -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<nsIWindowsRegKey> personalizeKey =
|
||||
do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
|
||||
|
@ -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;
|
||||
|
@ -205,8 +205,6 @@
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
#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<DWORD>& 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<HWINEVENTHOOK> sWinCloakEventHook =
|
||||
IsWin8OrLater() ? Nothing() : Some(HWINEVENTHOOK(nullptr));
|
||||
static mozilla::Maybe<HWINEVENTHOOK> 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<bool> ok = sProcessCaretEventsStub.Set(
|
||||
sTipTsfInterceptor, "ProcessCaretEvents", &ProcessCaretEventsHook);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
|
||||
if (!sSendMessageTimeoutWStub) {
|
||||
sUser32Intercept.Init("user32.dll");
|
||||
DebugOnly<bool> 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<LRESULT>(TRUE);
|
||||
}
|
||||
|
||||
static WindowsDllInterceptor sTipTsfInterceptor;
|
||||
static WindowsDllInterceptor::FuncHookType<WINEVENTPROC>
|
||||
sProcessCaretEventsStub;
|
||||
static WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||
sSendMessageTimeoutWStub;
|
||||
static StaticAutoPtr<TIPMessageHandler> sInstance;
|
||||
@ -558,9 +528,6 @@ class TIPMessageHandler {
|
||||
uint32_t mA11yBlockCount;
|
||||
};
|
||||
|
||||
WindowsDllInterceptor TIPMessageHandler::sTipTsfInterceptor;
|
||||
WindowsDllInterceptor::FuncHookType<WINEVENTPROC>
|
||||
TIPMessageHandler::sProcessCaretEventsStub;
|
||||
WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||
TIPMessageHandler::sSendMessageTimeoutWStub;
|
||||
StaticAutoPtr<TIPMessageHandler> TIPMessageHandler::sInstance;
|
||||
@ -592,10 +559,6 @@ class InitializeVirtualDesktopManagerTask : public Task {
|
||||
#endif
|
||||
|
||||
virtual bool Run() override {
|
||||
if (!IsWin10OrLater()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<IVirtualDesktopManager> desktopManager;
|
||||
HRESULT hr = ::CoCreateInstance(
|
||||
CLSID_VirtualDesktopManager, NULL, CLSCTX_INPROC_SERVER,
|
||||
@ -767,9 +730,6 @@ nsWindow::nsWindow(bool aIsChildWindow)
|
||||
// Init theme data
|
||||
nsUXThemeData::UpdateNativeThemeInfo();
|
||||
RedirectedKeyDownMessageManager::Forget();
|
||||
if (mPointerEvents.ShouldEnableInkCollector()) {
|
||||
InkCollector::sInkCollector = new InkCollector();
|
||||
}
|
||||
} // !sInstanceCount
|
||||
|
||||
sInstanceCount++;
|
||||
@ -794,10 +754,6 @@ nsWindow::~nsWindow() {
|
||||
|
||||
// Global shutdown
|
||||
if (sInstanceCount == 0) {
|
||||
if (InkCollector::sInkCollector) {
|
||||
InkCollector::sInkCollector->Shutdown();
|
||||
InkCollector::sInkCollector = nullptr;
|
||||
}
|
||||
IMEHandler::Terminate();
|
||||
sCurrentCursor = {};
|
||||
if (sIsOleInitialized) {
|
||||
@ -885,13 +841,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<DirectManipulationOwner>(this);
|
||||
|
||||
LayoutDeviceIntRect bounds(mBounds.X(), mBounds.Y(), mBounds.Width(),
|
||||
@ -960,24 +909,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
|
||||
@ -2692,9 +2627,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,
|
||||
@ -2874,14 +2806,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();
|
||||
@ -4419,17 +4349,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);
|
||||
@ -5596,21 +5515,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
|
||||
@ -7487,7 +7391,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);
|
||||
@ -9086,25 +8989,6 @@ nsresult nsWindow::RestoreHiDPIMode() { return WinUtils::RestoreHiDPIMode(); }
|
||||
mozilla::Maybe<UINT> 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;
|
||||
|
@ -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<HANDLE>(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<HANDLE>(TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
const char* const sMark = aMark ? "true" : "false";
|
||||
|
||||
if (!mTaskbarInfo) {
|
||||
|
Loading…
Reference in New Issue
Block a user