summaryrefslogtreecommitdiffstats
path: root/widget/windows/nsWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'widget/windows/nsWindow.cpp')
-rw-r--r--widget/windows/nsWindow.cpp74
1 files changed, 11 insertions, 63 deletions
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