summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widget/GfxInfoBase.cpp8
-rw-r--r--widget/LookAndFeel.h1
-rw-r--r--widget/windows/GfxInfo.cpp79
-rw-r--r--widget/windows/KeyboardLayout.cpp62
-rw-r--r--widget/windows/KeyboardLayout.h5
-rw-r--r--widget/windows/TSFTextStore.cpp3
-rw-r--r--widget/windows/WinMouseScrollHandler.cpp7
-rw-r--r--widget/windows/WinTaskbar.cpp5
-rw-r--r--widget/windows/WinUtils.cpp57
-rw-r--r--widget/windows/nsDataObj.cpp3
-rw-r--r--widget/windows/nsFilePicker.cpp542
-rw-r--r--widget/windows/nsFilePicker.h19
-rw-r--r--widget/windows/nsLookAndFeel.cpp17
-rw-r--r--widget/windows/nsNativeThemeWin.cpp463
-rw-r--r--widget/windows/nsNativeThemeWin.h3
-rw-r--r--widget/windows/nsUXThemeConstants.h2
-rw-r--r--widget/windows/nsUXThemeData.cpp8
-rw-r--r--widget/windows/nsWindow.cpp74
-rw-r--r--widget/windows/nsWindow.h3
19 files changed, 199 insertions, 1162 deletions
diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp
index e53db69c5..5c8693957 100644
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -245,13 +245,7 @@ RemovePrefForDriverVersion()
static OperatingSystem
BlacklistOSToOperatingSystem(const nsAString& os)
{
- if (os.EqualsLiteral("WINNT 5.1"))
- return OperatingSystem::WindowsXP;
- else if (os.EqualsLiteral("WINNT 5.2"))
- return OperatingSystem::WindowsServer2003;
- else if (os.EqualsLiteral("WINNT 6.0"))
- return OperatingSystem::WindowsVista;
- else if (os.EqualsLiteral("WINNT 6.1"))
+ if (os.EqualsLiteral("WINNT 6.1"))
return OperatingSystem::Windows7;
else if (os.EqualsLiteral("WINNT 6.2"))
return OperatingSystem::Windows8;
diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h
index e2502c559..443852330 100644
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -440,6 +440,7 @@ public:
* Operating system versions.
*/
enum OperatingSystemVersion {
+ // XXX: The XP and Vista values can now be removed (see bug 1330146).
eOperatingSystemVersion_WindowsXP = 0,
eOperatingSystemVersion_WindowsVista,
eOperatingSystemVersion_Windows7,
diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp
index 0cbd323de..bfea41851 100644
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -241,9 +241,6 @@ ParseIDFromDeviceID(const nsAString &key, const char *prefix, int length)
// based on http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx
enum {
kWindowsUnknown = 0,
- kWindowsXP = 0x50001,
- kWindowsServer2003 = 0x50002,
- kWindowsVista = 0x60000,
kWindows7 = 0x60001,
kWindows8 = 0x60002,
kWindows8_1 = 0x60003,
@@ -826,12 +823,6 @@ static OperatingSystem
WindowsVersionToOperatingSystem(int32_t aWindowsVersion)
{
switch(aWindowsVersion) {
- case kWindowsXP:
- return OperatingSystem::WindowsXP;
- case kWindowsServer2003:
- return OperatingSystem::WindowsServer2003;
- case kWindowsVista:
- return OperatingSystem::WindowsVista;
case kWindows7:
return OperatingSystem::Windows7;
case kWindows8:
@@ -860,11 +851,6 @@ GfxInfo::GetGfxDriverInfo()
/*
* NVIDIA entries
*/
- APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP,
- (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
- GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
- DRIVER_LESS_THAN_OR_EQUAL, V(6,14,11,8745), "FEATURE_FAILURE_NV_XP", "nVidia driver > 187.45" );
-
/*
* The last 5 digit of the NVIDIA driver version maps to the version that
* NVIDIA uses. The minor version (15, 16, 17) corresponds roughtly to the
@@ -875,33 +861,17 @@ GfxInfo::GetGfxDriverInfo()
* 187.45 (late October 2009) and earlier contain a bug which can cause us
* to crash on shutdown.
*/
- APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista,
- (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
- GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
- DRIVER_LESS_THAN_OR_EQUAL, V(8,15,11,8745),
- "FEATURE_FAILURE_NV_VISTA_15", "nVidia driver > 187.45" );
APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::Windows7,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN_OR_EQUAL, V(8,15,11,8745),
"FEATURE_FAILURE_NV_W7_15", "nVidia driver > 187.45" );
- APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::WindowsVista,
- (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
- GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
- DRIVER_BETWEEN_INCLUSIVE_START, V(8,16,10,0000), V(8,16,11,8745),
- "FEATURE_FAILURE_NV_VISTA_16", "nVidia driver > 187.45" );
APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::Windows7,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_BETWEEN_INCLUSIVE_START, V(8,16,10,0000), V(8,16,11,8745),
"FEATURE_FAILURE_NV_W7_16", "nVidia driver > 187.45" );
// Telemetry doesn't show any driver in this range so it might not even be required.
- APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::WindowsVista,
- (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
- GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
- DRIVER_BETWEEN_INCLUSIVE_START, V(8,17,10,0000), V(8,17,11,8745),
- "FEATURE_FAILURE_NV_VISTA_17", "nVidia driver > 187.45" );
- // Telemetry doesn't show any driver in this range so it might not even be required.
APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::Windows7,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
@@ -999,13 +969,6 @@ GfxInfo::GetGfxDriverInfo()
nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
DRIVER_BUILD_ID_LESS_THAN, driverVer, ruleId )
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::WindowsVista, IntelGMA500, 1006, "FEATURE_FAILURE_594877_1");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::WindowsVista, IntelGMA900, GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_594877_2");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::WindowsVista, IntelGMA950, 1504, "FEATURE_FAILURE_594877_3");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::WindowsVista, IntelGMA3150, 2124, "FEATURE_FAILURE_594877_4");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::WindowsVista, IntelGMAX3000, 1666, "FEATURE_FAILURE_594877_5");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::WindowsVista, IntelHDGraphicsToSandyBridge, 2202, "FEATURE_FAILURE_594877_6");
-
IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::Windows7, IntelGMA500, 2026, "FEATURE_FAILURE_594877_7");
IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::Windows7, IntelGMA900, GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_594877_8");
IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::Windows7, IntelGMA950, 1930, "FEATURE_FAILURE_594877_9");
@@ -1022,31 +985,6 @@ GfxInfo::GetGfxDriverInfo()
nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_1180379");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP, IntelGMA500, V(3,0,20,3200), "FEATURE_FAILURE_INTEL_1");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP, IntelGMA900, V(6,14,10,4764), "FEATURE_FAILURE_INTEL_2");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP, IntelGMA950, V(6,14,10,4926), "FEATURE_FAILURE_INTEL_3");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP, IntelGMA3150, V(6,14,10,5134), "FEATURE_FAILURE_INTEL_4");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP, IntelGMAX3000, V(6,14,10,5218), "FEATURE_FAILURE_INTEL_5");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP, IntelGMAX4500HD, V(6,14,10,4969), "FEATURE_FAILURE_INTEL_6");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsXP, IntelHDGraphicsToSandyBridge, V(6,14,10,4969), "FEATURE_FAILURE_INTEL_7");
-
- // StrechRect seems to suffer from precision issues which leads to artifacting
- // during content drawing starting with at least version 6.14.10.5082
- // and going until 6.14.10.5218. See bug 919454 and bug 949275 for more info.
- APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::WindowsXP,
- const_cast<nsAString&>(GfxDriverInfo::GetDeviceVendor(VendorIntel)),
- const_cast<GfxDeviceFamily*>(GfxDriverInfo::GetDeviceFamily(IntelGMAX4500HD)),
- GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
- DRIVER_BETWEEN_EXCLUSIVE, V(6,14,10,5076), V(6,14,10,5218), "FEATURE_FAILURE_INTEL_8", "6.14.10.5218");
-
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista, IntelGMA500, V(3,0,20,3200), "FEATURE_FAILURE_INTEL_9");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista, IntelGMA900, GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_INTEL_10");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista, IntelGMA950, V(7,14,10,1504), "FEATURE_FAILURE_INTEL_11");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista, IntelGMA3150, V(7,14,10,1910), "FEATURE_FAILURE_INTEL_12");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista, IntelGMAX3000, V(7,15,10,1666), "FEATURE_FAILURE_INTEL_13");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista, IntelGMAX4500HD, V(7,15,10,1666), "FEATURE_FAILURE_INTEL_14");
- IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::WindowsVista, IntelHDGraphicsToSandyBridge, V(7,15,10,1666), "FEATURE_FAILURE_INTEL_15");
-
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::Windows7, IntelGMA500, V(5,0,0,2026), "FEATURE_FAILURE_INTEL_16");
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::Windows7, IntelGMA900, GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_INTEL_17");
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(OperatingSystem::Windows7, IntelGMA950, V(8,15,10,1930), "FEATURE_FAILURE_INTEL_18");
@@ -1300,23 +1238,6 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
return NS_OK;
}
- // special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
- // whitelist them, actually we do know that this combination of device and driver version
- // works well.
- if (mWindowsVersion == kWindowsXP &&
- adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
- adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400
- driverVersion == V(6,14,11,7756))
- {
- *aStatus = FEATURE_STATUS_OK;
- return NS_OK;
- }
-
- // Windows Server 2003 should be just like Windows XP for present purpose, but still has a different version number.
- // OTOH Windows Server 2008 R1 and R2 already have the same version numbers as Vista and Seven respectively
- if (os == OperatingSystem::WindowsServer2003)
- os = OperatingSystem::WindowsXP;
-
if (mHasDriverVersionMismatch) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_MISMATCHED_VERSION;
return NS_OK;
diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp
index 11f657874..341a40c18 100644
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1363,34 +1363,6 @@ NativeKey::InitWithKeyChar()
break;
}
- if (!CanComputeVirtualKeyCodeFromScanCode()) {
- // The right control key and the right alt key are extended keys.
- // Therefore, we never get VK_RCONTRL and VK_RMENU for the result of
- // MapVirtualKeyEx() on WinXP or WinServer2003.
- //
- // If VK_SHIFT, VK_CONTROL or VK_MENU key message is caused by well
- // known scan code, we should decide it as Right key. Otherwise,
- // decide it as Left key.
- switch (mOriginalVirtualKeyCode) {
- case VK_CONTROL:
- mVirtualKeyCode =
- mIsExtended && mScanCode == 0x1D ? VK_RCONTROL : VK_LCONTROL;
- break;
- case VK_MENU:
- mVirtualKeyCode =
- mIsExtended && mScanCode == 0x38 ? VK_RMENU : VK_LMENU;
- break;
- case VK_SHIFT:
- // Neither left shift nor right shift is an extended key,
- // let's use VK_LSHIFT for unknown mapping.
- mVirtualKeyCode = VK_LSHIFT;
- break;
- default:
- MOZ_CRASH("Unsupported mOriginalVirtualKeyCode");
- }
- break;
- }
-
NS_ASSERTION(!mVirtualKeyCode,
"mVirtualKeyCode has been computed already");
@@ -1447,11 +1419,6 @@ NativeKey::InitWithKeyChar()
// scancode, we cannot compute virtual keycode. I.e., with such
// applications, we cannot generate proper KeyboardEvent.code value.
- // We cannot compute the virtual key code from WM_CHAR message on WinXP
- // if it's caused by an extended key.
- if (!CanComputeVirtualKeyCodeFromScanCode()) {
- break;
- }
mVirtualKeyCode = mOriginalVirtualKeyCode =
ComputeVirtualKeyCodeFromScanCodeEx();
NS_ASSERTION(mVirtualKeyCode, "Failed to compute virtual keycode");
@@ -1869,18 +1836,6 @@ NativeKey::GetKeyLocation() const
}
}
-bool
-NativeKey::CanComputeVirtualKeyCodeFromScanCode() const
-{
- // Vista or later supports ScanCodeEx.
- if (IsVistaOrLater()) {
- return true;
- }
- // Otherwise, MapVirtualKeyEx() can compute virtual keycode only with
- // non-extended key.
- return !mIsExtended;
-}
-
uint8_t
NativeKey::ComputeVirtualKeyCodeFromScanCode() const
{
@@ -1894,12 +1849,6 @@ NativeKey::ComputeVirtualKeyCodeFromScanCodeEx() const
// MapVirtualKeyEx() has been improved for supporting extended keys since
// Vista. When we call it for mapping a scancode of an extended key and
// a virtual keycode, we need to add 0xE000 to the scancode.
- // On the other hand, neither WinXP nor WinServer2003 doesn't support 0xE000.
- // Therefore, we have no way to get virtual keycode from scan code of
- // extended keys.
- if (NS_WARN_IF(!CanComputeVirtualKeyCodeFromScanCode())) {
- return 0;
- }
return static_cast<uint8_t>(
::MapVirtualKeyEx(GetScanCodeWithExtendedFlag(), MAPVK_VSC_TO_VK_EX,
mKeyboardLayout));
@@ -1910,8 +1859,7 @@ NativeKey::ComputeScanCodeExFromVirtualKeyCode(UINT aVirtualKeyCode) const
{
return static_cast<uint16_t>(
::MapVirtualKeyEx(aVirtualKeyCode,
- IsVistaOrLater() ? MAPVK_VK_TO_VSC_EX :
- MAPVK_VK_TO_VSC,
+ MAPVK_VK_TO_VSC_EX,
mKeyboardLayout));
}
@@ -4345,8 +4293,7 @@ KeyboardLayout::LoadLayout(HKL aLayout)
if (MOZ_LOG_TEST(sKeyboardLayoutLogger, LogLevel::Verbose)) {
static const UINT kExtendedScanCode[] = { 0x0000, 0xE000 };
- static const UINT kMapType =
- IsVistaOrLater() ? MAPVK_VSC_TO_VK_EX : MAPVK_VSC_TO_VK;
+ static const UINT kMapType = MAPVK_VSC_TO_VK_EX;
MOZ_LOG(sKeyboardLayoutLogger, LogLevel::Verbose,
("Logging virtual keycode values for scancode (0x%p)...",
mKeyboardLayout));
@@ -4358,11 +4305,6 @@ KeyboardLayout::LoadLayout(HKL aLayout)
MOZ_LOG(sKeyboardLayoutLogger, LogLevel::Verbose,
("0x%04X, %s", scanCode, kVirtualKeyName[virtualKeyCode]));
}
- // XP and Server 2003 don't support 0xE0 prefix of the scancode.
- // Therefore, we don't need to continue on them.
- if (!IsVistaOrLater()) {
- break;
- }
}
}
}
diff --git a/widget/windows/KeyboardLayout.h b/widget/windows/KeyboardLayout.h
index dd2ac0bfc..70aacc80e 100644
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -560,11 +560,6 @@ private:
bool GetFollowingCharMessage(MSG& aCharMsg);
/**
- * Whether the key event can compute virtual keycode from the scancode value.
- */
- bool CanComputeVirtualKeyCodeFromScanCode() const;
-
- /**
* Wraps MapVirtualKeyEx() with MAPVK_VSC_TO_VK.
*/
uint8_t ComputeVirtualKeyCodeFromScanCode() const;
diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp
index fb0505aa3..7224126b8 100644
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -5762,8 +5762,7 @@ TSFTextStore::Initialize()
return;
}
- bool enableTsf =
- IsVistaOrLater() && Preferences::GetBool(kPrefNameEnableTSF, false);
+ bool enableTsf = Preferences::GetBool(kPrefNameEnableTSF, false);
MOZ_LOG(sTextStoreLog, LogLevel::Info,
(" TSFTextStore::Initialize(), TSF is %s",
enableTsf ? "enabled" : "disabled"));
diff --git a/widget/windows/WinMouseScrollHandler.cpp b/widget/windows/WinMouseScrollHandler.cpp
index 10937ba51..e157b1be2 100644
--- a/widget/windows/WinMouseScrollHandler.cpp
+++ b/widget/windows/WinMouseScrollHandler.cpp
@@ -992,10 +992,7 @@ MouseScrollHandler::SystemSettings::InitScrollChars()
&mScrollChars, 0)) {
MOZ_LOG(gMouseScrollLog, LogLevel::Info,
("MouseScroll::SystemSettings::InitScrollChars(): ::SystemParametersInfo("
- "SPI_GETWHEELSCROLLCHARS) failed, %s",
- IsVistaOrLater() ?
- "this is unexpected on Vista or later" :
- "but on XP or earlier, this is not a problem"));
+ "SPI_GETWHEELSCROLLCHARS) failed, this is unexpected on Vista or later"));
// XXX Should we use DefaultScrollChars()?
mScrollChars = 1;
}
@@ -1081,7 +1078,7 @@ bool
MouseScrollHandler::SystemSettings::IsOverridingSystemScrollSpeedAllowed()
{
return mScrollLines == DefaultScrollLines() &&
- (!IsVistaOrLater() || mScrollChars == DefaultScrollChars());
+ mScrollChars == DefaultScrollChars();
}
/******************************************************************************
diff --git a/widget/windows/WinTaskbar.cpp b/widget/windows/WinTaskbar.cpp
index 698b7ec0e..a2c553dea 100644
--- a/widget/windows/WinTaskbar.cpp
+++ b/widget/windows/WinTaskbar.cpp
@@ -339,9 +339,6 @@ WinTaskbar::GetDefaultGroupId(nsAString & aDefaultGroupId) {
// (static) Called from AppShell
bool
WinTaskbar::RegisterAppUserModelID() {
- if (!IsWin7OrLater())
- return false;
-
SetCurrentProcessExplicitAppUserModelIDPtr funcAppUserModelID = nullptr;
bool retVal = false;
@@ -372,7 +369,7 @@ NS_IMETHODIMP
WinTaskbar::GetAvailable(bool *aAvailable) {
// ITaskbarList4::HrInit() may fail with shell extensions like blackbox
// installed. Initialize early to return available=false in those cases.
- *aAvailable = IsWin7OrLater() && Initialize();
+ *aAvailable = Initialize();
return NS_OK;
}
diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp
index 149513b2f..418a77182 100644
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -462,7 +462,7 @@ static NtTestAlertPtr sNtTestAlert = nullptr;
void
WinUtils::Initialize()
{
- if (!sDwmDll && IsVistaOrLater()) {
+ if (!sDwmDll) {
sDwmDll = ::LoadLibraryW(kDwmLibraryName);
if (sDwmDll) {
@@ -628,16 +628,14 @@ GETPROCESSDPIAWARENESSPROC sGetProcessDpiAwareness;
static bool
SlowIsPerMonitorDPIAware()
{
- if (IsVistaOrLater()) {
- // Intentionally leak the handle.
- HMODULE shcore =
- LoadLibraryEx(L"shcore", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
- if (shcore) {
- sGetDpiForMonitor =
- (GETDPIFORMONITORPROC) GetProcAddress(shcore, "GetDpiForMonitor");
- sGetProcessDpiAwareness =
- (GETPROCESSDPIAWARENESSPROC) GetProcAddress(shcore, "GetProcessDpiAwareness");
- }
+ // Intentionally leak the handle.
+ HMODULE shcore =
+ LoadLibraryEx(L"shcore", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
+ if (shcore) {
+ sGetDpiForMonitor =
+ (GETDPIFORMONITORPROC) GetProcAddress(shcore, "GetDpiForMonitor");
+ sGetProcessDpiAwareness =
+ (GETPROCESSDPIAWARENESSPROC) GetProcAddress(shcore, "GetProcessDpiAwareness");
}
PROCESS_DPI_AWARENESS dpiAwareness;
return sGetDpiForMonitor && sGetProcessDpiAwareness &&
@@ -760,7 +758,7 @@ static DWORD
GetWaitFlags()
{
DWORD result = MWMO_INPUTAVAILABLE;
- if (IsVistaOrLater() && XRE_IsContentProcess()) {
+ if (XRE_IsContentProcess()) {
result |= MWMO_ALERTABLE;
}
return result;
@@ -1878,7 +1876,7 @@ WinUtils::IsTouchDeviceSupportPresent()
uint32_t
WinUtils::GetMaxTouchPoints()
{
- if (IsWin7OrLater() && IsTouchDeviceSupportPresent()) {
+ if (IsTouchDeviceSupportPresent()) {
return GetSystemMetrics(SM_MAXIMUMTOUCHES);
}
return 0;
@@ -1893,11 +1891,6 @@ typedef DWORD (WINAPI * GetFinalPathNameByHandlePtr)(HANDLE hFile,
bool
WinUtils::ResolveJunctionPointsAndSymLinks(std::wstring& aPath)
{
- // Users folder was introduced with Vista.
- if (!IsVistaOrLater()) {
- return true;
- }
-
wchar_t path[MAX_PATH] = { 0 };
nsAutoHandle handle(
@@ -2025,21 +2018,19 @@ WinUtils::GetAppInitDLLs(nsAString& aOutput)
}
nsAutoRegKey key(hkey);
LONG status;
- if (IsVistaOrLater()) {
- const wchar_t kLoadAppInitDLLs[] = L"LoadAppInit_DLLs";
- DWORD loadAppInitDLLs = 0;
- DWORD loadAppInitDLLsLen = sizeof(loadAppInitDLLs);
- status = RegQueryValueExW(hkey, kLoadAppInitDLLs, nullptr,
- nullptr, (LPBYTE)&loadAppInitDLLs,
- &loadAppInitDLLsLen);
- if (status != ERROR_SUCCESS) {
- return false;
- }
- if (!loadAppInitDLLs) {
- // If loadAppInitDLLs is zero then AppInit_DLLs is disabled.
- // In this case we'll return true along with an empty output string.
- return true;
- }
+ const wchar_t kLoadAppInitDLLs[] = L"LoadAppInit_DLLs";
+ DWORD loadAppInitDLLs = 0;
+ DWORD loadAppInitDLLsLen = sizeof(loadAppInitDLLs);
+ status = RegQueryValueExW(hkey, kLoadAppInitDLLs, nullptr,
+ nullptr, (LPBYTE)&loadAppInitDLLs,
+ &loadAppInitDLLsLen);
+ if (status != ERROR_SUCCESS) {
+ return false;
+ }
+ if (!loadAppInitDLLs) {
+ // If loadAppInitDLLs is zero then AppInit_DLLs is disabled.
+ // In this case we'll return true along with an empty output string.
+ return true;
}
DWORD numBytes = 0;
const wchar_t kAppInitDLLs[] = L"AppInit_DLLs";
diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp
index fc45968ae..02ec3b2fe 100644
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -1148,8 +1148,7 @@ nsDataObj :: GetFileContentsInternetShortcut ( FORMATETC& aFE, STGMEDIUM& aSTG )
const char *shortcutFormatStr;
int totalLen;
nsCString path;
- if (!Preferences::GetBool(kShellIconPref, true) ||
- !IsVistaOrLater()) {
+ if (!Preferences::GetBool(kShellIconPref, true)) {
shortcutFormatStr = "[InternetShortcut]\r\nURL=%s\r\n";
const int formatLen = strlen(shortcutFormatStr) - 2; // don't include %s
totalLen = formatLen + asciiUrl.Length(); // don't include null character
diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp
index 53857cf5e..4e942968a 100644
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -28,7 +28,6 @@
#include "nsPIDOMWindow.h"
#include "GeckoProfiler.h"
-using mozilla::IsVistaOrLater;
using mozilla::IsWin8OrLater;
using mozilla::MakeUnique;
using mozilla::mscom::EnsureMTA;
@@ -219,191 +218,6 @@ STDMETHODIMP nsFilePicker::QueryInterface(REFIID refiid, void** ppvResult)
return E_NOINTERFACE;
}
-/*
- * XP picker callbacks
- */
-
-// Show - Display the file dialog
-int CALLBACK
-BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
-{
- if (uMsg == BFFM_INITIALIZED)
- {
- char16_t * filePath = (char16_t *) lpData;
- if (filePath)
- ::SendMessageW(hwnd, BFFM_SETSELECTIONW,
- TRUE /* true because lpData is a path string */,
- lpData);
- }
- return 0;
-}
-
-static void
-EnsureWindowVisible(HWND hwnd)
-{
- // Obtain the monitor which has the largest area of intersection
- // with the window, or nullptr if there is no intersection.
- HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL);
- if (!monitor) {
- // The window is not visible, we should reposition it to the same place as its parent
- HWND parentHwnd = GetParent(hwnd);
- RECT parentRect;
- GetWindowRect(parentHwnd, &parentRect);
- SetWindowPos(hwnd, nullptr, parentRect.left, parentRect.top, 0, 0,
- SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
- }
-}
-
-// Callback hook which will ensure that the window is visible. Currently
-// only in use on os <= XP.
-UINT_PTR CALLBACK
-nsFilePicker::FilePickerHook(HWND hwnd,
- UINT msg,
- WPARAM wParam,
- LPARAM lParam)
-{
- switch(msg) {
- case WM_NOTIFY:
- {
- LPOFNOTIFYW lpofn = (LPOFNOTIFYW) lParam;
- if (!lpofn || !lpofn->lpOFN) {
- return 0;
- }
-
- if (CDN_INITDONE == lpofn->hdr.code) {
- // The Window will be automatically moved to the last position after
- // CDN_INITDONE. We post a message to ensure the window will be visible
- // so it will be done after the automatic last position window move.
- PostMessage(hwnd, MOZ_WM_ENSUREVISIBLE, 0, 0);
- }
- }
- break;
- case MOZ_WM_ENSUREVISIBLE:
- EnsureWindowVisible(GetParent(hwnd));
- break;
- case WM_INITDIALOG:
- {
- OPENFILENAMEW* pofn = reinterpret_cast<OPENFILENAMEW*>(lParam);
- SetProp(hwnd, kDialogPtrProp, (HANDLE)pofn->lCustData);
- nsFilePicker* picker = reinterpret_cast<nsFilePicker*>(pofn->lCustData);
- if (picker) {
- picker->SetDialogHandle(hwnd);
- SetTimer(hwnd, kDialogTimerID, kDialogTimerTimeout, nullptr);
- }
- }
- break;
- case WM_TIMER:
- {
- // Check to see if our parent has been torn down, if so, we close too.
- if (wParam == kDialogTimerID) {
- nsFilePicker* picker =
- reinterpret_cast<nsFilePicker*>(GetProp(hwnd, kDialogPtrProp));
- if (picker && picker->ClosePickerIfNeeded(true)) {
- KillTimer(hwnd, kDialogTimerID);
- }
- }
- }
- break;
- }
- return 0;
-}
-
-
-// Callback hook which will dynamically allocate a buffer large enough
-// for the file picker dialog. Currently only in use on os <= XP.
-UINT_PTR CALLBACK
-nsFilePicker::MultiFilePickerHook(HWND hwnd,
- UINT msg,
- WPARAM wParam,
- LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- {
- // Finds the child drop down of a File Picker dialog and sets the
- // maximum amount of text it can hold when typed in manually.
- // A wParam of 0 mean 0x7FFFFFFE characters.
- HWND comboBox = FindWindowEx(GetParent(hwnd), nullptr,
- L"ComboBoxEx32", nullptr );
- if(comboBox)
- SendMessage(comboBox, CB_LIMITTEXT, 0, 0);
- // Store our nsFilePicker ptr for future use
- OPENFILENAMEW* pofn = reinterpret_cast<OPENFILENAMEW*>(lParam);
- SetProp(hwnd, kDialogPtrProp, (HANDLE)pofn->lCustData);
- nsFilePicker* picker =
- reinterpret_cast<nsFilePicker*>(pofn->lCustData);
- if (picker) {
- picker->SetDialogHandle(hwnd);
- SetTimer(hwnd, kDialogTimerID, kDialogTimerTimeout, nullptr);
- }
- }
- break;
- case WM_NOTIFY:
- {
- LPOFNOTIFYW lpofn = (LPOFNOTIFYW) lParam;
- if (!lpofn || !lpofn->lpOFN) {
- return 0;
- }
- // CDN_SELCHANGE is sent when the selection in the list box of the file
- // selection dialog changes
- if (lpofn->hdr.code == CDN_SELCHANGE) {
- HWND parentHWND = GetParent(hwnd);
-
- // Get the required size for the selected files buffer
- UINT newBufLength = 0;
- int requiredBufLength = CommDlg_OpenSave_GetSpecW(parentHWND,
- nullptr, 0);
- if(requiredBufLength >= 0)
- newBufLength += requiredBufLength;
- else
- newBufLength += MAX_PATH;
-
- // If the user selects multiple files, the buffer contains the
- // current directory followed by the file names of the selected
- // files. So make room for the directory path. If the user
- // selects a single file, it is no harm to add extra space.
- requiredBufLength = CommDlg_OpenSave_GetFolderPathW(parentHWND,
- nullptr, 0);
- if(requiredBufLength >= 0)
- newBufLength += requiredBufLength;
- else
- newBufLength += MAX_PATH;
-
- // Check if lpstrFile and nMaxFile are large enough
- if (newBufLength > lpofn->lpOFN->nMaxFile) {
- if (lpofn->lpOFN->lpstrFile)
- delete[] lpofn->lpOFN->lpstrFile;
-
- // We allocate FILE_BUFFER_SIZE more bytes than is needed so that
- // if the user selects a file and holds down shift and down to
- // select additional items, we will not continuously reallocate
- newBufLength += FILE_BUFFER_SIZE;
-
- wchar_t* filesBuffer = new wchar_t[newBufLength];
- ZeroMemory(filesBuffer, newBufLength * sizeof(wchar_t));
-
- lpofn->lpOFN->lpstrFile = filesBuffer;
- lpofn->lpOFN->nMaxFile = newBufLength;
- }
- }
- }
- break;
- case WM_TIMER:
- {
- // Check to see if our parent has been torn down, if so, we close too.
- if (wParam == kDialogTimerID) {
- nsFilePicker* picker =
- reinterpret_cast<nsFilePicker*>(GetProp(hwnd, kDialogPtrProp));
- if (picker && picker->ClosePickerIfNeeded(true)) {
- KillTimer(hwnd, kDialogTimerID);
- }
- }
- }
- break;
- }
-
- return FilePickerHook(hwnd, msg, wParam, lParam);
-}
/*
* Vista+ callbacks
@@ -476,25 +290,18 @@ nsFilePicker::OnOverwrite(IFileDialog *pfd,
*/
bool
-nsFilePicker::ClosePickerIfNeeded(bool aIsXPDialog)
+nsFilePicker::ClosePickerIfNeeded()
{
if (!mParentWidget || !mDlgWnd)
return false;
nsWindow *win = static_cast<nsWindow *>(mParentWidget.get());
- // Note, the xp callbacks hand us an inner window, so we have to step up
- // one to get the actual dialog.
- HWND dlgWnd;
- if (aIsXPDialog)
- dlgWnd = GetParent(mDlgWnd);
- else
- dlgWnd = mDlgWnd;
- if (IsWindow(dlgWnd) && IsWindowVisible(dlgWnd) && win->DestroyCalled()) {
+ if (IsWindow(mDlgWnd) && IsWindowVisible(mDlgWnd) && win->DestroyCalled()) {
wchar_t className[64];
// Make sure we have the right window
- if (GetClassNameW(dlgWnd, className, mozilla::ArrayLength(className)) &&
+ if (GetClassNameW(mDlgWnd, className, mozilla::ArrayLength(className)) &&
!wcscmp(className, L"#32770") &&
- DestroyWindow(dlgWnd)) {
+ DestroyWindow(mDlgWnd)) {
mDlgWnd = nullptr;
return true;
}
@@ -506,7 +313,7 @@ void
nsFilePicker::PickerCallbackTimerFunc(nsITimer *aTimer, void *aCtx)
{
nsFilePicker* picker = (nsFilePicker*)aCtx;
- if (picker->ClosePickerIfNeeded(false)) {
+ if (picker->ClosePickerIfNeeded()) {
aTimer->Cancel();
}
}
@@ -523,62 +330,15 @@ nsFilePicker::SetDialogHandle(HWND aWnd)
* Folder picker invocation
*/
-// Open the older XP style folder picker dialog. We end up in this call
-// on XP systems or when platform is built without the longhorn SDK.
-bool
-nsFilePicker::ShowXPFolderPicker(const nsString& aInitialDir)
-{
- bool result = false;
-
- auto dirBuffer = MakeUnique<wchar_t[]>(FILE_BUFFER_SIZE);
- wcsncpy(dirBuffer.get(), aInitialDir.get(), FILE_BUFFER_SIZE);
- dirBuffer[FILE_BUFFER_SIZE-1] = '\0';
-
- AutoDestroyTmpWindow adtw((HWND)(mParentWidget.get() ?
- mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
-
- BROWSEINFOW browserInfo = {0};
- browserInfo.pidlRoot = nullptr;
- browserInfo.pszDisplayName = dirBuffer.get();
- browserInfo.lpszTitle = mTitle.get();
- browserInfo.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
- browserInfo.hwndOwner = adtw.get();
- browserInfo.iImage = 0;
- browserInfo.lParam = reinterpret_cast<LPARAM>(this);
-
- if (!aInitialDir.IsEmpty()) {
- // the dialog is modal so that |initialDir.get()| will be valid in
- // BrowserCallbackProc. Thus, we don't need to clone it.
- browserInfo.lParam = (LPARAM) aInitialDir.get();
- browserInfo.lpfn = &BrowseCallbackProc;
- } else {
- browserInfo.lParam = 0;
- browserInfo.lpfn = nullptr;
- }
-
- LPITEMIDLIST list = ::SHBrowseForFolderW(&browserInfo);
- if (list) {
- result = ::SHGetPathFromIDListW(list, dirBuffer.get());
- if (result)
- mUnicodeFile.Assign(static_cast<const wchar_t*>(dirBuffer.get()));
- // free PIDL
- CoTaskMemFree(list);
- }
-
- return result;
-}
-
/*
- * Show a folder picker post Windows XP
- *
+ * Show a folder picker.
+ *
* @param aInitialDir The initial directory, the last used directory will be
* used if left blank.
- * @param aWasInitError Out parameter will hold true if there was an error
- * before the folder picker is shown.
* @return true if a file was selected successfully.
*/
bool
-nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
+nsFilePicker::ShowFolderPicker(const nsString& aInitialDir)
{
if (!IsWin8OrLater()) {
// Some Windows 7 users are experiencing a race condition when some dlls
@@ -593,10 +353,8 @@ nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC,
IID_IFileOpenDialog,
getter_AddRefs(dialog)))) {
- aWasInitError = true;
return false;
}
- aWasInitError = false;
// hook up event callbacks
dialog->Advise(this, &mFDECookie);
@@ -658,233 +416,15 @@ nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
* File open and save picker invocation
*/
-/* static */ bool
-nsFilePicker::GetFileNameWrapper(OPENFILENAMEW* ofn, PickerType aType)
-{
- MOZ_SEH_TRY {
- if (aType == PICKER_TYPE_OPEN)
- return ::GetOpenFileNameW(ofn);
- else if (aType == PICKER_TYPE_SAVE)
- return ::GetSaveFileNameW(ofn);
- } MOZ_SEH_EXCEPT(true) {
- NS_ERROR("nsFilePicker GetFileName win32 call generated an exception! This is bad!");
- }
- return false;
-}
-
-bool
-nsFilePicker::FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType)
-{
- if (!ofn)
- return false;
- AutoWidgetPickerState awps(mParentWidget);
- return GetFileNameWrapper(ofn, aType);
-}
-
-bool
-nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
-{
- OPENFILENAMEW ofn = {0};
- ofn.lStructSize = sizeof(ofn);
- nsString filterBuffer = mFilterList;
-
- auto fileBuffer = MakeUnique<wchar_t[]>(FILE_BUFFER_SIZE);
- wcsncpy(fileBuffer.get(), mDefaultFilePath.get(), FILE_BUFFER_SIZE);
- fileBuffer[FILE_BUFFER_SIZE-1] = '\0'; // null terminate in case copy truncated
-
- if (!aInitialDir.IsEmpty()) {
- ofn.lpstrInitialDir = aInitialDir.get();
- }
-
- AutoDestroyTmpWindow adtw((HWND) (mParentWidget.get() ?
- mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
-
- ofn.lpstrTitle = (LPCWSTR)mTitle.get();
- ofn.lpstrFilter = (LPCWSTR)filterBuffer.get();
- ofn.nFilterIndex = mSelectedType;
- ofn.lpstrFile = fileBuffer.get();
- ofn.nMaxFile = FILE_BUFFER_SIZE;
- ofn.hwndOwner = adtw.get();
- ofn.lCustData = reinterpret_cast<LPARAM>(this);
- ofn.Flags = OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT |
- OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_ENABLESIZING |
- OFN_EXPLORER;
-
- // Windows Vista and up won't allow you to use the new looking dialogs with
- // a hook procedure. The hook procedure fixes a problem on XP dialogs for
- // file picker visibility. Vista and up automatically ensures the file
- // picker is always visible.
- if (!IsVistaOrLater()) {
- ofn.lpfnHook = FilePickerHook;
- ofn.Flags |= OFN_ENABLEHOOK;
- }
-
- // Handle add to recent docs settings
- if (IsPrivacyModeEnabled() || !mAddToRecentDocs) {
- ofn.Flags |= OFN_DONTADDTORECENT;
- }
-
- NS_NAMED_LITERAL_STRING(htmExt, "html");
-
- if (!mDefaultExtension.IsEmpty()) {
- ofn.lpstrDefExt = mDefaultExtension.get();
- } else if (IsDefaultPathHtml()) {
- // Get file extension from suggested filename to detect if we are
- // saving an html file.
- // This is supposed to append ".htm" if user doesn't supply an
- // extension but the behavior is sort of weird:
- // - Often appends ".html" even if you have an extension
- // - It obeys your extension if you put quotes around name
- ofn.lpstrDefExt = htmExt.get();
- }
-
- // When possible, instead of using OFN_NOCHANGEDIR to ensure the current
- // working directory will not change from this call, we will retrieve the
- // current working directory before the call and restore it after the
- // call. This flag causes problems on Windows XP for paths that are
- // selected like C:test.txt where the user is currently at C:\somepath
- // In which case expected result should be C:\somepath\test.txt
- AutoRestoreWorkingPath restoreWorkingPath;
- // If we can't get the current working directory, the best case is to
- // use the OFN_NOCHANGEDIR flag
- if (!restoreWorkingPath.HasWorkingPath()) {
- ofn.Flags |= OFN_NOCHANGEDIR;
- }
-
- bool result = false;
-
- switch(mMode) {
- case modeOpen:
- // FILE MUST EXIST!
- ofn.Flags |= OFN_FILEMUSTEXIST;
- result = FilePickerWrapper(&ofn, PICKER_TYPE_OPEN);
- break;
-
- case modeOpenMultiple:
- ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT;
-
- // The hook set here ensures that the buffer returned will always be
- // large enough to hold all selected files. The hook may modify the
- // value of ofn.lpstrFile and deallocate the old buffer that it pointed
- // to (fileBuffer). The hook assumes that the passed in value is heap
- // allocated and that the returned value should be freed by the caller.
- // If the hook changes the buffer, it will deallocate the old buffer.
- // This fix would be nice to have in Vista and up, but it would force
- // the file picker to use the old style dialogs because hooks are not
- // allowed in the new file picker UI. We need to eventually move to
- // the new Common File Dialogs for Vista and up.
- if (!IsVistaOrLater()) {
- ofn.lpfnHook = MultiFilePickerHook;
- fileBuffer.release();
- result = FilePickerWrapper(&ofn, PICKER_TYPE_OPEN);
- fileBuffer.reset(ofn.lpstrFile);
- } else {
- result = FilePickerWrapper(&ofn, PICKER_TYPE_OPEN);
- }
- break;
-
- case modeSave:
- {
- ofn.Flags |= OFN_NOREADONLYRETURN;
-
- // Don't follow shortcuts when saving a shortcut, this can be used
- // to trick users (bug 271732)
- if (IsDefaultPathLink())
- ofn.Flags |= OFN_NODEREFERENCELINKS;
-
- result = FilePickerWrapper(&ofn, PICKER_TYPE_SAVE);
- if (!result) {
- // Error, find out what kind.
- if (GetLastError() == ERROR_INVALID_PARAMETER ||
- CommDlgExtendedError() == FNERR_INVALIDFILENAME) {
- // Probably the default file name is too long or contains illegal
- // characters. Try again, without a starting file name.
- ofn.lpstrFile[0] = L'\0';
- result = FilePickerWrapper(&ofn, PICKER_TYPE_SAVE);
- }
- }
- }
- break;
-
- default:
- NS_NOTREACHED("unsupported file picker mode");
- return false;
- }
-
- if (!result)
- return false;
-
- // Remember what filter type the user selected
- mSelectedType = (int16_t)ofn.nFilterIndex;
-
- // Single file selection, we're done
- if (mMode != modeOpenMultiple) {
- GetQualifiedPath(fileBuffer.get(), mUnicodeFile);
- return true;
- }
-
- // Set user-selected location of file or directory. From msdn's "Open and
- // Save As Dialog Boxes" section:
- // If you specify OFN_EXPLORER, the directory and file name strings are '\0'
- // separated, with an extra '\0' character after the last file name. This
- // format enables the Explorer-style dialog boxes to return long file names
- // that include spaces.
- wchar_t *current = fileBuffer.get();
-
- nsAutoString dirName(current);
- // Sometimes dirName contains a trailing slash and sometimes it doesn't:
- if (current[dirName.Length() - 1] != '\\')
- dirName.Append((char16_t)'\\');
-
- while (current && *current && *(current + wcslen(current) + 1)) {
- current = current + wcslen(current) + 1;
-
- nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1");
- NS_ENSURE_TRUE(file, false);
-
- // Only prepend the directory if the path specified is a relative path
- nsAutoString path;
- if (PathIsRelativeW(current)) {
- path = dirName + nsDependentString(current);
- } else {
- path = current;
- }
-
- nsAutoString canonicalizedPath;
- GetQualifiedPath(path.get(), canonicalizedPath);
- if (NS_FAILED(file->InitWithPath(canonicalizedPath)) ||
- !mFiles.AppendObject(file))
- return false;
- }
-
- // Handle the case where the user selected just one file. From msdn: If you
- // specify OFN_ALLOWMULTISELECT and the user selects only one file the
- // lpstrFile string does not have a separator between the path and file name.
- if (current && *current && (current == fileBuffer.get())) {
- nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1");
- NS_ENSURE_TRUE(file, false);
-
- nsAutoString canonicalizedPath;
- GetQualifiedPath(current, canonicalizedPath);
- if (NS_FAILED(file->InitWithPath(canonicalizedPath)) ||
- !mFiles.AppendObject(file))
- return false;
- }
-
- return true;
-}
-
/*
- * Show a file picker post Windows XP
- *
+ * Show a file picker.
+ *
* @param aInitialDir The initial directory, the last used directory will be
* used if left blank.
- * @param aWasInitError Out parameter will hold true if there was an error
- * before the file picker is shown.
* @return true if a file was selected successfully.
*/
bool
-nsFilePicker::ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError)
+nsFilePicker::ShowFilePicker(const nsString& aInitialDir)
{
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
@@ -902,18 +442,15 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError)
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC,
IID_IFileOpenDialog,
getter_AddRefs(dialog)))) {
- aWasInitError = true;
return false;
}
} else {
if (FAILED(CoCreateInstance(CLSID_FileSaveDialog, nullptr, CLSCTX_INPROC,
IID_IFileSaveDialog,
getter_AddRefs(dialog)))) {
- aWasInitError = true;
return false;
}
}
- aWasInitError = false;
// hook up event callbacks
dialog->Advise(this, &mFDECookie);
@@ -1080,22 +617,11 @@ nsFilePicker::ShowW(int16_t *aReturnVal)
// with our context set temporarily to system-dpi-aware
WinUtils::AutoSystemDpiAware dpiAwareness;
- // Launch the XP file/folder picker on XP and as a fallback on Vista+.
- // The CoCreateInstance call to CLSID_FileOpenDialog fails with "(0x80040111)
- // ClassFactory cannot supply requested class" when the checkbox for
- // Disable Visual Themes is on in the compatability tab within the shortcut
- // properties.
- bool result = false, wasInitError = true;
+ bool result = false;
if (mMode == modeGetFolder) {
- if (IsVistaOrLater())
- result = ShowFolderPicker(initialDir, wasInitError);
- if (!result && wasInitError)
- result = ShowXPFolderPicker(initialDir);
+ result = ShowFolderPicker(initialDir);
} else {
- if (IsVistaOrLater())
- result = ShowFilePicker(initialDir, wasInitError);
- if (!result && wasInitError)
- result = ShowXPFilePicker(initialDir);
+ result = ShowFilePicker(initialDir);
}
// exit, and return returnCancel in aReturnVal
@@ -1247,48 +773,10 @@ nsFilePicker::InitNative(nsIWidget *aParent,
mTitle.Assign(aTitle);
}
-void
-nsFilePicker::GetQualifiedPath(const wchar_t *aInPath, nsString &aOutPath)
-{
- // Prefer a qualified path over a non qualified path.
- // Things like c:file.txt would be accepted in Win XP but would later
- // fail to open from the download manager.
- wchar_t qualifiedFileBuffer[MAX_PATH];
- if (PathSearchAndQualifyW(aInPath, qualifiedFileBuffer, MAX_PATH)) {
- aOutPath.Assign(qualifiedFileBuffer);
- } else {
- aOutPath.Assign(aInPath);
- }
-}
-
-void
-nsFilePicker::AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter)
-{
- mFilterList.Append(aTitle);
- mFilterList.Append(char16_t('\0'));
-
- if (aFilter.EqualsLiteral("..apps"))
- mFilterList.AppendLiteral("*.exe;*.com");
- else
- {
- nsAutoString filter(aFilter);
- filter.StripWhitespace();
- if (filter.EqualsLiteral("*"))
- filter.AppendLiteral(".*");
- mFilterList.Append(filter);
- }
-
- mFilterList.Append(char16_t('\0'));
-}
-
NS_IMETHODIMP
nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter)
{
- if (IsVistaOrLater()) {
- mComFilterList.Append(aTitle, aFilter);
- } else {
- AppendXPFilter(aTitle, aFilter);
- }
+ mComFilterList.Append(aTitle, aFilter);
return NS_OK;
}
diff --git a/widget/windows/nsFilePicker.h b/widget/windows/nsFilePicker.h
index 90d8c15bc..3d692b3d4 100644
--- a/widget/windows/nsFilePicker.h
+++ b/widget/windows/nsFilePicker.h
@@ -87,32 +87,19 @@ public:
HRESULT STDMETHODCALLTYPE OnOverwrite(IFileDialog *pfd, IShellItem *psi, FDE_OVERWRITE_RESPONSE *pResponse);
protected:
- enum PickerType {
- PICKER_TYPE_OPEN,
- PICKER_TYPE_SAVE,
- };
-
/* method from nsBaseFilePicker */
virtual void InitNative(nsIWidget *aParent,
const nsAString& aTitle);
- static void GetQualifiedPath(const wchar_t *aInPath, nsString &aOutPath);
void GetFilterListArray(nsString& aFilterList);
- static bool GetFileNameWrapper(OPENFILENAMEW* ofn, PickerType aType);
- bool FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType);
- bool ShowXPFolderPicker(const nsString& aInitialDir);
- bool ShowXPFilePicker(const nsString& aInitialDir);
- bool ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError);
- bool ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError);
- void AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter);
+ bool ShowFolderPicker(const nsString& aInitialDir);
+ bool ShowFilePicker(const nsString& aInitialDir);
void RememberLastUsedDirectory();
bool IsPrivacyModeEnabled();
bool IsDefaultPathLink();
bool IsDefaultPathHtml();
void SetDialogHandle(HWND aWnd);
- bool ClosePickerIfNeeded(bool aIsXPDialog);
+ bool ClosePickerIfNeeded();
static void PickerCallbackTimerFunc(nsITimer *aTimer, void *aPicker);
- static UINT_PTR CALLBACK MultiFilePickerHook(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static UINT_PTR CALLBACK FilePickerHook(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
nsCOMPtr<nsILoadContext> mLoadContext;
nsCOMPtr<nsIWidget> mParentWidget;
diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp
index e649802b1..06eee3771 100644
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -32,12 +32,8 @@ nsLookAndFeel::GetOperatingSystemVersion()
version = eOperatingSystemVersion_Windows10;
} else if (IsWin8OrLater()) {
version = eOperatingSystemVersion_Windows8;
- } else if (IsWin7OrLater()) {
- version = eOperatingSystemVersion_Windows7;
- } else if (IsVistaOrLater()) {
- version = eOperatingSystemVersion_WindowsVista;
} else {
- version = eOperatingSystemVersion_WindowsXP;
+ version = eOperatingSystemVersion_Windows7;
}
return version;
@@ -183,8 +179,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
idx = COLOR_HIGHLIGHT;
break;
case eColorID__moz_menubarhovertext:
- if (!IsVistaOrLater() || !IsAppThemed())
- {
+ if (!IsAppThemed()) {
idx = nsUXThemeData::sFlatMenus ?
COLOR_HIGHLIGHTTEXT :
COLOR_MENUTEXT;
@@ -192,8 +187,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
}
// Fall through
case eColorID__moz_menuhovertext:
- if (IsVistaOrLater() && IsAppThemed())
- {
+ if (IsAppThemed()) {
res = ::GetColorFromTheme(eUXMenu,
MENU_POPUPITEM, MPI_HOT, TMT_TEXTCOLOR, aColor);
if (NS_SUCCEEDED(res))
@@ -285,7 +279,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
aColor = NS_RGB(0, 0, 0);
return NS_OK;
case eColorID__moz_win_mediatext:
- if (IsVistaOrLater() && IsAppThemed()) {
+ if (IsAppThemed()) {
res = ::GetColorFromTheme(eUXMediaToolbar,
TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
if (NS_SUCCEEDED(res))
@@ -295,8 +289,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
idx = COLOR_WINDOWTEXT;
break;
case eColorID__moz_win_communicationstext:
- if (IsVistaOrLater() && IsAppThemed())
- {
+ if (IsAppThemed()) {
res = ::GetColorFromTheme(eUXCommunicationsToolbar,
TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
if (NS_SUCCEEDED(res))
diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp
index 4ff6b0af9..8950dcf90 100644
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -39,7 +39,6 @@
#include "nsUXThemeConstants.h"
#include <algorithm>
-using mozilla::IsVistaOrLater;
using namespace mozilla;
using namespace mozilla::widget;
@@ -301,10 +300,6 @@ DrawThemeBGRTLAware(HANDLE aTheme, HDC aHdc, int aPart, int aState,
* aero basic max 0 2 1 2
* aero basic close 1 2 1 2
*
- * xp theme min 0 2 0 2
- * xp theme max 0 2 1 2
- * xp theme close 1 2 2 2
- *
* 'cold' button padding - generic button padding, should
* be handled in css.
* left top right bottom
@@ -315,16 +310,11 @@ DrawThemeBGRTLAware(HANDLE aTheme, HDC aHdc, int aPart, int aState,
* aero basic min 0 0 1 0
* aero basic max 1 0 0 0
* aero basic close 0 0 0 0
- *
- * xp theme min 0 0 1 0
- * xp theme max 1 0 0 0
- * xp theme close 0 0 0 0
*/
enum CaptionDesktopTheme {
CAPTION_CLASSIC = 0,
CAPTION_BASIC,
- CAPTION_XPTHEME,
};
enum CaptionButton {
@@ -358,8 +348,6 @@ AddPaddingRect(LayoutDeviceIntSize* aSize, CaptionButton button) {
RECT offset;
if (!IsAppThemed())
offset = buttonData[CAPTION_CLASSIC].hotPadding[button];
- else if (!IsVistaOrLater())
- offset = buttonData[CAPTION_XPTHEME].hotPadding[button];
else
offset = buttonData[CAPTION_BASIC].hotPadding[button];
aSize->width += offset.left + offset.right;
@@ -373,8 +361,6 @@ OffsetBackgroundRect(RECT& rect, CaptionButton button) {
RECT offset;
if (!IsAppThemed())
offset = buttonData[CAPTION_CLASSIC].hotPadding[button];
- else if (!IsVistaOrLater())
- offset = buttonData[CAPTION_XPTHEME].hotPadding[button];
else
offset = buttonData[CAPTION_BASIC].hotPadding[button];
rect.left += offset.left;
@@ -419,9 +405,7 @@ OffsetBackgroundRect(RECT& rect, CaptionButton button) {
static const double kProgressDeterminateTimeSpan = 3.0;
static const double kProgressIndeterminateTimeSpan = 5.0;
// The width of the overlay used to animate the horizontal progress bar (Vista and later).
-static const int32_t kProgressHorizontalVistaOverlaySize = 120;
-// The width of the overlay used for the horizontal indeterminate progress bars on XP.
-static const int32_t kProgressHorizontalXPOverlaySize = 55;
+static const int32_t kProgressHorizontalOverlaySize = 120;
// The height of the overlay used to animate the vertical progress bar (Vista and later).
static const int32_t kProgressVerticalOverlaySize = 45;
// The height of the overlay used for the vertical indeterminate progress bar (Vista and later).
@@ -435,18 +419,8 @@ static const int32_t kProgressClassicOverlaySize = 40;
*/
static int32_t
GetProgressOverlayStyle(bool aIsVertical)
-{
- if (aIsVertical) {
- if (IsVistaOrLater()) {
- return PP_MOVEOVERLAYVERT;
- }
- return PP_CHUNKVERT;
- } else {
- if (IsVistaOrLater()) {
- return PP_MOVEOVERLAY;
- }
- return PP_CHUNK;
- }
+{
+ return aIsVertical ? PP_MOVEOVERLAYVERT : PP_MOVEOVERLAY;
}
/*
@@ -457,14 +431,11 @@ GetProgressOverlayStyle(bool aIsVertical)
static int32_t
GetProgressOverlaySize(bool aIsVertical, bool aIsIndeterminate)
{
- if (IsVistaOrLater()) {
- if (aIsVertical) {
- return aIsIndeterminate ? kProgressVerticalIndeterminateOverlaySize
- : kProgressVerticalOverlaySize;
- }
- return kProgressHorizontalVistaOverlaySize;
+ if (aIsVertical) {
+ return aIsIndeterminate ? kProgressVerticalIndeterminateOverlaySize
+ : kProgressVerticalOverlaySize;
}
- return kProgressHorizontalXPOverlaySize;
+ return kProgressHorizontalOverlaySize;
}
/*
@@ -554,87 +525,6 @@ nsNativeThemeWin::CalculateProgressOverlayRect(nsIFrame* aFrame,
}
/*
- * DrawChunkProgressMeter - renders an xp style chunked progress meter. Called
- * by DrawProgressMeter.
- *
- * @param aTheme progress theme handle
- * @param aHdc hdc returned by gfxWindowsNativeDrawing
- * @param aPart the PP_X progress part
- * @param aState the theme state
- * @param aFrame the elements frame
- * @param aWidgetRect bounding rect for the widget
- * @param aClipRect dirty rect that needs drawing.
- * @param aAppUnits app units per device pixel
- * @param aIsIndeterm is an indeterminate progress?
- * @param aIsVertical render a vertical progress?
- * @param aIsRtl direction is rtl
- */
-static void
-DrawChunkProgressMeter(HTHEME aTheme, HDC aHdc, int aPart,
- int aState, nsIFrame* aFrame, RECT* aWidgetRect,
- RECT* aClipRect, gfxFloat aAppUnits, bool aIsIndeterm,
- bool aIsVertical, bool aIsRtl)
-{
- NS_ASSERTION(aTheme, "Bad theme.");
- NS_ASSERTION(aHdc, "Bad hdc.");
- NS_ASSERTION(aWidgetRect, "Bad rect.");
- NS_ASSERTION(aClipRect, "Bad clip rect.");
- NS_ASSERTION(aFrame, "Bad frame.");
-
- // For horizontal meters, the theme lib paints the right graphic but doesn't
- // paint the chunks, so we do that manually. For vertical meters, the theme
- // library draws everything correctly.
- if (aIsVertical) {
- DrawThemeBackground(aTheme, aHdc, aPart, aState, aWidgetRect, aClipRect);
- return;
- }
-
- // query for the proper chunk metrics
- int chunkSize, spaceSize;
- if (FAILED(GetThemeMetric(aTheme, aHdc, aPart, aState,
- TMT_PROGRESSCHUNKSIZE, &chunkSize)) ||
- FAILED(GetThemeMetric(aTheme, aHdc, aPart, aState,
- TMT_PROGRESSSPACESIZE, &spaceSize))) {
- DrawThemeBackground(aTheme, aHdc, aPart, aState, aWidgetRect, aClipRect);
- return;
- }
-
- // render chunks
- if (!aIsRtl || aIsIndeterm) {
- for (int chunk = aWidgetRect->left; chunk <= aWidgetRect->right;
- chunk += (chunkSize+spaceSize)) {
- if (!aIsIndeterm && ((chunk + chunkSize) > aWidgetRect->right)) {
- // aWidgetRect->right represents the end of the meter. Partial blocks
- // don't get rendered with one exception, so exit here if we don't have
- // a full chunk to draw.
- // The above is true *except* when the meter is at 100% fill, in which
- // case Windows renders any remaining partial block. Query the parent
- // frame to find out if we're at 100%.
- if (!IsProgressMeterFilled(aFrame)) {
- break;
- }
- }
- RECT bounds =
- { chunk, aWidgetRect->top, chunk + chunkSize, aWidgetRect->bottom };
- DrawThemeBackground(aTheme, aHdc, aPart, aState, &bounds, aClipRect);
- }
- } else {
- // rtl needs to grow in the opposite direction to look right.
- for (int chunk = aWidgetRect->right; chunk >= aWidgetRect->left;
- chunk -= (chunkSize+spaceSize)) {
- if ((chunk - chunkSize) < aWidgetRect->left) {
- if (!IsProgressMeterFilled(aFrame)) {
- break;
- }
- }
- RECT bounds =
- { chunk - chunkSize, aWidgetRect->top, chunk, aWidgetRect->bottom };
- DrawThemeBackground(aTheme, aHdc, aPart, aState, &bounds, aClipRect);
- }
- }
-}
-
-/*
* DrawProgressMeter - render an appropriate progress meter based on progress
* meter style, orientation, and os. Note, this does not render the underlying
* progress track.
@@ -653,8 +543,7 @@ void
nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
HANDLE aTheme, HDC aHdc,
int aPart, int aState,
- RECT* aWidgetRect, RECT* aClipRect,
- gfxFloat aAppUnits)
+ RECT* aWidgetRect, RECT* aClipRect)
{
if (!aFrame || !aTheme || !aHdc)
return;
@@ -665,12 +554,6 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
RECT adjWidgetRect, adjClipRect;
adjWidgetRect = *aWidgetRect;
adjClipRect = *aClipRect;
- if (!IsVistaOrLater()) {
- // Adjust clipping out by one pixel. XP progress meters are inset,
- // Vista+ are not.
- InflateRect(&adjWidgetRect, 1, 1);
- InflateRect(&adjClipRect, 1, 1);
- }
nsIFrame* parentFrame = aFrame->GetParent();
if (!parentFrame) {
@@ -685,20 +568,13 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
bool indeterminate = IsIndeterminateProgress(parentFrame, eventStates);
bool animate = indeterminate;
- if (IsVistaOrLater()) {
- // Vista and up progress meter is fill style, rendered here. We render
- // the pulse overlay in the follow up section below.
- DrawThemeBackground(aTheme, aHdc, aPart, aState,
- &adjWidgetRect, &adjClipRect);
- if (!IsProgressMeterFilled(aFrame)) {
- animate = true;
- }
- } else if (!indeterminate) {
- // XP progress meters are 'chunk' style.
- DrawChunkProgressMeter(aTheme, aHdc, aPart, aState, aFrame,
- &adjWidgetRect, &adjClipRect, aAppUnits,
- indeterminate, vertical, IsFrameRTL(aFrame));
- }
+ // Vista and up progress meter is fill style, rendered here. We render
+ // the pulse overlay in the follow up section below.
+ DrawThemeBackground(aTheme, aHdc, aPart, aState,
+ &adjWidgetRect, &adjClipRect);
+ if (!IsProgressMeterFilled(aFrame)) {
+ animate = true;
+ }
if (animate) {
// Indeterminate rendering
@@ -706,14 +582,8 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
RECT overlayRect =
CalculateProgressOverlayRect(aFrame, &adjWidgetRect, vertical,
indeterminate, false);
- if (IsVistaOrLater()) {
- DrawThemeBackground(aTheme, aHdc, overlayPart, aState, &overlayRect,
- &adjClipRect);
- } else {
- DrawChunkProgressMeter(aTheme, aHdc, overlayPart, aState, aFrame,
- &overlayRect, &adjClipRect, aAppUnits,
- indeterminate, vertical, IsFrameRTL(aFrame));
- }
+ DrawThemeBackground(aTheme, aHdc, overlayPart, aState, &overlayRect,
+ &adjClipRect);
if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 60)) {
NS_WARNING("unable to animate progress widget!");
@@ -724,15 +594,6 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
HANDLE
nsNativeThemeWin::GetTheme(uint8_t aWidgetType)
{
- if (!IsVistaOrLater()) {
- // On XP or earlier, render dropdowns as textfields;
- // doing it the right way works fine with the MS themes,
- // but breaks on a lot of custom themes (presumably because MS
- // apps do the textfield border business as well).
- if (aWidgetType == NS_THEME_MENULIST)
- aWidgetType = NS_THEME_TEXTFIELD;
- }
-
switch (aWidgetType) {
case NS_THEME_BUTTON:
case NS_THEME_RADIO:
@@ -745,9 +606,7 @@ nsNativeThemeWin::GetTheme(uint8_t aWidgetType)
case NS_THEME_FOCUS_OUTLINE:
return nsUXThemeData::GetTheme(eUXEdit);
case NS_THEME_TOOLTIP:
- // XP/2K3 should force a classic treatment of tooltips
- return !IsVistaOrLater() ?
- nullptr : nsUXThemeData::GetTheme(eUXTooltip);
+ return nsUXThemeData::GetTheme(eUXTooltip);
case NS_THEME_TOOLBOX:
return nsUXThemeData::GetTheme(eUXRebar);
case NS_THEME_WIN_MEDIA_TOOLBOX:
@@ -874,12 +733,6 @@ nsresult
nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
int32_t& aPart, int32_t& aState)
{
- if (!IsVistaOrLater()) {
- // See GetTheme
- if (aWidgetType == NS_THEME_MENULIST)
- aWidgetType = NS_THEME_TEXTFIELD;
- }
-
switch (aWidgetType) {
case NS_THEME_BUTTON: {
aPart = BP_BUTTON;
@@ -952,63 +805,43 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
case NS_THEME_TEXTFIELD_MULTILINE: {
EventStates eventState = GetContentState(aFrame, aWidgetType);
- if (IsVistaOrLater()) {
- /* Note: the NOSCROLL type has a rounded corner in each
- * corner. The more specific HSCROLL, VSCROLL, HVSCROLL types
- * have side and/or top/bottom edges rendered as straight
- * horizontal lines with sharp corners to accommodate a
- * scrollbar. However, the scrollbar gets rendered on top of
- * this for us, so we don't care, and can just use NOSCROLL
- * here.
- */
- aPart = TFP_EDITBORDER_NOSCROLL;
-
- if (!aFrame) {
- aState = TFS_EDITBORDER_NORMAL;
- } else if (IsDisabled(aFrame, eventState)) {
- aState = TFS_EDITBORDER_DISABLED;
- } else if (IsReadOnly(aFrame)) {
- /* no special read-only state */
- aState = TFS_EDITBORDER_NORMAL;
- } else {
- nsIContent* content = aFrame->GetContent();
+ /* Note: the NOSCROLL type has a rounded corner in each corner. The more
+ * specific HSCROLL, VSCROLL, HVSCROLL types have side and/or top/bottom
+ * edges rendered as straight horizontal lines with sharp corners to
+ * accommodate a scrollbar. However, the scrollbar gets rendered on top
+ * of this for us, so we don't care, and can just use NOSCROLL here.
+ */
+ aPart = TFP_EDITBORDER_NOSCROLL;
- /* XUL textboxes don't get focused themselves, because they have child
- * html:input.. but we can check the XUL focused attributes on them
- */
- if (content && content->IsXULElement() && IsFocused(aFrame))
- aState = TFS_EDITBORDER_FOCUSED;
- else if (eventState.HasAtLeastOneOfStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS))
- aState = TFS_EDITBORDER_FOCUSED;
- else if (eventState.HasState(NS_EVENT_STATE_HOVER))
- aState = TFS_EDITBORDER_HOVER;
- else
- aState = TFS_EDITBORDER_NORMAL;
- }
+ if (!aFrame) {
+ aState = TFS_EDITBORDER_NORMAL;
+ } else if (IsDisabled(aFrame, eventState)) {
+ aState = TFS_EDITBORDER_DISABLED;
+ } else if (IsReadOnly(aFrame)) {
+ /* no special read-only state */
+ aState = TFS_EDITBORDER_NORMAL;
} else {
- aPart = TFP_TEXTFIELD;
-
- if (!aFrame)
- aState = TS_NORMAL;
- else if (IsDisabled(aFrame, eventState))
- aState = TS_DISABLED;
- else if (IsReadOnly(aFrame))
- aState = TFS_READONLY;
+ nsIContent* content = aFrame->GetContent();
+
+ /* XUL textboxes don't get focused themselves, because they have child
+ * html:input.. but we can check the XUL focused attributes on them
+ */
+ if (content && content->IsXULElement() && IsFocused(aFrame))
+ aState = TFS_EDITBORDER_FOCUSED;
+ else if (eventState.HasAtLeastOneOfStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS))
+ aState = TFS_EDITBORDER_FOCUSED;
+ else if (eventState.HasState(NS_EVENT_STATE_HOVER))
+ aState = TFS_EDITBORDER_HOVER;
else
- aState = StandardGetState(aFrame, aWidgetType, true);
+ aState = TFS_EDITBORDER_NORMAL;
}
return NS_OK;
}
case NS_THEME_FOCUS_OUTLINE: {
- if (IsVistaOrLater()) {
- // XXX the EDITBORDER values don't respect DTBG_OMITCONTENT
- aPart = TFP_TEXTFIELD; //TFP_EDITBORDER_NOSCROLL;
- aState = TS_FOCUSED; //TFS_EDITBORDER_FOCUSED;
- } else {
- aPart = TFP_TEXTFIELD;
- aState = TS_FOCUSED;
- }
+ // XXX the EDITBORDER values don't respect DTBG_OMITCONTENT
+ aPart = TFP_TEXTFIELD; //TFP_EDITBORDER_NOSCROLL;
+ aState = TS_FOCUSED; //TFS_EDITBORDER_FOCUSED;
return NS_OK;
}
case NS_THEME_TOOLTIP: {
@@ -1032,11 +865,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
nsIFrame* parentFrame = aFrame->GetParent();
if (aWidgetType == NS_THEME_PROGRESSCHUNK_VERTICAL ||
IsVerticalProgress(parentFrame)) {
- aPart = IsVistaOrLater() ?
- PP_FILLVERT : PP_CHUNKVERT;
+ aPart = PP_FILLVERT;
} else {
- aPart = IsVistaOrLater() ?
- PP_FILL : PP_CHUNK;
+ aPart = PP_FILL;
}
aState = PBBVS_NORMAL;
@@ -1100,8 +931,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
aState += TS_ACTIVE;
else if (eventState.HasState(NS_EVENT_STATE_HOVER))
aState += TS_HOVER;
- else if (IsVistaOrLater() &&
- parentState.HasState(NS_EVENT_STATE_HOVER))
+ else if (parentState.HasState(NS_EVENT_STATE_HOVER))
aState = (aWidgetType - NS_THEME_SCROLLBARBUTTON_UP) + SP_BUTTON_IMPLICIT_HOVER_BASE;
else
aState += TS_NORMAL;
@@ -1204,14 +1034,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
case NS_THEME_SCROLLBAR:
case NS_THEME_SCROLLBAR_SMALL: {
aState = 0;
- if (IsVistaOrLater()) {
- // On vista, they have a part
- aPart = RP_BACKGROUND;
- } else {
- // Otherwise, they don't. (But I bet
- // RP_BACKGROUND would work here, too);
- aPart = 0;
- }
+ aPart = RP_BACKGROUND;
return NS_OK;
}
case NS_THEME_TOOLBAR: {
@@ -1336,8 +1159,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
aFrame = parentFrame;
EventStates eventState = GetContentState(aFrame, aWidgetType);
- aPart = IsVistaOrLater() ?
- CBP_DROPMARKER_VISTA : CBP_DROPMARKER;
+ aPart = CBP_DROPMARKER_VISTA;
// For HTML controls with author styling, we should fall
// back to the old dropmarker style to avoid clashes with
@@ -1357,28 +1179,25 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
else
isOpen = IsOpenButton(aFrame);
- if (IsVistaOrLater()) {
- if (isHTML || IsMenuListEditable(aFrame)) {
- if (isOpen) {
- /* Hover is propagated, but we need to know whether we're
- * hovering just the combobox frame, not the dropdown frame.
- * But, we can't get that information, since hover is on the
- * content node, and they share the same content node. So,
- * instead, we cheat -- if the dropdown is open, we always
- * show the hover state. This looks fine in practice.
- */
- aState = TS_HOVER;
- return NS_OK;
- }
- } else {
- /* On Vista, the dropdown indicator on a menulist button in
- * chrome is not given a hover effect. When the frame isn't
- * isn't HTML content, we cheat and force the dropdown state
- * to be normal. (Bug 430434)
+ if (isHTML || IsMenuListEditable(aFrame)) {
+ if (isOpen) {
+ /* Hover is propagated, but we need to know whether we're hovering
+ * just the combobox frame, not the dropdown frame. But, we can't get
+ * that information, since hover is on the content node, and they
+ * share the same content node. So, instead, we cheat -- if the
+ * dropdown is open, we always show the hover state. This looks fine
+ * in practice.
*/
- aState = TS_NORMAL;
+ aState = TS_HOVER;
return NS_OK;
}
+ } else {
+ /* The dropdown indicator on a menulist button in chrome is not given a
+ * hover effect. When the frame isn't isn't HTML content, we cheat and
+ * force the dropdown state to be normal. (Bug 430434)
+ */
+ aState = TS_NORMAL;
+ return NS_OK;
}
aState = TS_NORMAL;
@@ -1879,7 +1698,7 @@ RENDER_AGAIN:
else if (aWidgetType == NS_THEME_PROGRESSCHUNK ||
aWidgetType == NS_THEME_PROGRESSCHUNK_VERTICAL) {
DrawThemedProgressMeter(aFrame, aWidgetType, theme, hdc, part, state,
- &widgetRect, &clipRect, p2a);
+ &widgetRect, &clipRect);
}
else if (aWidgetType == NS_THEME_FOCUS_OUTLINE) {
// Inflate 'widgetRect' with the focus outline size.
@@ -2145,41 +1964,39 @@ nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
return ok;
}
- if (IsVistaOrLater()) {
- if (aWidgetType == NS_THEME_NUMBER_INPUT ||
- aWidgetType == NS_THEME_TEXTFIELD ||
- aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
- aWidgetType == NS_THEME_MENULIST)
- {
- /* If we have author-specified padding for these elements, don't do the fixups below */
- if (aFrame->PresContext()->HasAuthorSpecifiedRules(aFrame, NS_AUTHOR_SPECIFIED_PADDING))
- return false;
- }
+ if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+ aWidgetType == NS_THEME_TEXTFIELD ||
+ aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
+ aWidgetType == NS_THEME_MENULIST)
+ {
+ // If we have author-specified padding for these elements, don't do the
+ // fixups below.
+ if (aFrame->PresContext()->HasAuthorSpecifiedRules(aFrame, NS_AUTHOR_SPECIFIED_PADDING))
+ return false;
+ }
- /* textfields need extra pixels on all sides, otherwise they
- * wrap their content too tightly. The actual border is drawn 1px
- * inside the specified rectangle, so Gecko will end up making the
- * contents look too small. Instead, we add 2px padding for the
- * contents and fix this. (Used to be 1px added, see bug 430212)
+ /* textfields need extra pixels on all sides, otherwise they wrap their
+ * content too tightly. The actual border is drawn 1px inside the specified
+ * rectangle, so Gecko will end up making the contents look too small.
+ * Instead, we add 2px padding for the contents and fix this. (Used to be 1px
+ * added, see bug 430212)
+ */
+ if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+ aWidgetType == NS_THEME_TEXTFIELD ||
+ aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
+ aResult->top = aResult->bottom = 2;
+ aResult->left = aResult->right = 2;
+ ScaleForFrameDPI(aResult, aFrame);
+ return ok;
+ } else if (IsHTMLContent(aFrame) && aWidgetType == NS_THEME_MENULIST) {
+ /* For content menulist controls, we need an extra pixel so that we have
+ * room to draw our focus rectangle stuff. Otherwise, the focus rect might
+ * overlap the control's border.
*/
- if (aWidgetType == NS_THEME_NUMBER_INPUT ||
- aWidgetType == NS_THEME_TEXTFIELD ||
- aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
- aResult->top = aResult->bottom = 2;
- aResult->left = aResult->right = 2;
- ScaleForFrameDPI(aResult, aFrame);
- return ok;
- } else if (IsHTMLContent(aFrame) && aWidgetType == NS_THEME_MENULIST) {
- /* For content menulist controls, we need an extra pixel so
- * that we have room to draw our focus rectangle stuff.
- * Otherwise, the focus rect might overlap the control's
- * border.
- */
- aResult->top = aResult->bottom = 1;
- aResult->left = aResult->right = 1;
- ScaleForFrameDPI(aResult, aFrame);
- return ok;
- }
+ aResult->top = aResult->bottom = 1;
+ aResult->left = aResult->right = 1;
+ ScaleForFrameDPI(aResult, aFrame);
+ return ok;
}
int32_t right, left, top, bottom;
@@ -2244,23 +2061,21 @@ nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
* a border only shows up if the widget is being hovered.
*/
#if 0
- if (IsVistaOrLater()) {
- /* We explicitly draw dropdown buttons in HTML content 1px bigger
- * up, right, and bottom so that they overlap the dropdown's border
- * like they're supposed to.
- */
- if (aWidgetType == NS_THEME_MENULIST_BUTTON &&
- IsHTMLContent(aFrame) &&
- !IsWidgetStyled(aFrame->GetParent()->PresContext(),
- aFrame->GetParent(),
- NS_THEME_MENULIST))
- {
- int32_t p2a = aContext->AppUnitsPerDevPixel();
- /* Note: no overflow on the left */
- nsMargin m(p2a, p2a, p2a, 0);
- aOverflowRect->Inflate (m);
- return true;
- }
+ /* We explicitly draw dropdown buttons in HTML content 1px bigger up, right,
+ * and bottom so that they overlap the dropdown's border like they're
+ * supposed to.
+ */
+ if (aWidgetType == NS_THEME_MENULIST_BUTTON &&
+ IsHTMLContent(aFrame) &&
+ !IsWidgetStyled(aFrame->GetParent()->PresContext(),
+ aFrame->GetParent(),
+ NS_THEME_MENULIST))
+ {
+ int32_t p2a = aContext->AppUnitsPerDevPixel();
+ /* Note: no overflow on the left */
+ nsMargin m(p2a, p2a, p2a, 0);
+ aOverflowRect->Inflate (m);
+ return true;
}
#endif
@@ -2384,22 +2199,18 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF
case NS_THEME_SCALETHUMB_VERTICAL:
{
*aIsOverridable = false;
- // on Vista, GetThemePartAndState returns odd values for
+ // On Vista, GetThemePartAndState returns odd values for
// scale thumbs, so use a hardcoded size instead.
- if (IsVistaOrLater()) {
- if (aWidgetType == NS_THEME_SCALETHUMB_HORIZONTAL ||
- (aWidgetType == NS_THEME_RANGE_THUMB && IsRangeHorizontal(aFrame))) {
- aResult->width = 12;
- aResult->height = 20;
- }
- else {
- aResult->width = 20;
- aResult->height = 12;
- }
- ScaleForFrameDPI(aResult, aFrame);
- return rv;
+ if (aWidgetType == NS_THEME_SCALETHUMB_HORIZONTAL ||
+ (aWidgetType == NS_THEME_RANGE_THUMB && IsRangeHorizontal(aFrame))) {
+ aResult->width = 12;
+ aResult->height = 20;
+ } else {
+ aResult->width = 20;
+ aResult->height = 12;
}
- break;
+ ScaleForFrameDPI(aResult, aFrame);
+ return rv;
}
case NS_THEME_SCROLLBAR:
@@ -2438,11 +2249,6 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF
// stores that info in nsUXThemeData.
aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_RESTORE].cx;
aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_RESTORE].cy;
- // For XP, subtract 4 from system metrics dimensions.
- if (!IsVistaOrLater()) {
- aResult->width -= 4;
- aResult->height -= 4;
- }
AddPaddingRect(aResult, CAPTIONBUTTON_RESTORE);
*aIsOverridable = false;
return rv;
@@ -2450,10 +2256,6 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF
case NS_THEME_WINDOW_BUTTON_MINIMIZE:
aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_MINIMIZE].cx;
aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_MINIMIZE].cy;
- if (!IsVistaOrLater()) {
- aResult->width -= 4;
- aResult->height -= 4;
- }
AddPaddingRect(aResult, CAPTIONBUTTON_MINIMIZE);
*aIsOverridable = false;
return rv;
@@ -2461,10 +2263,6 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF
case NS_THEME_WINDOW_BUTTON_CLOSE:
aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_CLOSE].cx;
aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_CLOSE].cy;
- if (!IsVistaOrLater()) {
- aResult->width -= 4;
- aResult->height -= 4;
- }
AddPaddingRect(aResult, CAPTIONBUTTON_CLOSE);
*aIsOverridable = false;
return rv;
@@ -2594,18 +2392,9 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
return NS_OK;
}
- // On Vista, the scrollbar buttons need to change state when the track has/doesn't have hover
- if (!IsVistaOrLater() &&
- (aWidgetType == NS_THEME_SCROLLBAR_VERTICAL ||
- aWidgetType == NS_THEME_SCROLLBAR_HORIZONTAL)) {
- *aShouldRepaint = false;
- return NS_OK;
- }
-
// We need to repaint the dropdown arrow in vista HTML combobox controls when
// the control is closed to get rid of the hover effect.
- if (IsVistaOrLater() &&
- (aWidgetType == NS_THEME_MENULIST || aWidgetType == NS_THEME_MENULIST_BUTTON) &&
+ if ((aWidgetType == NS_THEME_MENULIST || aWidgetType == NS_THEME_MENULIST_BUTTON) &&
IsHTMLContent(aFrame))
{
*aShouldRepaint = true;
diff --git a/widget/windows/nsNativeThemeWin.h b/widget/windows/nsNativeThemeWin.h
index f20649444..32b82b1e1 100644
--- a/widget/windows/nsNativeThemeWin.h
+++ b/widget/windows/nsNativeThemeWin.h
@@ -117,8 +117,7 @@ protected:
void DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
HANDLE aTheme, HDC aHdc,
int aPart, int aState,
- RECT* aWidgetRect, RECT* aClipRect,
- gfxFloat aAppUnits);
+ RECT* aWidgetRect, RECT* aClipRect);
private:
TimeStamp mProgressDeterminateTimeStamp;
diff --git a/widget/windows/nsUXThemeConstants.h b/widget/windows/nsUXThemeConstants.h
index 731dcedf2..ba7afde82 100644
--- a/widget/windows/nsUXThemeConstants.h
+++ b/widget/windows/nsUXThemeConstants.h
@@ -67,7 +67,7 @@
#define SP_GRIPPERHOR 8
#define SP_GRIPPERVERT 9
-// Vista only; implict hover state.
+// Implicit hover state.
// BASE + 0 = UP, + 1 = DOWN, etc.
#define SP_BUTTON_IMPLICIT_HOVER_BASE 17
diff --git a/widget/windows/nsUXThemeData.cpp b/widget/windows/nsUXThemeData.cpp
index bcbd32484..4d9ac9570 100644
--- a/widget/windows/nsUXThemeData.cpp
+++ b/widget/windows/nsUXThemeData.cpp
@@ -143,10 +143,8 @@ nsUXThemeData::InitTitlebarInfo()
sCommandButtons[3].cx = sCommandButtons[0].cx * 3;
sCommandButtons[3].cy = sCommandButtons[0].cy;
- // Use system metrics for pre-vista, otherwise trigger a
- // refresh on the next layout.
- sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed =
- !IsVistaOrLater();
+ // Trigger a refresh on the next layout.
+ sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed = false;
}
// static
@@ -306,7 +304,7 @@ void
nsUXThemeData::UpdateNativeThemeInfo()
{
// Trigger a refresh of themed button metrics if needed
- sTitlebarInfoPopulatedThemed = !IsVistaOrLater();
+ sTitlebarInfoPopulatedThemed = false;
sIsDefaultWindowsTheme = false;
sThemeId = LookAndFeel::eWindowsTheme_Generic;
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index a8923f78e..b2bb59bd3 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -266,8 +266,7 @@ LONG nsWindow::sLastMouseDownTime = 0L;
LONG nsWindow::sLastClickCount = 0L;
BYTE nsWindow::sLastMouseButton = 0;
-// Trim heap on minimize. (initialized, but still true.)
-int nsWindow::sTrimOnMinimize = 2;
+bool nsWindow::sHaveInitializedPrefs = false;
TriStateBool nsWindow::sHasBogusPopupsDropShadowOnMultiMonitor = TRI_UNKNOWN;
@@ -783,7 +782,7 @@ nsWindow::Create(nsIWidget* aParent,
parent = nullptr;
}
- if (IsVistaOrLater() && !IsWin8OrLater() &&
+ if (!IsWin8OrLater() &&
HasBogusPopupsDropShadowOnMultiMonitor()) {
extendedStyle |= WS_EX_COMPOSITED;
}
@@ -908,20 +907,13 @@ nsWindow::Create(nsIWidget* aParent,
mDefaultIMC.Init(this);
IMEHandler::InitInputContext(this, mInputContext);
- // If the internal variable set by the config.trim_on_minimize pref has not
- // been initialized, and if this is the hidden window (conveniently created
- // before any visible windows, and after the profile has been initialized),
- // do some initialization work.
- if (sTrimOnMinimize == 2 && mWindowType == eWindowType_invisible) {
- // Our internal trim prevention logic is effective on 2K/XP at maintaining
- // the working set when windows are minimized, but on Vista and up it has
- // little to no effect. Since this feature has been the source of numerous
- // bugs over the years, disable it (sTrimOnMinimize=1) on Vista and up.
- sTrimOnMinimize =
- Preferences::GetBool("config.trim_on_minimize",
- IsVistaOrLater() ? 1 : 0);
+ // Do some initialization work, but only if (a) it hasn't already been done,
+ // and (b) this is the hidden window (which is conveniently created before
+ // any visible windows but after the profile has been initialized).
+ if (!sHaveInitializedPrefs && mWindowType == eWindowType_invisible) {
sSwitchKeyboardLayout =
Preferences::GetBool("intl.keyboard.per_window_layout", false);
+ sHaveInitializedPrefs = true;
}
// Query for command button metric data for rendering the titlebar. We
@@ -1647,9 +1639,10 @@ bool nsWindow::IsVisible() const
// XP and Vista visual styles sometimes require window clipping regions to be applied for proper
// transparency. These routines are called on size and move operations.
+// XXX this is apparently still needed in Windows 7 and later
void nsWindow::ClearThemeRegion()
{
- if (IsVistaOrLater() && !HasGlass() &&
+ if (!HasGlass() &&
(mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
SetWindowRgn(mWnd, nullptr, false);
@@ -1663,7 +1656,7 @@ void nsWindow::SetThemeRegion()
// so default constants are used for part and state. At some point we might need part and
// state values from nsNativeThemeWin's GetThemePartAndState, but currently windows that
// change shape based on state haven't come up.
- if (IsVistaOrLater() && !HasGlass() &&
+ if (!HasGlass() &&
(mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
HRGN hRgn = nullptr;
@@ -2080,13 +2073,7 @@ nsWindow::SetSizeMode(nsSizeMode aMode)
break;
case nsSizeMode_Minimized :
- // Using SW_SHOWMINIMIZED prevents the working set from being trimmed but
- // keeps the window active in the tray. So after the window is minimized,
- // windows will fire WM_WINDOWPOSCHANGED (OnWindowPosChanged) at which point
- // we will do some additional processing to get the active window set right.
- // If sTrimOnMinimize is set, we let windows handle minimization normally
- // using SW_MINIMIZE.
- mode = sTrimOnMinimize ? SW_MINIMIZE : SW_SHOWMINIMIZED;
+ mode = SW_MINIMIZE;
break;
default :
@@ -5828,12 +5815,6 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
case WM_SYSCOMMAND:
{
WPARAM filteredWParam = (wParam &0xFFF0);
- // prevent Windows from trimming the working set. bug 76831
- if (!sTrimOnMinimize && filteredWParam == SC_MINIMIZE) {
- ::ShowWindow(mWnd, SW_SHOWMINIMIZED);
- result = true;
- }
-
if (mSizeMode == nsSizeMode_Fullscreen &&
filteredWParam == SC_RESTORE &&
GetCurrentShowCmd(mWnd) != SW_SHOWMINIMIZED) {
@@ -6451,14 +6432,6 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp)
else
mSizeMode = nsSizeMode_Normal;
- // If !sTrimOnMinimize, we minimize windows using SW_SHOWMINIMIZED (See
- // SetSizeMode for internal calls, and WM_SYSCOMMAND for external). This
- // prevents the working set from being trimmed but keeps the window active.
- // After the window is minimized, we need to do some touch up work on the
- // active window. (bugs 76831 & 499816)
- if (!sTrimOnMinimize && nsSizeMode_Minimized == mSizeMode)
- ActivateOtherWindowHelper(mWnd);
-
#ifdef WINSTATE_DEBUG_OUTPUT
switch (mSizeMode) {
case nsSizeMode_Normal:
@@ -6579,31 +6552,6 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp)
}
}
-// static
-void nsWindow::ActivateOtherWindowHelper(HWND aWnd)
-{
- // Find the next window that is enabled, visible, and not minimized.
- HWND hwndBelow = ::GetNextWindow(aWnd, GW_HWNDNEXT);
- while (hwndBelow && (!::IsWindowEnabled(hwndBelow) || !::IsWindowVisible(hwndBelow) ||
- ::IsIconic(hwndBelow))) {
- hwndBelow = ::GetNextWindow(hwndBelow, GW_HWNDNEXT);
- }
-
- // Push ourselves to the bottom of the stack, then activate the
- // next window.
- ::SetWindowPos(aWnd, HWND_BOTTOM, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
- if (hwndBelow)
- ::SetForegroundWindow(hwndBelow);
-
- // Play the minimize sound while we're here, since that is also
- // forgotten when we use SW_SHOWMINIMIZED.
- nsCOMPtr<nsISound> sound(do_CreateInstance("@mozilla.org/sound;1"));
- if (sound) {
- sound->PlaySystemSound(NS_LITERAL_STRING("Minimize"));
- }
-}
-
void nsWindow::OnWindowPosChanging(LPWINDOWPOS& info)
{
// Update non-client margins if the frame size is changing, and let the
diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h
index 248978bd7..199500e9c 100644
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -486,7 +486,6 @@ protected:
bool aIntersectWithExisting) override;
nsIntRegion GetRegionToPaint(bool aForceFullRepaint,
PAINTSTRUCT ps, HDC aDC);
- static void ActivateOtherWindowHelper(HWND aWnd);
void ClearCachedResources();
nsIWidgetListener* GetPaintListener();
@@ -552,7 +551,7 @@ protected:
static bool sJustGotDeactivate;
static bool sJustGotActivate;
static bool sIsInMouseCapture;
- static int sTrimOnMinimize;
+ static bool sHaveInitializedPrefs;
// Always use the helper method to read this property. See bug 603793.
static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor;