Commit 1c75db1c authored by David Parks's avatar David Parks
Browse files

Bug 1735071: Make Windows non-ePopupLevelTop popups respect owner z-order r=edgar

Popups that aren't ePopupLevelTop should only appear above their owner and should do so without changing their owner's Z-order relative to other windows.

Differential Revision: https://phabricator.services.mozilla.com/D131961
parent 080763b9
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -1657,7 +1657,20 @@ void 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;