Chromium Code Reviews| 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 <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 } | 292 } |
| 293 | 293 |
| 294 return false; | 294 return false; |
| 295 } | 295 } |
| 296 | 296 |
| 297 #endif | 297 #endif |
| 298 | 298 |
| 299 // The thickness of an auto-hide taskbar in pixels. | 299 // The thickness of an auto-hide taskbar in pixels. |
| 300 const int kAutoHideTaskbarThicknessPx = 2; | 300 const int kAutoHideTaskbarThicknessPx = 2; |
| 301 | 301 |
| 302 // For windows with the standard frame removed, the client area needs to be | |
| 303 // different from the window area to avoid a "feature" in Windows's handling of | |
| 304 // WM_NCCALCSIZE data. See the comment near the bottom of GetClientAreaInsets | |
| 305 // for more details. | |
| 306 const int kClientAreaBottomInsetHack = -1; | |
| 307 | |
| 308 } // namespace | 302 } // namespace |
| 309 | 303 |
| 310 // A scoping class that prevents a window from being able to redraw in response | 304 // A scoping class that prevents a window from being able to redraw in response |
| 311 // to invalidations that may occur within it for the lifetime of the object. | 305 // to invalidations that may occur within it for the lifetime of the object. |
| 312 // | 306 // |
| 313 // Why would we want such a thing? Well, it turns out Windows has some | 307 // Why would we want such a thing? Well, it turns out Windows has some |
| 314 // "unorthodox" behavior when it comes to painting its non-client areas. | 308 // "unorthodox" behavior when it comes to painting its non-client areas. |
| 315 // Occasionally, Windows will paint portions of the default non-client area | 309 // Occasionally, Windows will paint portions of the default non-client area |
| 316 // right over the top of the custom frame. This is not simply fixed by handling | 310 // right over the top of the custom frame. This is not simply fixed by handling |
| 317 // WM_NCPAINT/WM_PAINT, with some investigation it turns out that this | 311 // WM_NCPAINT/WM_PAINT, with some investigation it turns out that this |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 779 // change from opaque to glass. "Non client rendering enabled" means that | 773 // change from opaque to glass. "Non client rendering enabled" means that |
| 780 // the DWM's glass non-client rendering is enabled, which is why | 774 // the DWM's glass non-client rendering is enabled, which is why |
| 781 // DWMNCRP_ENABLED is used for the native frame case. _DISABLED means the | 775 // DWMNCRP_ENABLED is used for the native frame case. _DISABLED means the |
| 782 // DWM doesn't render glass, and so is used in the custom frame case. | 776 // DWM doesn't render glass, and so is used in the custom frame case. |
| 783 DWMNCRENDERINGPOLICY policy = !delegate_->IsUsingCustomFrame() ? | 777 DWMNCRENDERINGPOLICY policy = !delegate_->IsUsingCustomFrame() ? |
| 784 DWMNCRP_ENABLED : DWMNCRP_DISABLED; | 778 DWMNCRP_ENABLED : DWMNCRP_DISABLED; |
| 785 DwmSetWindowAttribute(hwnd(), DWMWA_NCRENDERING_POLICY, | 779 DwmSetWindowAttribute(hwnd(), DWMWA_NCRENDERING_POLICY, |
| 786 &policy, sizeof(DWMNCRENDERINGPOLICY)); | 780 &policy, sizeof(DWMNCRENDERINGPOLICY)); |
| 787 } | 781 } |
| 788 | 782 |
| 789 ResetWindowRegion(true); | 783 // Don't redraw the window here, because we need to hide and show the window |
| 784 // which will also trigger a redraw. | |
| 785 ResetWindowRegion(true, false); | |
| 786 | |
| 787 ::SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, | |
| 788 SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); | |
|
Peter Kasting
2013/11/12 01:47:03
Nit: All lines of args should begin at the same ho
| |
| 790 | 789 |
| 791 // The non-client view needs to update too. | 790 // The non-client view needs to update too. |
|
Peter Kasting
2013/11/12 01:47:03
Does this explicitly need to happen before some of
| |
| 792 delegate_->HandleFrameChanged(); | 791 delegate_->HandleFrameChanged(); |
| 793 | 792 |
| 793 // For some reason, we need to hide the window after we change the frame type. | |
| 794 // If we don't, the client area will be filled with black. This is somehow | |
| 795 // related to an interaction between SetWindowRgn and Dwm, but it's not clear | |
| 796 // exactly what. | |
| 797 if (IsVisible()) { | |
| 798 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, | |
| 799 SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); | |
| 800 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, | |
| 801 SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); | |
|
Peter Kasting
2013/11/12 01:47:03
How are these calls different than what you could
| |
| 802 } | |
| 803 | |
| 804 UpdateWindow(hwnd()); | |
| 805 | |
| 794 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 806 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
| 795 // to notify our children too, since we can have MDI child windows who need to | 807 // to notify our children too, since we can have MDI child windows who need to |
| 796 // update their appearance. | 808 // update their appearance. |
| 797 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 809 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
| 798 } | 810 } |
| 799 | 811 |
| 800 void HWNDMessageHandler::SchedulePaintInRect(const gfx::Rect& rect) { | 812 void HWNDMessageHandler::SchedulePaintInRect(const gfx::Rect& rect) { |
| 801 if (use_layered_buffer_) { | 813 if (use_layered_buffer_) { |
| 802 // We must update the back-buffer immediately, since Windows' handling of | 814 // We must update the back-buffer immediately, since Windows' handling of |
| 803 // invalid rects is somewhat mysterious. | 815 // invalid rects is somewhat mysterious. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1036 TrackMouseEvents(active_mouse_tracking_flags_ | TME_CANCEL); | 1048 TrackMouseEvents(active_mouse_tracking_flags_ | TME_CANCEL); |
| 1037 TrackMouseEvents(mouse_tracking_flags); | 1049 TrackMouseEvents(mouse_tracking_flags); |
| 1038 } | 1050 } |
| 1039 } | 1051 } |
| 1040 | 1052 |
| 1041 void HWNDMessageHandler::ClientAreaSizeChanged() { | 1053 void HWNDMessageHandler::ClientAreaSizeChanged() { |
| 1042 RECT r = {0, 0, 0, 0}; | 1054 RECT r = {0, 0, 0, 0}; |
| 1043 // In case of minimized window GetWindowRect can return normally unexpected | 1055 // In case of minimized window GetWindowRect can return normally unexpected |
| 1044 // coordinates. | 1056 // coordinates. |
| 1045 if (!IsMinimized()) { | 1057 if (!IsMinimized()) { |
| 1046 if (delegate_->WidgetSizeIsClientSize()) { | 1058 if (delegate_->WidgetSizeIsClientSize()) |
| 1047 GetClientRect(hwnd(), &r); | 1059 GetClientRect(hwnd(), &r); |
| 1048 gfx::Insets insets; | 1060 else |
| 1049 bool got_insets = GetClientAreaInsets(&insets); | |
| 1050 if (got_insets) { | |
| 1051 // This is needed due to a hack that works around a "feature" in | |
| 1052 // Windows's handling of WM_NCCALCSIZE. See the comment near the end of | |
| 1053 // GetClientAreaInsets for more details. | |
| 1054 if ((remove_standard_frame_ && !IsMaximized()) || | |
| 1055 !fullscreen_handler_->fullscreen()) { | |
| 1056 r.bottom += kClientAreaBottomInsetHack; | |
| 1057 } | |
| 1058 } | |
| 1059 } else { | |
| 1060 GetWindowRect(hwnd(), &r); | 1061 GetWindowRect(hwnd(), &r); |
| 1061 } | |
| 1062 } | 1062 } |
| 1063 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), | 1063 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), |
| 1064 std::max(0, static_cast<int>(r.bottom - r.top))); | 1064 std::max(0, static_cast<int>(r.bottom - r.top))); |
| 1065 delegate_->HandleClientSizeChanged(s); | 1065 delegate_->HandleClientSizeChanged(s); |
| 1066 if (use_layered_buffer_) | 1066 if (use_layered_buffer_) |
| 1067 layered_window_contents_.reset(new gfx::Canvas(s, 1.0f, false)); | 1067 layered_window_contents_.reset(new gfx::Canvas(s, 1.0f, false)); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const { | 1070 bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const { |
| 1071 if (delegate_->GetClientAreaInsets(insets)) | 1071 if (delegate_->GetClientAreaInsets(insets)) |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1083 // Windows automatically adds a standard width border to all sides when a | 1083 // Windows automatically adds a standard width border to all sides when a |
| 1084 // window is maximized. | 1084 // window is maximized. |
| 1085 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); | 1085 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); |
| 1086 if (remove_standard_frame_) | 1086 if (remove_standard_frame_) |
| 1087 border_thickness -= 1; | 1087 border_thickness -= 1; |
| 1088 *insets = gfx::Insets( | 1088 *insets = gfx::Insets( |
| 1089 border_thickness, border_thickness, border_thickness, border_thickness); | 1089 border_thickness, border_thickness, border_thickness, border_thickness); |
| 1090 return true; | 1090 return true; |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 // Returning empty insets for a window with the standard frame removed seems | 1093 *insets = gfx::Insets(0, 0, 0, 0); |
|
Peter Kasting
2013/11/12 01:47:03
Nit: Just use gfx::Insets()
| |
| 1094 // to cause Windows to treat the window specially, treating black as | |
| 1095 // transparent and changing around some of the painting logic. I suspect it's | |
| 1096 // some sort of horrible backwards-compatability hack, but the upshot of it | |
| 1097 // is that if the insets are empty then in certain conditions (it seems to | |
| 1098 // be subtly related to timing), the contents of windows with the standard | |
| 1099 // frame removed will flicker to transparent during resize. | |
| 1100 // | |
| 1101 // To work around this, we increase the size of the client area by 1px | |
| 1102 // *beyond* the bottom of the window. This prevents Windows from having a | |
| 1103 // hissy fit and flashing the window incessantly during resizes, but it also | |
| 1104 // means that the client area is reported 1px larger than it really is, so | |
| 1105 // user code has to compensate by making its content shorter if it wants | |
| 1106 // everything to appear inside the window. | |
| 1107 if (remove_standard_frame_) { | |
| 1108 *insets = | |
| 1109 gfx::Insets(0, 0, IsMaximized() ? 0 : kClientAreaBottomInsetHack, 0); | |
| 1110 return true; | |
| 1111 } | |
| 1112 | |
| 1113 // This is weird, but highly essential. If we don't offset the bottom edge | |
| 1114 // of the client rect, the window client area and window area will match, | |
| 1115 // and when returning to glass rendering mode from non-glass, the client | |
| 1116 // area will not paint black as transparent. This is because (and I don't | |
| 1117 // know why) the client area goes from matching the window rect to being | |
| 1118 // something else. If the client area is not the window rect in both | |
| 1119 // modes, the blackness doesn't occur. Because of this, we need to tell | |
| 1120 // the RootView to lay out to fit the window rect, rather than the client | |
| 1121 // rect when using the opaque frame. | |
| 1122 // Note: this is only required for non-fullscreen windows. Note that | |
| 1123 // fullscreen windows are in restored state, not maximized. | |
| 1124 // Note that previously we used to inset by 1 instead of outset, but that | |
| 1125 // doesn't work with Aura: http://crbug.com/172099 http://crbug.com/277228 | |
| 1126 *insets = gfx::Insets( | |
| 1127 0, 0, | |
| 1128 fullscreen_handler_->fullscreen() ? 0 : kClientAreaBottomInsetHack, 0); | |
| 1129 return true; | 1094 return true; |
| 1130 } | 1095 } |
| 1131 | 1096 |
| 1132 void HWNDMessageHandler::ResetWindowRegion(bool force) { | 1097 void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { |
| 1133 // A native frame uses the native window region, and we don't want to mess | 1098 // A native frame uses the native window region, and we don't want to mess |
| 1134 // with it. | 1099 // with it. |
| 1135 // WS_EX_COMPOSITED is used instead of WS_EX_LAYERED under aura. WS_EX_LAYERED | 1100 // WS_EX_COMPOSITED is used instead of WS_EX_LAYERED under aura. WS_EX_LAYERED |
| 1136 // automatically makes clicks on transparent pixels fall through, that isn't | 1101 // automatically makes clicks on transparent pixels fall through, that isn't |
| 1137 // the case with WS_EX_COMPOSITED. So, we route WS_EX_COMPOSITED through to | 1102 // the case with WS_EX_COMPOSITED. So, we route WS_EX_COMPOSITED through to |
| 1138 // the delegate to allow for a custom hit mask. | 1103 // the delegate to allow for a custom hit mask. |
| 1139 if ((window_ex_style() & WS_EX_COMPOSITED) == 0 && | 1104 if ((window_ex_style() & WS_EX_COMPOSITED) == 0 && |
| 1140 (!delegate_->IsUsingCustomFrame() || !delegate_->IsWidgetWindow())) { | 1105 (!delegate_->IsUsingCustomFrame() || !delegate_->IsWidgetWindow())) { |
| 1141 if (force) | 1106 if (force) |
| 1142 SetWindowRgn(hwnd(), NULL, TRUE); | 1107 SetWindowRgn(hwnd(), NULL, redraw); |
| 1143 return; | 1108 return; |
| 1144 } | 1109 } |
| 1145 | 1110 |
| 1146 // Changing the window region is going to force a paint. Only change the | 1111 // Changing the window region is going to force a paint. Only change the |
| 1147 // window region if the region really differs. | 1112 // window region if the region really differs. |
| 1148 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); | 1113 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); |
| 1149 int current_rgn_result = GetWindowRgn(hwnd(), current_rgn); | 1114 int current_rgn_result = GetWindowRgn(hwnd(), current_rgn); |
| 1150 | 1115 |
| 1151 CRect window_rect; | 1116 CRect window_rect; |
| 1152 GetWindowRect(hwnd(), &window_rect); | 1117 GetWindowRect(hwnd(), &window_rect); |
| 1153 HRGN new_region; | 1118 HRGN new_region; |
| 1154 if (IsMaximized()) { | 1119 if (IsMaximized()) { |
| 1155 HMONITOR monitor = MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST); | 1120 HMONITOR monitor = MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST); |
| 1156 MONITORINFO mi; | 1121 MONITORINFO mi; |
| 1157 mi.cbSize = sizeof mi; | 1122 mi.cbSize = sizeof mi; |
| 1158 base::win::GetMonitorInfoWrapper(monitor, &mi); | 1123 base::win::GetMonitorInfoWrapper(monitor, &mi); |
| 1159 CRect work_rect = mi.rcWork; | 1124 CRect work_rect = mi.rcWork; |
| 1160 work_rect.OffsetRect(-window_rect.left, -window_rect.top); | 1125 work_rect.OffsetRect(-window_rect.left, -window_rect.top); |
| 1161 new_region = CreateRectRgnIndirect(&work_rect); | 1126 new_region = CreateRectRgnIndirect(&work_rect); |
| 1162 } else { | 1127 } else { |
| 1163 gfx::Path window_mask; | 1128 gfx::Path window_mask; |
| 1164 delegate_->GetWindowMask( | 1129 delegate_->GetWindowMask( |
| 1165 gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); | 1130 gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); |
| 1166 new_region = gfx::CreateHRGNFromSkPath(window_mask); | 1131 new_region = gfx::CreateHRGNFromSkPath(window_mask); |
| 1167 } | 1132 } |
| 1168 | 1133 |
| 1169 if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { | 1134 if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { |
| 1170 // SetWindowRgn takes ownership of the HRGN created by CreateNativeRegion. | 1135 // SetWindowRgn takes ownership of the HRGN created by CreateNativeRegion. |
| 1171 SetWindowRgn(hwnd(), new_region, TRUE); | 1136 SetWindowRgn(hwnd(), new_region, redraw); |
| 1172 } else { | 1137 } else { |
| 1173 DeleteObject(new_region); | 1138 DeleteObject(new_region); |
| 1174 } | 1139 } |
| 1175 | 1140 |
| 1176 DeleteObject(current_rgn); | 1141 DeleteObject(current_rgn); |
| 1177 } | 1142 } |
| 1178 | 1143 |
| 1179 LRESULT HWNDMessageHandler::DefWindowProcWithRedrawLock(UINT message, | 1144 LRESULT HWNDMessageHandler::DefWindowProcWithRedrawLock(UINT message, |
| 1180 WPARAM w_param, | 1145 WPARAM w_param, |
| 1181 LPARAM l_param) { | 1146 LPARAM l_param) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1374 delegate_->HandleDisplayChange(); | 1339 delegate_->HandleDisplayChange(); |
| 1375 } | 1340 } |
| 1376 | 1341 |
| 1377 LRESULT HWNDMessageHandler::OnDwmCompositionChanged(UINT msg, | 1342 LRESULT HWNDMessageHandler::OnDwmCompositionChanged(UINT msg, |
| 1378 WPARAM w_param, | 1343 WPARAM w_param, |
| 1379 LPARAM l_param) { | 1344 LPARAM l_param) { |
| 1380 if (!delegate_->IsWidgetWindow()) { | 1345 if (!delegate_->IsWidgetWindow()) { |
| 1381 SetMsgHandled(FALSE); | 1346 SetMsgHandled(FALSE); |
| 1382 return 0; | 1347 return 0; |
| 1383 } | 1348 } |
| 1384 // For some reason, we need to hide the window while we're changing the frame | 1349 |
| 1385 // type only when we're changing it in response to WM_DWMCOMPOSITIONCHANGED. | |
| 1386 // If we don't, the client area will be filled with black. I'm suspecting | |
| 1387 // something skia-ey. | |
| 1388 // Frame type toggling caused by the user (e.g. switching theme) doesn't seem | |
| 1389 // to have this requirement. | |
| 1390 FrameTypeChanged(); | 1350 FrameTypeChanged(); |
| 1391 return 0; | 1351 return 0; |
| 1392 } | 1352 } |
| 1393 | 1353 |
| 1394 void HWNDMessageHandler::OnEnterSizeMove() { | 1354 void HWNDMessageHandler::OnEnterSizeMove() { |
| 1395 delegate_->HandleBeginWMSizeMove(); | 1355 delegate_->HandleBeginWMSizeMove(); |
| 1396 SetMsgHandled(FALSE); | 1356 SetMsgHandled(FALSE); |
| 1397 } | 1357 } |
| 1398 | 1358 |
| 1399 LRESULT HWNDMessageHandler::OnEraseBkgnd(HDC dc) { | 1359 LRESULT HWNDMessageHandler::OnEraseBkgnd(HDC dc) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1410 gfx::Size min_window_size; | 1370 gfx::Size min_window_size; |
| 1411 gfx::Size max_window_size; | 1371 gfx::Size max_window_size; |
| 1412 delegate_->GetMinMaxSize(&min_window_size, &max_window_size); | 1372 delegate_->GetMinMaxSize(&min_window_size, &max_window_size); |
| 1413 | 1373 |
| 1414 // Add the native frame border size to the minimum and maximum size if the | 1374 // Add the native frame border size to the minimum and maximum size if the |
| 1415 // view reports its size as the client size. | 1375 // view reports its size as the client size. |
| 1416 if (delegate_->WidgetSizeIsClientSize()) { | 1376 if (delegate_->WidgetSizeIsClientSize()) { |
| 1417 CRect client_rect, window_rect; | 1377 CRect client_rect, window_rect; |
| 1418 GetClientRect(hwnd(), &client_rect); | 1378 GetClientRect(hwnd(), &client_rect); |
| 1419 GetWindowRect(hwnd(), &window_rect); | 1379 GetWindowRect(hwnd(), &window_rect); |
| 1420 // Due to the client area bottom inset hack (detailed elsewhere), adjust | |
| 1421 // the reported size of the client area in the case that the standard frame | |
| 1422 // has been removed. | |
| 1423 if (remove_standard_frame_) | |
| 1424 client_rect.bottom += kClientAreaBottomInsetHack; | |
| 1425 window_rect -= client_rect; | 1380 window_rect -= client_rect; |
| 1426 min_window_size.Enlarge(window_rect.Width(), window_rect.Height()); | 1381 min_window_size.Enlarge(window_rect.Width(), window_rect.Height()); |
| 1427 if (!max_window_size.IsEmpty()) | 1382 if (!max_window_size.IsEmpty()) |
| 1428 max_window_size.Enlarge(window_rect.Width(), window_rect.Height()); | 1383 max_window_size.Enlarge(window_rect.Width(), window_rect.Height()); |
| 1429 } | 1384 } |
| 1430 minmax_info->ptMinTrackSize.x = min_window_size.width(); | 1385 minmax_info->ptMinTrackSize.x = min_window_size.width(); |
| 1431 minmax_info->ptMinTrackSize.y = min_window_size.height(); | 1386 minmax_info->ptMinTrackSize.y = min_window_size.height(); |
| 1432 if (max_window_size.width() || max_window_size.height()) { | 1387 if (max_window_size.width() || max_window_size.height()) { |
| 1433 if (!max_window_size.width()) | 1388 if (!max_window_size.width()) |
| 1434 max_window_size.set_width(GetSystemMetrics(SM_CXMAXTRACK)); | 1389 max_window_size.set_width(GetSystemMetrics(SM_CXMAXTRACK)); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2021 if (flags == SPI_SETWORKAREA) | 1976 if (flags == SPI_SETWORKAREA) |
| 2022 delegate_->HandleWorkAreaChanged(); | 1977 delegate_->HandleWorkAreaChanged(); |
| 2023 SetMsgHandled(FALSE); | 1978 SetMsgHandled(FALSE); |
| 2024 } | 1979 } |
| 2025 } | 1980 } |
| 2026 | 1981 |
| 2027 void HWNDMessageHandler::OnSize(UINT param, const CSize& size) { | 1982 void HWNDMessageHandler::OnSize(UINT param, const CSize& size) { |
| 2028 RedrawWindow(hwnd(), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); | 1983 RedrawWindow(hwnd(), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); |
| 2029 // ResetWindowRegion is going to trigger WM_NCPAINT. By doing it after we've | 1984 // ResetWindowRegion is going to trigger WM_NCPAINT. By doing it after we've |
| 2030 // invoked OnSize we ensure the RootView has been laid out. | 1985 // invoked OnSize we ensure the RootView has been laid out. |
| 2031 ResetWindowRegion(false); | 1986 ResetWindowRegion(false, true); |
| 2032 } | 1987 } |
| 2033 | 1988 |
| 2034 void HWNDMessageHandler::OnSysCommand(UINT notification_code, | 1989 void HWNDMessageHandler::OnSysCommand(UINT notification_code, |
| 2035 const CPoint& point) { | 1990 const CPoint& point) { |
| 2036 if (!delegate_->ShouldHandleSystemCommands()) | 1991 if (!delegate_->ShouldHandleSystemCommands()) |
| 2037 return; | 1992 return; |
| 2038 | 1993 |
| 2039 // Windows uses the 4 lower order bits of |notification_code| for type- | 1994 // Windows uses the 4 lower order bits of |notification_code| for type- |
| 2040 // specific information so we must exclude this when comparing. | 1995 // specific information so we must exclude this when comparing. |
| 2041 static const int sc_mask = 0xFFF0; | 1996 static const int sc_mask = 0xFFF0; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2241 delegate_->HandleVisibilityChanged(false); | 2196 delegate_->HandleVisibilityChanged(false); |
| 2242 SetMsgHandled(FALSE); | 2197 SetMsgHandled(FALSE); |
| 2243 } | 2198 } |
| 2244 | 2199 |
| 2245 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { | 2200 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { |
| 2246 for (size_t i = 0; i < touch_events.size(); ++i) | 2201 for (size_t i = 0; i < touch_events.size(); ++i) |
| 2247 delegate_->HandleTouchEvent(touch_events[i]); | 2202 delegate_->HandleTouchEvent(touch_events[i]); |
| 2248 } | 2203 } |
| 2249 | 2204 |
| 2250 } // namespace views | 2205 } // namespace views |
| OLD | NEW |