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/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 (GetWidget()->ShouldUseNativeFrame() && !remove_standard_frame_)) | 2195 (GetWidget()->ShouldUseNativeFrame() && !remove_standard_frame_)) |
2196 return gfx::Insets(); | 2196 return gfx::Insets(); |
2197 | 2197 |
2198 if (IsMaximized()) { | 2198 if (IsMaximized()) { |
2199 // Windows automatically adds a standard width border to all sides when a | 2199 // Windows automatically adds a standard width border to all sides when a |
2200 // window is maximized. | 2200 // window is maximized. |
2201 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); | 2201 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); |
2202 return gfx::Insets(border_thickness, border_thickness, border_thickness, | 2202 return gfx::Insets(border_thickness, border_thickness, border_thickness, |
2203 border_thickness); | 2203 border_thickness); |
2204 } | 2204 } |
| 2205 |
| 2206 // The hack below doesn't seem to be necessary when the standard frame is |
| 2207 // removed. |
| 2208 if (remove_standard_frame_) |
| 2209 return gfx::Insets(); |
2205 // This is weird, but highly essential. If we don't offset the bottom edge | 2210 // This is weird, but highly essential. If we don't offset the bottom edge |
2206 // of the client rect, the window client area and window area will match, | 2211 // of the client rect, the window client area and window area will match, |
2207 // and when returning to glass rendering mode from non-glass, the client | 2212 // and when returning to glass rendering mode from non-glass, the client |
2208 // area will not paint black as transparent. This is because (and I don't | 2213 // area will not paint black as transparent. This is because (and I don't |
2209 // know why) the client area goes from matching the window rect to being | 2214 // know why) the client area goes from matching the window rect to being |
2210 // something else. If the client area is not the window rect in both | 2215 // something else. If the client area is not the window rect in both |
2211 // modes, the blackness doesn't occur. Because of this, we need to tell | 2216 // modes, the blackness doesn't occur. Because of this, we need to tell |
2212 // the RootView to lay out to fit the window rect, rather than the client | 2217 // the RootView to lay out to fit the window rect, rather than the client |
2213 // rect when using the opaque frame. | 2218 // rect when using the opaque frame. |
2214 // Note: this is only required for non-fullscreen windows. Note that | 2219 // Note: this is only required for non-fullscreen windows. Note that |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2710 return (GetKeyState(VK_LBUTTON) & 0x80) || |
2706 (GetKeyState(VK_RBUTTON) & 0x80) || | 2711 (GetKeyState(VK_RBUTTON) & 0x80) || |
2707 (GetKeyState(VK_MBUTTON) & 0x80) || | 2712 (GetKeyState(VK_MBUTTON) & 0x80) || |
2708 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2713 (GetKeyState(VK_XBUTTON1) & 0x80) || |
2709 (GetKeyState(VK_XBUTTON2) & 0x80); | 2714 (GetKeyState(VK_XBUTTON2) & 0x80); |
2710 } | 2715 } |
2711 | 2716 |
2712 } // namespace internal | 2717 } // namespace internal |
2713 | 2718 |
2714 } // namespace views | 2719 } // namespace views |
OLD | NEW |