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/desktop_aura/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
6 | 6 |
7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1149 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); | 1149 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); |
1150 break; | 1150 break; |
1151 } | 1151 } |
1152 // An in-activatable window should not interact with the system wm. | 1152 // An in-activatable window should not interact with the system wm. |
1153 if (!activatable_) | 1153 if (!activatable_) |
1154 swa.override_redirect = True; | 1154 swa.override_redirect = True; |
1155 | 1155 |
1156 if (swa.override_redirect) | 1156 if (swa.override_redirect) |
1157 attribute_mask |= CWOverrideRedirect; | 1157 attribute_mask |= CWOverrideRedirect; |
1158 | 1158 |
1159 Visual* visual; | 1159 bool enable_transparent_visuals = |
1160 int depth; | 1160 params.type == Widget::InitParams::TYPE_DRAG || |
1161 ui::ChooseVisualForWindow(true, &visual, &depth); | 1161 params.type == Widget::InitParams::TYPE_WINDOW; |
1162 if (depth == 32) { | |
1163 attribute_mask |= CWColormap; | |
1164 swa.colormap = | |
1165 XCreateColormap(xdisplay_, x_root_window_, visual, AllocNone); | |
1166 | 1162 |
1167 // x.org will BadMatch if we don't set a border when the depth isn't the | 1163 Visual* visual = CopyFromParent; |
1168 // same as the parent depth. | 1164 int depth = CopyFromParent; |
1169 attribute_mask |= CWBorderPixel; | 1165 if (enable_transparent_visuals) { |
1170 swa.border_pixel = 0; | 1166 ui::ChooseVisualForWindow(enable_transparent_visuals, &visual, &depth); |
piman
2016/08/24 17:21:49
Ignoring the statics for a second, ChooseVisualFor
| |
1167 if (depth == 32) { | |
1168 attribute_mask |= CWColormap; | |
1169 swa.colormap = | |
1170 XCreateColormap(xdisplay_, x_root_window_, visual, AllocNone); | |
1171 | 1171 |
1172 // A compositing manager is required to support transparency. | 1172 // x.org will BadMatch if we don't set a border when the depth isn't the |
1173 use_argb_visual_ = | 1173 // same as the parent depth. |
1174 XGetSelectionOwner(xdisplay_, atom_cache_.GetAtom("_NET_WM_CM_S0")) != | 1174 attribute_mask |= CWBorderPixel; |
1175 None; | 1175 swa.border_pixel = 0; |
1176 | |
1177 // A compositing manager is required to support transparency. | |
1178 use_argb_visual_ = | |
1179 XGetSelectionOwner(xdisplay_, atom_cache_.GetAtom("_NET_WM_CM_S0")) != | |
1180 None; | |
1181 } | |
1176 } | 1182 } |
1177 | 1183 |
1178 bounds_in_pixels_ = ToPixelRect(params.bounds); | 1184 bounds_in_pixels_ = ToPixelRect(params.bounds); |
1179 bounds_in_pixels_.set_size(AdjustSize(bounds_in_pixels_.size())); | 1185 bounds_in_pixels_.set_size(AdjustSize(bounds_in_pixels_.size())); |
1180 xwindow_ = XCreateWindow(xdisplay_, x_root_window_, bounds_in_pixels_.x(), | 1186 xwindow_ = XCreateWindow(xdisplay_, x_root_window_, bounds_in_pixels_.x(), |
1181 bounds_in_pixels_.y(), bounds_in_pixels_.width(), | 1187 bounds_in_pixels_.y(), bounds_in_pixels_.width(), |
1182 bounds_in_pixels_.height(), | 1188 bounds_in_pixels_.height(), |
1183 0, // border width | 1189 0, // border width |
1184 depth, InputOutput, visual, attribute_mask, &swa); | 1190 depth, InputOutput, visual, attribute_mask, &swa); |
1185 if (ui::PlatformEventSource::GetInstance()) | 1191 if (ui::PlatformEventSource::GetInstance()) |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2094 if (linux_ui) { | 2100 if (linux_ui) { |
2095 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2101 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
2096 if (native_theme) | 2102 if (native_theme) |
2097 return native_theme; | 2103 return native_theme; |
2098 } | 2104 } |
2099 | 2105 |
2100 return ui::NativeThemeAura::instance(); | 2106 return ui::NativeThemeAura::instance(); |
2101 } | 2107 } |
2102 | 2108 |
2103 } // namespace views | 2109 } // namespace views |
OLD | NEW |