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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
10 | 10 |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 // gdkvisual-x11.cc, they look for this specific visual and use it for | 1450 // gdkvisual-x11.cc, they look for this specific visual and use it for |
1451 // all their alpha channel using needs. | 1451 // all their alpha channel using needs. |
1452 const XVisualInfo& info = pair.second->visual_info; | 1452 const XVisualInfo& info = pair.second->visual_info; |
1453 if (info.depth == 32 && info.visual->red_mask == 0xff0000 && | 1453 if (info.depth == 32 && info.visual->red_mask == 0xff0000 && |
1454 info.visual->green_mask == 0x00ff00 && | 1454 info.visual->green_mask == 0x00ff00 && |
1455 info.visual->blue_mask == 0x0000ff) { | 1455 info.visual->blue_mask == 0x0000ff) { |
1456 transparent_visual_id_ = info.visualid; | 1456 transparent_visual_id_ = info.visualid; |
1457 break; | 1457 break; |
1458 } | 1458 } |
1459 } | 1459 } |
1460 DCHECK(transparent_visual_id_); | 1460 if (transparent_visual_id_) |
1461 DCHECK(visuals_.find(transparent_visual_id_) != visuals_.end()); | 1461 DCHECK(visuals_.find(transparent_visual_id_) != visuals_.end()); |
1462 } | 1462 } |
1463 | 1463 |
1464 XVisualManager::~XVisualManager() {} | 1464 XVisualManager::~XVisualManager() {} |
1465 | 1465 |
1466 void XVisualManager::ChooseVisualForWindow(bool want_argb_visual, | 1466 void XVisualManager::ChooseVisualForWindow(bool want_argb_visual, |
1467 Visual** visual, | 1467 Visual** visual, |
1468 int* depth, | 1468 int* depth, |
1469 Colormap* colormap, | 1469 Colormap* colormap, |
1470 bool* using_argb_visual) { | 1470 bool* using_argb_visual) { |
1471 bool use_argb = want_argb_visual && using_compositing_wm_ && | 1471 bool use_argb = want_argb_visual && using_compositing_wm_ && |
1472 (using_software_rendering_ || have_gpu_argb_visual_); | 1472 (using_software_rendering_ || have_gpu_argb_visual_); |
1473 XVisualData& visual_data = | 1473 XVisualData& visual_data = |
1474 *visuals_[use_argb ? transparent_visual_id_ : system_visual_id_]; | 1474 *visuals_[use_argb && transparent_visual_id_ ? transparent_visual_id_ |
| 1475 : system_visual_id_]; |
1475 if (visual) | 1476 if (visual) |
1476 *visual = visual_data.visual_info.visual; | 1477 *visual = visual_data.visual_info.visual; |
1477 if (depth) | 1478 if (depth) |
1478 *depth = visual_data.visual_info.depth; | 1479 *depth = visual_data.visual_info.depth; |
1479 if (colormap) | 1480 if (colormap) |
1480 *colormap = visual_data.GetColormap(); | 1481 *colormap = visual_data.GetColormap(); |
1481 if (using_argb_visual) | 1482 if (using_argb_visual) |
1482 *using_argb_visual = use_argb; | 1483 *using_argb_visual = use_argb; |
1483 } | 1484 } |
1484 | 1485 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 return colormap_; | 1517 return colormap_; |
1517 } | 1518 } |
1518 | 1519 |
1519 #endif | 1520 #endif |
1520 | 1521 |
1521 // ---------------------------------------------------------------------------- | 1522 // ---------------------------------------------------------------------------- |
1522 // End of x11_util_internal.h | 1523 // End of x11_util_internal.h |
1523 | 1524 |
1524 | 1525 |
1525 } // namespace ui | 1526 } // namespace ui |
OLD | NEW |