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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 // Returning false causes the default handling in OnNCCalcSize() to | 1082 // Returning false causes the default handling in OnNCCalcSize() to |
1083 // be invoked. | 1083 // be invoked. |
1084 if (!delegate_->IsWidgetWindow() || | 1084 if (!delegate_->IsWidgetWindow() || |
1085 (!delegate_->IsUsingCustomFrame() && !remove_standard_frame_)) { | 1085 (!delegate_->IsUsingCustomFrame() && !remove_standard_frame_)) { |
1086 return false; | 1086 return false; |
1087 } | 1087 } |
1088 | 1088 |
1089 if (IsMaximized()) { | 1089 if (IsMaximized()) { |
1090 // Windows automatically adds a standard width border to all sides when a | 1090 // Windows automatically adds a standard width border to all sides when a |
1091 // window is maximized. | 1091 // window is maximized. |
1092 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); | 1092 int border_thickness = |
| 1093 GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER); |
1093 if (remove_standard_frame_) | 1094 if (remove_standard_frame_) |
1094 border_thickness -= 1; | 1095 border_thickness -= 1; |
1095 *insets = gfx::Insets( | 1096 *insets = gfx::Insets( |
1096 border_thickness, border_thickness, border_thickness, border_thickness); | 1097 border_thickness, border_thickness, border_thickness, border_thickness); |
1097 return true; | 1098 return true; |
1098 } | 1099 } |
1099 | 1100 |
1100 *insets = gfx::Insets(); | 1101 *insets = gfx::Insets(); |
1101 return true; | 1102 return true; |
1102 } | 1103 } |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 hit_test_code = HTCLIENT; | 1751 hit_test_code = HTCLIENT; |
1751 break; | 1752 break; |
1752 | 1753 |
1753 case HTBOTTOMRIGHT: { | 1754 case HTBOTTOMRIGHT: { |
1754 // Normally the HTBOTTOMRIGHT hittest code is received when we hover | 1755 // Normally the HTBOTTOMRIGHT hittest code is received when we hover |
1755 // near the bottom right of the window. However due to our fake scroll | 1756 // near the bottom right of the window. However due to our fake scroll |
1756 // styles, we get this code even when we hover around the area where | 1757 // styles, we get this code even when we hover around the area where |
1757 // the vertical scrollar down arrow would be drawn. | 1758 // the vertical scrollar down arrow would be drawn. |
1758 // We check if the hittest coordinates lie in this region and if yes | 1759 // We check if the hittest coordinates lie in this region and if yes |
1759 // we return HTCLIENT. | 1760 // we return HTCLIENT. |
1760 int border_width = ::GetSystemMetrics(SM_CXSIZEFRAME); | 1761 int border_width = ::GetSystemMetrics(SM_CXSIZEFRAME) + |
1761 int border_height = ::GetSystemMetrics(SM_CYSIZEFRAME); | 1762 GetSystemMetrics(SM_CXPADDEDBORDER); |
| 1763 int border_height = ::GetSystemMetrics(SM_CYSIZEFRAME) + |
| 1764 GetSystemMetrics(SM_CXPADDEDBORDER); |
1762 int scroll_width = ::GetSystemMetrics(SM_CXVSCROLL); | 1765 int scroll_width = ::GetSystemMetrics(SM_CXVSCROLL); |
1763 int scroll_height = ::GetSystemMetrics(SM_CYVSCROLL); | 1766 int scroll_height = ::GetSystemMetrics(SM_CYVSCROLL); |
1764 RECT window_rect; | 1767 RECT window_rect; |
1765 ::GetWindowRect(hwnd(), &window_rect); | 1768 ::GetWindowRect(hwnd(), &window_rect); |
1766 window_rect.bottom -= border_height; | 1769 window_rect.bottom -= border_height; |
1767 window_rect.right -= border_width; | 1770 window_rect.right -= border_width; |
1768 window_rect.left = window_rect.right - scroll_width; | 1771 window_rect.left = window_rect.right - scroll_width; |
1769 window_rect.top = window_rect.bottom - scroll_height; | 1772 window_rect.top = window_rect.bottom - scroll_height; |
1770 POINT pt; | 1773 POINT pt; |
1771 pt.x = point.x(); | 1774 pt.x = point.x(); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2214 // nVidia's nView desktop manager) the work area can change asynchronous | 2217 // nVidia's nView desktop manager) the work area can change asynchronous |
2215 // to any notification, and we're just sent a SetWindowPos() call with a | 2218 // to any notification, and we're just sent a SetWindowPos() call with a |
2216 // new (frequently incorrect) position/size. In either case, the best | 2219 // new (frequently incorrect) position/size. In either case, the best |
2217 // response is to throw away the existing position/size information in | 2220 // response is to throw away the existing position/size information in |
2218 // |window_pos| and recalculate it based on the new work rect. | 2221 // |window_pos| and recalculate it based on the new work rect. |
2219 gfx::Rect new_window_rect; | 2222 gfx::Rect new_window_rect; |
2220 if (fullscreen_handler_->fullscreen()) { | 2223 if (fullscreen_handler_->fullscreen()) { |
2221 new_window_rect = monitor_rect; | 2224 new_window_rect = monitor_rect; |
2222 } else if (IsMaximized()) { | 2225 } else if (IsMaximized()) { |
2223 new_window_rect = work_area; | 2226 new_window_rect = work_area; |
2224 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); | 2227 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME) + |
| 2228 GetSystemMetrics(SM_CXPADDEDBORDER); |
2225 new_window_rect.Inset(-border_thickness, -border_thickness); | 2229 new_window_rect.Inset(-border_thickness, -border_thickness); |
2226 } else { | 2230 } else { |
2227 new_window_rect = gfx::Rect(window_rect); | 2231 new_window_rect = gfx::Rect(window_rect); |
2228 new_window_rect.AdjustToFit(work_area); | 2232 new_window_rect.AdjustToFit(work_area); |
2229 } | 2233 } |
2230 window_pos->x = new_window_rect.x(); | 2234 window_pos->x = new_window_rect.x(); |
2231 window_pos->y = new_window_rect.y(); | 2235 window_pos->y = new_window_rect.y(); |
2232 window_pos->cx = new_window_rect.width(); | 2236 window_pos->cx = new_window_rect.width(); |
2233 window_pos->cy = new_window_rect.height(); | 2237 window_pos->cy = new_window_rect.height(); |
2234 // WARNING! Don't set SWP_FRAMECHANGED here, it breaks moving the child | 2238 // WARNING! Don't set SWP_FRAMECHANGED here, it breaks moving the child |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 POINT cursor_pos = {0}; | 2439 POINT cursor_pos = {0}; |
2436 ::GetCursorPos(&cursor_pos); | 2440 ::GetCursorPos(&cursor_pos); |
2437 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) | 2441 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) |
2438 return false; | 2442 return false; |
2439 return true; | 2443 return true; |
2440 } | 2444 } |
2441 return false; | 2445 return false; |
2442 } | 2446 } |
2443 | 2447 |
2444 } // namespace views | 2448 } // namespace views |
OLD | NEW |