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> | |
8 | |
9 #include "base/command_line.h" | 7 #include "base/command_line.h" |
10 #include "build/build_config.h" | 8 #include "build/build_config.h" |
11 #include "ui/base/l10n/l10n_util_win.h" | 9 #include "ui/base/l10n/l10n_util_win.h" |
12 #include "ui/base/ui_base_switches.h" | 10 #include "ui/base/ui_base_switches.h" |
13 #include "ui/views/widget/widget_delegate.h" | 11 #include "ui/views/widget/widget_delegate.h" |
14 #include "ui/views/win/hwnd_message_handler.h" | 12 #include "ui/views/win/hwnd_message_handler.h" |
15 | 13 |
16 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
17 #include "ui/base/win/shell.h" | 15 #include "ui/base/win/shell.h" |
18 #endif | 16 #endif |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // behind it, it must must be created with D3DFMT_A8R8G8B8 in D3D9Ex, or | 142 // behind it, it must must be created with D3DFMT_A8R8G8B8 in D3D9Ex, or |
145 // with DXGI_ALPHA_MODE_PREMULTIPLIED with DirectComposition. | 143 // with DXGI_ALPHA_MODE_PREMULTIPLIED with DirectComposition. |
146 // 2- When the window is created but before it is presented, call | 144 // 2- When the window is created but before it is presented, call |
147 // DwmExtendFrameIntoClientArea passing -1 as the margins so that | 145 // DwmExtendFrameIntoClientArea passing -1 as the margins so that |
148 // it's blended with the content below the window and not just black. | 146 // it's blended with the content below the window and not just black. |
149 // 3- To avoid having a window frame and to avoid blurring the contents | 147 // 3- To avoid having a window frame and to avoid blurring the contents |
150 // behind the window, the window must have WS_POPUP in its style and must | 148 // behind the window, the window must have WS_POPUP in its style and must |
151 // not have not have WM_SIZEBOX, WS_THICKFRAME or WS_CAPTION in its | 149 // not have not have WM_SIZEBOX, WS_THICKFRAME or WS_CAPTION in its |
152 // style. | 150 // style. |
153 // | 151 // |
154 // This doesn't work when Aero is disabled, so disable it in that case. | 152 // This doesn't work when Aero is disabled, but leave the flag on so |
155 // Software composited windows can continue to use WS_EX_LAYERED. | 153 // software composited windows can continue to use WS_EX_LAYERED. Code that |
| 154 // would create translucent hardware-composited windows should do something |
| 155 // else instead. |
156 bool is_translucent = | 156 bool is_translucent = |
157 (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW && | 157 (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW); |
158 (ui::win::IsAeroGlassEnabled() || params.force_software_compositing)); | |
159 | 158 |
160 CalculateWindowStylesFromInitParams(params, widget_delegate, | 159 CalculateWindowStylesFromInitParams(params, widget_delegate, |
161 native_widget_delegate, is_translucent, | 160 native_widget_delegate, is_translucent, |
162 &style, &ex_style, &class_style); | 161 &style, &ex_style, &class_style); |
163 handler->set_is_translucent(is_translucent); | 162 handler->set_is_translucent(is_translucent); |
164 handler->set_initial_class_style(class_style); | 163 handler->set_initial_class_style(class_style); |
165 handler->set_window_style(handler->window_style() | style); | 164 handler->set_window_style(handler->window_style() | style); |
166 handler->set_window_ex_style(handler->window_ex_style() | ex_style); | 165 handler->set_window_ex_style(handler->window_ex_style() | ex_style); |
167 } | 166 } |
168 | 167 |
169 } // namespace views | 168 } // namespace views |
OLD | NEW |