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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 } else { | 1481 } else { |
1482 *flag = false; | 1482 *flag = false; |
1483 } | 1483 } |
1484 return true; | 1484 return true; |
1485 } | 1485 } |
1486 } | 1486 } |
1487 | 1487 |
1488 return false; | 1488 return false; |
1489 } | 1489 } |
1490 | 1490 |
1491 std::vector<std::string> GetOutputNames(const std::vector<XID>& output_ids) { | |
1492 std::vector<std::string> names; | |
1493 Display* display = GetXDisplay(); | |
1494 Window root_window = DefaultRootWindow(display); | |
1495 XRRScreenResources* screen_resources = | |
1496 XRRGetScreenResources(display, root_window); | |
1497 for (std::vector<XID>::const_iterator iter = output_ids.begin(); | |
1498 iter != output_ids.end(); ++iter) { | |
1499 XRROutputInfo* output = | |
1500 XRRGetOutputInfo(display, screen_resources, *iter); | |
1501 names.push_back(std::string(output->name)); | |
1502 XRRFreeOutputInfo(output); | |
1503 } | |
1504 XRRFreeScreenResources(screen_resources); | |
1505 return names; | |
1506 } | |
1507 | |
1508 bool GetWindowManagerName(std::string* wm_name) { | 1491 bool GetWindowManagerName(std::string* wm_name) { |
1509 DCHECK(wm_name); | 1492 DCHECK(wm_name); |
1510 int wm_window = 0; | 1493 int wm_window = 0; |
1511 if (!GetIntProperty(GetX11RootWindow(), | 1494 if (!GetIntProperty(GetX11RootWindow(), |
1512 "_NET_SUPPORTING_WM_CHECK", | 1495 "_NET_SUPPORTING_WM_CHECK", |
1513 &wm_window)) { | 1496 &wm_window)) { |
1514 return false; | 1497 return false; |
1515 } | 1498 } |
1516 | 1499 |
1517 // It's possible that a window manager started earlier in this X session left | 1500 // It's possible that a window manager started earlier in this X session left |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1810 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1828 << "minor_code " << static_cast<int>(error_event.minor_code) | 1811 << "minor_code " << static_cast<int>(error_event.minor_code) |
1829 << " (" << request_str << ")"; | 1812 << " (" << request_str << ")"; |
1830 } | 1813 } |
1831 | 1814 |
1832 // ---------------------------------------------------------------------------- | 1815 // ---------------------------------------------------------------------------- |
1833 // End of x11_util_internal.h | 1816 // End of x11_util_internal.h |
1834 | 1817 |
1835 | 1818 |
1836 } // namespace ui | 1819 } // namespace ui |
OLD | NEW |