Chromium Code Reviews| Index: ui/views/win/hwnd_message_handler.cc |
| diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc |
| index ec631af3b840741db1404d454ad652586b11bc25..c20f120cb4af921dcecf891c05ec462d884be59d 100644 |
| --- a/ui/views/win/hwnd_message_handler.cc |
| +++ b/ui/views/win/hwnd_message_handler.cc |
| @@ -1631,6 +1631,35 @@ LRESULT HWNDMessageHandler::OnPointerActivate(UINT message, |
| void HWNDMessageHandler::OnMove(const gfx::Point& point) { |
| delegate_->HandleMove(); |
| + |
| + RECT window_rect; |
|
sky
2016/09/29 18:16:23
Would it make more sense for this to be in OnWindo
|
| + HMONITOR monitor; |
| + gfx::Rect monitor_rect, work_area; |
| + if (!GetParent(hwnd()) && IsMaximized() && |
| + GetWindowRect(hwnd(), &window_rect) && |
| + GetMonitorAndRects(window_rect, &monitor, &monitor_rect, &work_area)) { |
| + gfx::Rect expected_window_bounds = work_area; |
| + |
| + // Windows automatically adds a standard width border to all sides when a |
| + // window is maximized. We should take this into account. |
| + gfx::Insets client_area_insets; |
| + if (GetClientAreaInsets(&client_area_insets)) |
| + expected_window_bounds.Inset(client_area_insets.Scale(-1)); |
| + |
| + if (GetWindowBoundsInScreen() != expected_window_bounds) { |
| + // Sometimes Windows incorrectly changes bounds of maximized windows after |
| + // attaching or detaching additional displays. In this case user can see |
| + // non-client area of the window (that should be hidden in normal case). |
| + // This workaround code restores window position if problem occurs. |
| + SetWindowPos(hwnd(), NULL, |
| + expected_window_bounds.x(), |
| + expected_window_bounds.y(), |
| + expected_window_bounds.width(), |
| + expected_window_bounds.height(), |
| + SWP_NOACTIVATE | SWP_NOZORDER); |
| + } |
| + } |
| + |
| SetMsgHandled(FALSE); |
| } |