提交 e46db277 编写于 作者: D dcherepanov

6921598: PrinterDialog hidden behind other frames

Reviewed-by: art
上级 24b96f5f
...@@ -230,7 +230,7 @@ LRESULT CALLBACK AwtDialog::ModalFilterProc(int code, ...@@ -230,7 +230,7 @@ LRESULT CALLBACK AwtDialog::ModalFilterProc(int code,
if (::IsIconic(hWnd)) { if (::IsIconic(hWnd)) {
::ShowWindow(hWnd, SW_RESTORE); ::ShowWindow(hWnd, SW_RESTORE);
} }
PopupAllDialogs(blocker, TRUE, ::GetForegroundWindow(), FALSE); PopupBlockers(blocker, TRUE, ::GetForegroundWindow(), FALSE);
// return 1 to prevent the system from allowing the operation // return 1 to prevent the system from allowing the operation
return 1; return 1;
} }
...@@ -256,7 +256,7 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode, ...@@ -256,7 +256,7 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode,
HWND blocker = AwtWindow::GetModalBlocker(AwtComponent::GetTopLevelParentForWindow(hWnd)); HWND blocker = AwtWindow::GetModalBlocker(AwtComponent::GetTopLevelParentForWindow(hWnd));
if (::IsWindow(blocker)) { if (::IsWindow(blocker)) {
BOOL onTaskbar = !(::WindowFromPoint(mhs->pt) == hWnd); BOOL onTaskbar = !(::WindowFromPoint(mhs->pt) == hWnd);
PopupAllDialogs(hWnd, FALSE, ::GetForegroundWindow(), onTaskbar); PopupBlockers(blocker, FALSE, ::GetForegroundWindow(), onTaskbar);
// return a nonzero value to prevent the system from passing // return a nonzero value to prevent the system from passing
// the message to the target window procedure // the message to the target window procedure
return 1; return 1;
...@@ -268,60 +268,60 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode, ...@@ -268,60 +268,60 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode,
} }
/* /*
* The function goes through the heirarchy of the blocker dialogs and * The function goes through the hierarchy of the blockers and
* popups all the dialogs. Note that the function starts from the top * popups all the blockers. Note that the function starts from the top
* blocker dialog and goes down to the dialog which is the bottom dialog. * blocker and goes down to the blocker which is the bottom one.
* Using another traversal may cause to the flickering issue as a bottom * Using another traversal algorithm (bottom->top) may cause to flickering
* dialog will cover a top dialog for some period of time. * as the bottom blocker will cover the top blocker for a while.
*/ */
void AwtDialog::PopupAllDialogs(HWND dialog, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar) void AwtDialog::PopupBlockers(HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
{ {
HWND blocker = AwtWindow::GetModalBlocker(dialog); HWND nextBlocker = AwtWindow::GetModalBlocker(blocker);
BOOL isBlocked = ::IsWindow(blocker); BOOL nextBlockerExists = ::IsWindow(nextBlocker);
if (isBlocked) { if (nextBlockerExists) {
PopupAllDialogs(blocker, isModalHook, prevFGWindow, onTaskbar); PopupBlockers(nextBlocker, isModalHook, prevFGWindow, onTaskbar);
} }
PopupOneDialog(dialog, blocker, isModalHook, prevFGWindow, onTaskbar); PopupBlocker(blocker, nextBlocker, isModalHook, prevFGWindow, onTaskbar);
} }
/* /*
* The function popups the dialog, it distinguishes non-blocked dialogs * The function popups the blocker, for a non-blocked blocker we need
* and activates the dialogs (sets as foreground window). If the dialog is * to activate the blocker but if a blocker is blocked, then we need
* blocked, then it changes the Z-order of the dialog. * to change z-order of the blocker placing the blocker under the next blocker.
*/ */
void AwtDialog::PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar) void AwtDialog::PopupBlocker(HWND blocker, HWND nextBlocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
{ {
if (dialog == AwtToolkit::GetInstance().GetHWnd()) { if (blocker == AwtToolkit::GetInstance().GetHWnd()) {
return; return;
} }
// fix for 6494032 // fix for 6494032
if (isModalHook && !::IsWindowVisible(dialog)) { if (isModalHook && !::IsWindowVisible(blocker)) {
::ShowWindow(dialog, SW_SHOWNA); ::ShowWindow(blocker, SW_SHOWNA);
} }
BOOL isBlocked = ::IsWindow(blocker); BOOL nextBlockerExists = ::IsWindow(nextBlocker);
UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
if (isBlocked) { if (nextBlockerExists) {
// Fix for 6829546: if blocker is a top-most window, but window isn't, then // Fix for 6829546: if blocker is a top-most window, but window isn't, then
// calling ::SetWindowPos(dialog, blocker, ...) makes window top-most as well // calling ::SetWindowPos(dialog, blocker, ...) makes window top-most as well
BOOL isBlockerTopmost = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0; BOOL topmostNextBlocker = (::GetWindowLong(nextBlocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
BOOL isDialogTopmost = (::GetWindowLong(dialog, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0; BOOL topmostBlocker = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
if (!isBlockerTopmost || isDialogTopmost) { if (!topmostNextBlocker || topmostBlocker) {
::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags); ::SetWindowPos(blocker, nextBlocker, 0, 0, 0, 0, flags);
} else { } else {
::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags); ::SetWindowPos(blocker, HWND_TOP, 0, 0, 0, 0, flags);
} }
} else { } else {
::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags); ::SetWindowPos(blocker, HWND_TOP, 0, 0, 0, 0, flags);
// no beep/flash if the mouse was clicked in the taskbar menu // no beep/flash if the mouse was clicked in the taskbar menu
// or the dialog is currently inactive // or the dialog is currently inactive
if (!isModalHook && !onTaskbar && (dialog == prevFGWindow)) { if (!isModalHook && !onTaskbar && (blocker == prevFGWindow)) {
AnimateModalBlocker(dialog); AnimateModalBlocker(blocker);
} }
::BringWindowToTop(dialog); ::BringWindowToTop(blocker);
::SetForegroundWindow(dialog); ::SetForegroundWindow(blocker);
} }
} }
......
...@@ -113,8 +113,8 @@ private: ...@@ -113,8 +113,8 @@ private:
*/ */
static void ModalPerformActivation(HWND hWnd); static void ModalPerformActivation(HWND hWnd);
static void PopupAllDialogs(HWND dialog, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar); static void PopupBlockers(HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
static void PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar); static void PopupBlocker(HWND blocker, HWND nextBlocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
public: public:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册