зеркало из https://github.com/mozilla/pjs.git
Bug 635691 - GetAttention() flashes the grandparent window although the parent window is in the forground. r=neil
This commit is contained in:
Родитель
9d5ab77010
Коммит
f5c75ea9ff
|
@ -3116,21 +3116,16 @@ nsWindow::GetAttention(PRInt32 aCycleCount)
|
|||
if (!mWnd)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// Don't flash if the flash count is 0 or if the
|
||||
// top level window is already active.
|
||||
HWND flashWnd = GetTopLevelHWND(mWnd, false, false);
|
||||
HWND fgWnd = ::GetForegroundWindow();
|
||||
if (aCycleCount == 0 || fgWnd == GetTopLevelHWND(mWnd))
|
||||
// Don't flash if the flash count is 0 or if the foreground window is our
|
||||
// window handle or that of our owned-most window.
|
||||
if (aCycleCount == 0 ||
|
||||
flashWnd == fgWnd ||
|
||||
flashWnd == GetTopLevelHWND(fgWnd, false, false)) {
|
||||
return NS_OK;
|
||||
|
||||
HWND flashWnd = mWnd;
|
||||
while (HWND ownerWnd = ::GetWindow(flashWnd, GW_OWNER)) {
|
||||
flashWnd = ownerWnd;
|
||||
}
|
||||
|
||||
// Don't flash if the owner window is active either.
|
||||
if (fgWnd == flashWnd)
|
||||
return NS_OK;
|
||||
|
||||
DWORD defaultCycleCount = 0;
|
||||
::SystemParametersInfo(SPI_GETFOREGROUNDFLASHCOUNT, 0, &defaultCycleCount, 0);
|
||||
|
||||
|
@ -8895,7 +8890,9 @@ nsWindow* nsWindow::GetTopLevelWindow(bool aStopOnDialogOrPopup)
|
|||
// of GetTopLevelWindow method. Because this is checking whether the window
|
||||
// is top level only in Win32 window system. Therefore, the result window
|
||||
// may not be managed by us.
|
||||
HWND nsWindow::GetTopLevelHWND(HWND aWnd, bool aStopOnDialogOrPopup)
|
||||
HWND nsWindow::GetTopLevelHWND(HWND aWnd,
|
||||
bool aStopIfNotChild,
|
||||
bool aStopIfNotPopup)
|
||||
{
|
||||
HWND curWnd = aWnd;
|
||||
HWND topWnd = NULL;
|
||||
|
@ -8904,7 +8901,7 @@ HWND nsWindow::GetTopLevelHWND(HWND aWnd, bool aStopOnDialogOrPopup)
|
|||
while (curWnd) {
|
||||
topWnd = curWnd;
|
||||
|
||||
if (aStopOnDialogOrPopup) {
|
||||
if (aStopIfNotChild) {
|
||||
DWORD_PTR style = ::GetWindowLongPtrW(curWnd, GWL_STYLE);
|
||||
|
||||
VERIFY_WINDOW_STYLE(style);
|
||||
|
@ -8914,6 +8911,12 @@ HWND nsWindow::GetTopLevelHWND(HWND aWnd, bool aStopOnDialogOrPopup)
|
|||
}
|
||||
|
||||
upWnd = ::GetParent(curWnd); // Parent or owner (if has no parent)
|
||||
|
||||
// GetParent will only return the owner if the passed in window
|
||||
// has the WS_POPUP style.
|
||||
if (!upWnd && !aStopIfNotPopup) {
|
||||
upWnd = ::GetWindow(curWnd, GW_OWNER);
|
||||
}
|
||||
curWnd = upWnd;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,9 @@ public:
|
|||
*/
|
||||
static void GlobalMsgWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
nsWindow* GetTopLevelWindow(bool aStopOnDialogOrPopup);
|
||||
static HWND GetTopLevelHWND(HWND aWnd, bool aStopOnDialogOrPopup = false);
|
||||
static HWND GetTopLevelHWND(HWND aWnd,
|
||||
bool aStopIfNotChild = false,
|
||||
bool aStopIfNotPopup = true);
|
||||
HWND GetWindowHandle() { return mWnd; }
|
||||
WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
|
||||
static nsWindow* GetNSWindowPtr(HWND aWnd);
|
||||
|
|
Загрузка…
Ссылка в новой задаче