win: Don't resize windows when changing zorder
Make the HWNDMessageHandler stack functions turn off window position changes using ignore_window_pos_changes_ when calling ::SetWindowPos. Only the z-order is changing, not the window position or size. Bug: 395293617 Change-Id: Icdbc0a6706d9497cbb2f26a821432c1650b9fb2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6344530 Reviewed-by: Keren Zhu <kerenzhu@chromium.org> Commit-Queue: David Bienvenu <davidbienvenu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1431028}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
354385b712
commit
ee15a53a67
@ -652,14 +652,21 @@ void HWNDMessageHandler::SetRegion(HRGN region) {
|
||||
void HWNDMessageHandler::StackAbove(HWND other_hwnd) {
|
||||
// Windows API allows to stack behind another windows only.
|
||||
DCHECK(other_hwnd);
|
||||
HWND next_window = GetNextWindow(other_hwnd, GW_HWNDPREV);
|
||||
SetWindowPos(hwnd(), next_window ? next_window : HWND_TOP, 0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
HWND next_window = ::GetNextWindow(other_hwnd, GW_HWNDPREV);
|
||||
|
||||
// ::SetWindowPos can trigger a nested message loop with WindowPosChanged
|
||||
// which can cause an unneeded resize.
|
||||
base::AutoReset<bool> auto_reset(&ignore_window_pos_changes_, true);
|
||||
::SetWindowPos(hwnd(), next_window ? next_window : HWND_TOP, 0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
void HWNDMessageHandler::StackAtTop() {
|
||||
SetWindowPos(hwnd(), HWND_TOP, 0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
// ::SetWindowPos can trigger a nested message loop with WindowPosChanged
|
||||
// which can cause an unneeded resize.
|
||||
base::AutoReset<bool> auto_reset(&ignore_window_pos_changes_, true);
|
||||
::SetWindowPos(hwnd(), HWND_TOP, 0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state,
|
||||
|
Reference in New Issue
Block a user