Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 2347383002: X11: Use better visuals for OpenGL (Closed)
Patch Set: auto* Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 38a416bb19ca7db7b8690c143237c1cf8435b6c9..ded7f22d3b2b92119e91294ede6fc467c74269e1 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1359,28 +1359,33 @@ void DesktopWindowTreeHostX11::InitX11Window(
if (swa.override_redirect)
attribute_mask |= CWOverrideRedirect;
- const bool enable_transparent_visuals =
- params.type == Widget::InitParams::TYPE_DRAG ||
- params.type == Widget::InitParams::TYPE_WINDOW;
+ bool enable_transparent_visuals;
+ switch (params.opacity) {
+ case Widget::InitParams::OPAQUE_WINDOW:
+ enable_transparent_visuals = false;
+ break;
+ case Widget::InitParams::TRANSLUCENT_WINDOW:
+ enable_transparent_visuals = true;
+ break;
+ case Widget::InitParams::INFER_OPACITY:
+ default:
+ enable_transparent_visuals = params.type == Widget::InitParams::TYPE_DRAG;
+ }
Visual* visual = CopyFromParent;
int depth = CopyFromParent;
- ui::ChooseVisualForWindow(enable_transparent_visuals, &visual, &depth);
- if (enable_transparent_visuals && depth == 32) {
- attribute_mask |= CWColormap;
- swa.colormap =
- XCreateColormap(xdisplay_, x_root_window_, visual, AllocNone);
+ Colormap colormap = CopyFromParent;
+ ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
+ enable_transparent_visuals, &visual, &depth, &colormap,
+ &use_argb_visual_);
- // x.org will BadMatch if we don't set a border when the depth isn't the
- // same as the parent depth.
- attribute_mask |= CWBorderPixel;
- swa.border_pixel = 0;
+ attribute_mask |= CWColormap;
+ swa.colormap = colormap;
- // A compositing manager is required to support transparency.
- use_argb_visual_ =
- XGetSelectionOwner(xdisplay_, atom_cache_.GetAtom("_NET_WM_CM_S0")) !=
- None;
- }
+ // x.org will BadMatch if we don't set a border when the depth isn't the
+ // same as the parent depth.
+ attribute_mask |= CWBorderPixel;
+ swa.border_pixel = 0;
bounds_in_pixels_ = ToPixelRect(params.bounds);
bounds_in_pixels_.set_size(AdjustSize(bounds_in_pixels_.size()));
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698