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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // way; it does not create a backbuffer and simply blends our D3D surface | 55 // way; it does not create a backbuffer and simply blends our D3D surface |
56 // and the desktop background. The handshake is as follows: | 56 // and the desktop background. The handshake is as follows: |
57 // 1- Use D3D9Ex to create device/swapchain, etc. You need D3DFMT_A8R8G8B8. | 57 // 1- Use D3D9Ex to create device/swapchain, etc. You need D3DFMT_A8R8G8B8. |
58 // 2- The window must have WS_EX_COMPOSITED in the extended style. | 58 // 2- The window must have WS_EX_COMPOSITED in the extended style. |
59 // 3- The window must have WS_POPUP in its style. | 59 // 3- The window must have WS_POPUP in its style. |
60 // 4- The windows must not have WM_SIZEBOX, WS_THICKFRAME or WS_CAPTION in its | 60 // 4- The windows must not have WM_SIZEBOX, WS_THICKFRAME or WS_CAPTION in its |
61 // style. | 61 // style. |
62 // 5- When the window is created but before it is presented, call | 62 // 5- When the window is created but before it is presented, call |
63 // DwmExtendFrameIntoClientArea passing -1 as the margins. | 63 // DwmExtendFrameIntoClientArea passing -1 as the margins. |
64 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { | 64 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { |
65 #if defined(USE_AURA) | |
66 if (ui::win::IsAeroGlassEnabled()) | 65 if (ui::win::IsAeroGlassEnabled()) |
67 *ex_style |= WS_EX_COMPOSITED; | 66 *ex_style |= WS_EX_COMPOSITED; |
68 #else | |
69 *ex_style |= WS_EX_LAYERED; | |
70 #endif | |
71 } | 67 } |
72 if (params.has_dropshadow) { | 68 if (params.has_dropshadow) { |
73 *class_style |= (base::win::GetVersion() < base::win::VERSION_XP) ? | 69 *class_style |= (base::win::GetVersion() < base::win::VERSION_XP) ? |
74 0 : CS_DROPSHADOW; | 70 0 : CS_DROPSHADOW; |
75 } | 71 } |
76 | 72 |
77 // Set type-dependent style attributes. | 73 // Set type-dependent style attributes. |
78 switch (params.type) { | 74 switch (params.type) { |
79 case Widget::InitParams::TYPE_PANEL: | 75 case Widget::InitParams::TYPE_PANEL: |
80 *ex_style |= WS_EX_TOPMOST; | 76 *ex_style |= WS_EX_TOPMOST; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 DWORD class_style = 0; | 152 DWORD class_style = 0; |
157 CalculateWindowStylesFromInitParams(params, widget_delegate, | 153 CalculateWindowStylesFromInitParams(params, widget_delegate, |
158 native_widget_delegate, &style, &ex_style, | 154 native_widget_delegate, &style, &ex_style, |
159 &class_style); | 155 &class_style); |
160 handler->set_initial_class_style(class_style); | 156 handler->set_initial_class_style(class_style); |
161 handler->set_window_style(handler->window_style() | style); | 157 handler->set_window_style(handler->window_style() | style); |
162 handler->set_window_ex_style(handler->window_ex_style() | ex_style); | 158 handler->set_window_ex_style(handler->window_ex_style() | ex_style); |
163 } | 159 } |
164 | 160 |
165 } // namespace views | 161 } // namespace views |
OLD | NEW |