| 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 <wtsapi32.h> | 10 #include <wtsapi32.h> |
| (...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 // Returning false causes the default handling in OnNCCalcSize() to | 1061 // Returning false causes the default handling in OnNCCalcSize() to |
| 1062 // be invoked. | 1062 // be invoked. |
| 1063 if (!delegate_->IsWidgetWindow() || | 1063 if (!delegate_->IsWidgetWindow() || |
| 1064 (!delegate_->IsUsingCustomFrame() && !remove_standard_frame_)) { | 1064 (!delegate_->IsUsingCustomFrame() && !remove_standard_frame_)) { |
| 1065 return false; | 1065 return false; |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 if (IsMaximized()) { | 1068 if (IsMaximized()) { |
| 1069 // Windows automatically adds a standard width border to all sides when a | 1069 // Windows automatically adds a standard width border to all sides when a |
| 1070 // window is maximized. | 1070 // window is maximized. |
| 1071 int border_thickness = | 1071 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); |
| 1072 GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER); | |
| 1073 if (remove_standard_frame_) | 1072 if (remove_standard_frame_) |
| 1074 border_thickness -= 1; | 1073 border_thickness -= 1; |
| 1075 *insets = gfx::Insets( | 1074 *insets = gfx::Insets( |
| 1076 border_thickness, border_thickness, border_thickness, border_thickness); | 1075 border_thickness, border_thickness, border_thickness, border_thickness); |
| 1077 return true; | 1076 return true; |
| 1078 } | 1077 } |
| 1079 | 1078 |
| 1080 *insets = gfx::Insets(); | 1079 *insets = gfx::Insets(); |
| 1081 return true; | 1080 return true; |
| 1082 } | 1081 } |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 hit_test_code = HTCLIENT; | 1729 hit_test_code = HTCLIENT; |
| 1731 break; | 1730 break; |
| 1732 | 1731 |
| 1733 case HTBOTTOMRIGHT: { | 1732 case HTBOTTOMRIGHT: { |
| 1734 // Normally the HTBOTTOMRIGHT hittest code is received when we hover | 1733 // Normally the HTBOTTOMRIGHT hittest code is received when we hover |
| 1735 // near the bottom right of the window. However due to our fake scroll | 1734 // near the bottom right of the window. However due to our fake scroll |
| 1736 // styles, we get this code even when we hover around the area where | 1735 // styles, we get this code even when we hover around the area where |
| 1737 // the vertical scrollar down arrow would be drawn. | 1736 // the vertical scrollar down arrow would be drawn. |
| 1738 // We check if the hittest coordinates lie in this region and if yes | 1737 // We check if the hittest coordinates lie in this region and if yes |
| 1739 // we return HTCLIENT. | 1738 // we return HTCLIENT. |
| 1740 int border_width = ::GetSystemMetrics(SM_CXSIZEFRAME) + | 1739 int border_width = ::GetSystemMetrics(SM_CXSIZEFRAME); |
| 1741 GetSystemMetrics(SM_CXPADDEDBORDER); | 1740 int border_height = ::GetSystemMetrics(SM_CYSIZEFRAME); |
| 1742 int border_height = ::GetSystemMetrics(SM_CYSIZEFRAME) + | |
| 1743 GetSystemMetrics(SM_CXPADDEDBORDER); | |
| 1744 int scroll_width = ::GetSystemMetrics(SM_CXVSCROLL); | 1741 int scroll_width = ::GetSystemMetrics(SM_CXVSCROLL); |
| 1745 int scroll_height = ::GetSystemMetrics(SM_CYVSCROLL); | 1742 int scroll_height = ::GetSystemMetrics(SM_CYVSCROLL); |
| 1746 RECT window_rect; | 1743 RECT window_rect; |
| 1747 ::GetWindowRect(hwnd(), &window_rect); | 1744 ::GetWindowRect(hwnd(), &window_rect); |
| 1748 window_rect.bottom -= border_height; | 1745 window_rect.bottom -= border_height; |
| 1749 window_rect.right -= border_width; | 1746 window_rect.right -= border_width; |
| 1750 window_rect.left = window_rect.right - scroll_width; | 1747 window_rect.left = window_rect.right - scroll_width; |
| 1751 window_rect.top = window_rect.bottom - scroll_height; | 1748 window_rect.top = window_rect.bottom - scroll_height; |
| 1752 POINT pt; | 1749 POINT pt; |
| 1753 pt.x = point.x(); | 1750 pt.x = point.x(); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 // nVidia's nView desktop manager) the work area can change asynchronous | 2196 // nVidia's nView desktop manager) the work area can change asynchronous |
| 2200 // to any notification, and we're just sent a SetWindowPos() call with a | 2197 // to any notification, and we're just sent a SetWindowPos() call with a |
| 2201 // new (frequently incorrect) position/size. In either case, the best | 2198 // new (frequently incorrect) position/size. In either case, the best |
| 2202 // response is to throw away the existing position/size information in | 2199 // response is to throw away the existing position/size information in |
| 2203 // |window_pos| and recalculate it based on the new work rect. | 2200 // |window_pos| and recalculate it based on the new work rect. |
| 2204 gfx::Rect new_window_rect; | 2201 gfx::Rect new_window_rect; |
| 2205 if (fullscreen_handler_->fullscreen()) { | 2202 if (fullscreen_handler_->fullscreen()) { |
| 2206 new_window_rect = monitor_rect; | 2203 new_window_rect = monitor_rect; |
| 2207 } else if (IsMaximized()) { | 2204 } else if (IsMaximized()) { |
| 2208 new_window_rect = work_area; | 2205 new_window_rect = work_area; |
| 2209 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME) + | 2206 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); |
| 2210 GetSystemMetrics(SM_CXPADDEDBORDER); | |
| 2211 new_window_rect.Inset(-border_thickness, -border_thickness); | 2207 new_window_rect.Inset(-border_thickness, -border_thickness); |
| 2212 } else { | 2208 } else { |
| 2213 new_window_rect = gfx::Rect(window_rect); | 2209 new_window_rect = gfx::Rect(window_rect); |
| 2214 new_window_rect.AdjustToFit(work_area); | 2210 new_window_rect.AdjustToFit(work_area); |
| 2215 } | 2211 } |
| 2216 window_pos->x = new_window_rect.x(); | 2212 window_pos->x = new_window_rect.x(); |
| 2217 window_pos->y = new_window_rect.y(); | 2213 window_pos->y = new_window_rect.y(); |
| 2218 window_pos->cx = new_window_rect.width(); | 2214 window_pos->cx = new_window_rect.width(); |
| 2219 window_pos->cy = new_window_rect.height(); | 2215 window_pos->cy = new_window_rect.height(); |
| 2220 // WARNING! Don't set SWP_FRAMECHANGED here, it breaks moving the child | 2216 // WARNING! Don't set SWP_FRAMECHANGED here, it breaks moving the child |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 POINT cursor_pos = {0}; | 2420 POINT cursor_pos = {0}; |
| 2425 ::GetCursorPos(&cursor_pos); | 2421 ::GetCursorPos(&cursor_pos); |
| 2426 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) | 2422 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) |
| 2427 return false; | 2423 return false; |
| 2428 return true; | 2424 return true; |
| 2429 } | 2425 } |
| 2430 return false; | 2426 return false; |
| 2431 } | 2427 } |
| 2432 | 2428 |
| 2433 } // namespace views | 2429 } // namespace views |
| OLD | NEW |