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

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

Issue 1429083002: gl_surface_egl: ensure off and on screen surfaces use the same EGLConfig (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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_window_tree_host_x11.h ('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 b717445ddfe8b51a8a54ef66bf3fb62aec68a819..f84153df1c743438c95bdf93ae6f7b561f9c20f1 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
@@ -25,6 +25,7 @@
#include "ui/base/hit_test.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/x/x11_util.h"
+#include "ui/base/x/x11_util_internal.h"
#include "ui/events/devices/x11/device_data_manager_x11.h"
#include "ui/events/devices/x11/device_list_cache_x11.h"
#include "ui/events/devices/x11/touch_factory_x11.h"
@@ -1117,30 +1118,20 @@ void DesktopWindowTreeHostX11::InitX11Window(
if (swa.override_redirect)
attribute_mask |= CWOverrideRedirect;
- // Detect whether we're running inside a compositing manager. If so, try to
- // use the ARGB visual. Otherwise, just use our parent's visual.
- Visual* visual = CopyFromParent;
- int depth = CopyFromParent;
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTransparentVisuals) &&
- XGetSelectionOwner(xdisplay_, atom_cache_.GetAtom("_NET_WM_CM_S0")) !=
- None) {
- Visual* rgba_visual = GetARGBVisual();
- if (rgba_visual) {
- visual = rgba_visual;
- depth = 32;
-
- attribute_mask |= CWColormap;
- swa.colormap = XCreateColormap(xdisplay_, x_root_window_, visual,
- AllocNone);
-
- // 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;
-
- use_argb_visual_ = true;
- }
+ Visual* visual;
+ int depth;
+ ui::ChooseVisualForWindow(&visual, &depth);
+ if (depth == 32) {
+ attribute_mask |= CWColormap;
+ swa.colormap =
+ XCreateColormap(xdisplay_, x_root_window_, visual, AllocNone);
+
+ // 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;
+
+ use_argb_visual_ = true;
}
bounds_in_pixels_ = ToPixelRect(params.bounds);
@@ -1619,33 +1610,6 @@ void DesktopWindowTreeHostX11::SerializeImageRepresentation(
data->push_back(bitmap.getColor(x, y));
}
-Visual* DesktopWindowTreeHostX11::GetARGBVisual() {
- XVisualInfo visual_template;
- visual_template.screen = 0;
-
- int visuals_len;
- gfx::XScopedPtr<XVisualInfo[]> visual_list(XGetVisualInfo(
- xdisplay_, VisualScreenMask, &visual_template, &visuals_len));
- for (int i = 0; i < visuals_len; ++i) {
- // Why support only 8888 ARGB? Because it's all that GTK+ supports. In
- // gdkvisual-x11.cc, they look for this specific visual and use it for all
- // their alpha channel using needs.
- //
- // TODO(erg): While the following does find a valid visual, some GL drivers
- // don't believe that this has an alpha channel. According to marcheu@,
- // this should work on open source driver though. (It doesn't work with
- // NVidia's binaries currently.) http://crbug.com/369209
- const XVisualInfo& info = visual_list[i];
- if (info.depth == 32 && info.visual->red_mask == 0xff0000 &&
- info.visual->green_mask == 0x00ff00 &&
- info.visual->blue_mask == 0x0000ff) {
- return info.visual;
- }
- }
-
- return nullptr;
-}
-
std::list<XID>& DesktopWindowTreeHostX11::open_windows() {
if (!open_windows_)
open_windows_ = new std::list<XID>();
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698