OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/win/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <oleacc.h> | 8 #include <oleacc.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <tchar.h> | 10 #include <tchar.h> |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 } | 1323 } |
1324 | 1324 |
1325 void HWNDMessageHandler::OnDestroy() { | 1325 void HWNDMessageHandler::OnDestroy() { |
1326 windows_session_change_observer_.reset(nullptr); | 1326 windows_session_change_observer_.reset(nullptr); |
1327 delegate_->HandleDestroying(); | 1327 delegate_->HandleDestroying(); |
1328 } | 1328 } |
1329 | 1329 |
1330 void HWNDMessageHandler::OnDisplayChange(UINT bits_per_pixel, | 1330 void HWNDMessageHandler::OnDisplayChange(UINT bits_per_pixel, |
1331 const gfx::Size& screen_size) { | 1331 const gfx::Size& screen_size) { |
1332 delegate_->HandleDisplayChange(); | 1332 delegate_->HandleDisplayChange(); |
| 1333 // Force a WM_NCCALCSIZE to occur to ensure that we handle auto hide |
| 1334 // taskbars correctly. |
1333 SendFrameChanged(); | 1335 SendFrameChanged(); |
1334 } | 1336 } |
1335 | 1337 |
1336 LRESULT HWNDMessageHandler::OnDwmCompositionChanged(UINT msg, | 1338 LRESULT HWNDMessageHandler::OnDwmCompositionChanged(UINT msg, |
1337 WPARAM w_param, | 1339 WPARAM w_param, |
1338 LPARAM l_param) { | 1340 LPARAM l_param) { |
1339 if (!delegate_->IsWidgetWindow()) { | 1341 if (!delegate_->IsWidgetWindow()) { |
1340 SetMsgHandled(FALSE); | 1342 SetMsgHandled(FALSE); |
1341 return 0; | 1343 return 0; |
1342 } | 1344 } |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 // Fire a dummy SetWindowPos() call, so we'll trip the code in | 1983 // Fire a dummy SetWindowPos() call, so we'll trip the code in |
1982 // OnWindowPosChanging() below that notices work area changes. | 1984 // OnWindowPosChanging() below that notices work area changes. |
1983 ::SetWindowPos(hwnd(), 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | | 1985 ::SetWindowPos(hwnd(), 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | |
1984 SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); | 1986 SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); |
1985 SetMsgHandled(TRUE); | 1987 SetMsgHandled(TRUE); |
1986 } else { | 1988 } else { |
1987 if (flags == SPI_SETWORKAREA) | 1989 if (flags == SPI_SETWORKAREA) |
1988 delegate_->HandleWorkAreaChanged(); | 1990 delegate_->HandleWorkAreaChanged(); |
1989 SetMsgHandled(FALSE); | 1991 SetMsgHandled(FALSE); |
1990 } | 1992 } |
| 1993 |
| 1994 // If the work area is changing, then it could be as a result of the taskbar |
| 1995 // broadcasting the WM_SETTINGCHANGE message due to changes in auto hide |
| 1996 // settings, etc. Force a WM_NCCALCSIZE to occur to ensure that we handle |
| 1997 // this correctly. |
| 1998 if (flags == SPI_SETWORKAREA) |
| 1999 SendFrameChanged(); |
1991 } | 2000 } |
1992 | 2001 |
1993 void HWNDMessageHandler::OnSize(UINT param, const gfx::Size& size) { | 2002 void HWNDMessageHandler::OnSize(UINT param, const gfx::Size& size) { |
1994 RedrawWindow(hwnd(), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); | 2003 RedrawWindow(hwnd(), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); |
1995 // ResetWindowRegion is going to trigger WM_NCPAINT. By doing it after we've | 2004 // ResetWindowRegion is going to trigger WM_NCPAINT. By doing it after we've |
1996 // invoked OnSize we ensure the RootView has been laid out. | 2005 // invoked OnSize we ensure the RootView has been laid out. |
1997 ResetWindowRegion(false, true); | 2006 ResetWindowRegion(false, true); |
1998 | 2007 |
1999 // We add the WS_VSCROLL and WS_HSCROLL styles to top level windows to ensure | 2008 // We add the WS_VSCROLL and WS_HSCROLL styles to top level windows to ensure |
2000 // that legacy trackpad/trackpoint drivers generate the WM_VSCROLL and | 2009 // that legacy trackpad/trackpoint drivers generate the WM_VSCROLL and |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 | 2581 |
2573 default: | 2582 default: |
2574 left_button_down_on_caption_ = false; | 2583 left_button_down_on_caption_ = false; |
2575 break; | 2584 break; |
2576 } | 2585 } |
2577 return handled; | 2586 return handled; |
2578 } | 2587 } |
2579 | 2588 |
2580 | 2589 |
2581 } // namespace views | 2590 } // namespace views |
OLD | NEW |