summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-01-14 20:23:47 +0000
committerMoonchild <moonchild@palemoon.org>2022-04-03 01:07:18 +0200
commit5595c43ed0382f7ab0d86adfcc2f174935bd7a7f (patch)
tree0a36c893b4fb122b40ac3485a90878a7686d3793
parent3c239e5c7b2d9a23c90c44208d933eef0104054a (diff)
downloaduxp-5595c43ed0382f7ab0d86adfcc2f174935bd7a7f.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 4946bebf01..a01c47a654 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1579,7 +1579,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;