summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-01-14 20:23:47 +0000
committerMoonchild <moonchild@palemoon.org>2022-04-08 15:03:34 +0200
commitc332210793209d75c870ea92236eb4ecbeedafa5 (patch)
tree62d63560f354fe5711a5492e0d91e514430b6df3
parent6709388785bae39840313faa53c48b0ae2dae79c (diff)
downloaduxp-c332210793209d75c870ea92236eb4ecbeedafa5.tar.gz
[interface] Make Windows non-ePopupLevelTop popups respect owner z-order
-rw-r--r--widget/windows/nsWindow.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index f77df4665b..8f614d8628 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1574,7 +1574,20 @@ NS_IMETHODIMP nsWindow::Show(bool bState)
// the popup.
flags |= SWP_NOACTIVATE;
HWND owner = ::GetWindow(mWnd, GW_OWNER);
- ::SetWindowPos(mWnd, owner ? 0 : HWND_TOPMOST, 0, 0, 0, 0, flags);
+ if (owner) {
+ // ePopupLevelTop popups should be above all else. All other
+ // types should be placed in front of their owner, without
+ // changing the owner's z-level relative to other windows.
+ if (PopupLevel() != ePopupLevelTop) {
+ ::SetWindowPos(mWnd, owner, 0, 0, 0, 0, flags);
+ ::SetWindowPos(owner, mWnd, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ } else {
+ ::SetWindowPos(mWnd, HWND_TOP, 0, 0, 0, 0, flags);
+ }
+ } else {
+ ::SetWindowPos(mWnd, HWND_TOPMOST, 0, 0, 0, 0, flags);
+ }
} else {
if (mWindowType == eWindowType_dialog && !CanTakeFocus())
flags |= SWP_NOACTIVATE;