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/widget_hwnd_utils.h" | 5 #include "ui/views/widget/widget_hwnd_utils.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // user32 and the DMW. If things are set up just right DMW gets out of the | 56 // user32 and the DMW. If things are set up just right DMW gets out of the |
57 // way; it does not create a backbuffer and simply blends our D3D surface | 57 // way; it does not create a backbuffer and simply blends our D3D surface |
58 // and the desktop background. The handshake is as follows: | 58 // and the desktop background. The handshake is as follows: |
59 // 1- Use D3D9Ex to create device/swapchain, etc. You need D3DFMT_A8R8G8B8. | 59 // 1- Use D3D9Ex to create device/swapchain, etc. You need D3DFMT_A8R8G8B8. |
60 // 2- The window must have WS_EX_COMPOSITED in the extended style. | 60 // 2- The window must have WS_EX_COMPOSITED in the extended style. |
61 // 3- The window must have WS_POPUP in its style. | 61 // 3- The window must have WS_POPUP in its style. |
62 // 4- The windows must not have WM_SIZEBOX, WS_THICKFRAME or WS_CAPTION in its | 62 // 4- The windows must not have WM_SIZEBOX, WS_THICKFRAME or WS_CAPTION in its |
63 // style. | 63 // style. |
64 // 5- When the window is created but before it is presented, call | 64 // 5- When the window is created but before it is presented, call |
65 // DwmExtendFrameIntoClientArea passing -1 as the margins. | 65 // DwmExtendFrameIntoClientArea passing -1 as the margins. |
| 66 // We also set the WS_EX_COMPOSITED style for software composited translucent |
| 67 // windows, which ensures that they are updated via the layered window code |
| 68 // path in the software compositor. |
66 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { | 69 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { |
67 if (ui::win::IsAeroGlassEnabled()) | 70 if (ui::win::IsAeroGlassEnabled() || params.force_software_compositing) |
68 *ex_style |= WS_EX_COMPOSITED; | 71 *ex_style |= WS_EX_COMPOSITED; |
69 } | 72 } |
70 if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_DROP) { | 73 if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_DROP) { |
71 *class_style |= (base::win::GetVersion() < base::win::VERSION_XP) ? | 74 *class_style |= (base::win::GetVersion() < base::win::VERSION_XP) ? |
72 0 : CS_DROPSHADOW; | 75 0 : CS_DROPSHADOW; |
73 } | 76 } |
74 | 77 |
75 // Set type-dependent style attributes. | 78 // Set type-dependent style attributes. |
76 switch (params.type) { | 79 switch (params.type) { |
77 case Widget::InitParams::TYPE_PANEL: | 80 case Widget::InitParams::TYPE_PANEL: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 DWORD class_style = 0; | 162 DWORD class_style = 0; |
160 CalculateWindowStylesFromInitParams(params, widget_delegate, | 163 CalculateWindowStylesFromInitParams(params, widget_delegate, |
161 native_widget_delegate, &style, &ex_style, | 164 native_widget_delegate, &style, &ex_style, |
162 &class_style); | 165 &class_style); |
163 handler->set_initial_class_style(class_style); | 166 handler->set_initial_class_style(class_style); |
164 handler->set_window_style(handler->window_style() | style); | 167 handler->set_window_style(handler->window_style() | style); |
165 handler->set_window_ex_style(handler->window_ex_style() | ex_style); | 168 handler->set_window_ex_style(handler->window_ex_style() | ex_style); |
166 } | 169 } |
167 | 170 |
168 } // namespace views | 171 } // namespace views |
OLD | NEW |