| 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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 while (true) { | 1004 while (true) { |
| 1005 XID parent = GetParentWindow(window); | 1005 XID parent = GetParentWindow(window); |
| 1006 if (parent == None) | 1006 if (parent == None) |
| 1007 return None; | 1007 return None; |
| 1008 if (parent == root) | 1008 if (parent == root) |
| 1009 return window; | 1009 return window; |
| 1010 window = parent; | 1010 window = parent; |
| 1011 } | 1011 } |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 bool GetCustomFramePrefDefault() { |
| 1015 // Ideally, we'd use the custom frame by default and just fall back on using |
| 1016 // system decorations for the few (?) tiling window managers where the custom |
| 1017 // frame doesn't make sense (e.g. awesome, ion3, ratpoison, xmonad, etc.) or |
| 1018 // other WMs where it has issues (e.g. Fluxbox -- see issue 19130). The EWMH |
| 1019 // _NET_SUPPORTING_WM property makes it easy to look up a name for the current |
| 1020 // WM, but at least some of the WMs in the latter group don't set it. |
| 1021 // Instead, we default to using system decorations for all WMs and |
| 1022 // special-case the ones where the custom frame should be used. |
| 1023 ui::WindowManagerName wm_type = GuessWindowManager(); |
| 1024 return (wm_type == WM_BLACKBOX || |
| 1025 wm_type == WM_COMPIZ || |
| 1026 wm_type == WM_ENLIGHTENMENT || |
| 1027 wm_type == WM_METACITY || |
| 1028 wm_type == WM_MUFFIN || |
| 1029 wm_type == WM_MUTTER || |
| 1030 wm_type == WM_OPENBOX || |
| 1031 wm_type == WM_XFWM4); |
| 1032 } |
| 1033 |
| 1014 bool GetWindowDesktop(XID window, int* desktop) { | 1034 bool GetWindowDesktop(XID window, int* desktop) { |
| 1015 return GetIntProperty(window, "_NET_WM_DESKTOP", desktop); | 1035 return GetIntProperty(window, "_NET_WM_DESKTOP", desktop); |
| 1016 } | 1036 } |
| 1017 | 1037 |
| 1018 std::string GetX11ErrorString(XDisplay* display, int err) { | 1038 std::string GetX11ErrorString(XDisplay* display, int err) { |
| 1019 char buffer[256]; | 1039 char buffer[256]; |
| 1020 XGetErrorText(display, err, buffer, arraysize(buffer)); | 1040 XGetErrorText(display, err, buffer, arraysize(buffer)); |
| 1021 return buffer; | 1041 return buffer; |
| 1022 } | 1042 } |
| 1023 | 1043 |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1579 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
| 1560 << "minor_code " << static_cast<int>(error_event.minor_code) | 1580 << "minor_code " << static_cast<int>(error_event.minor_code) |
| 1561 << " (" << request_str << ")"; | 1581 << " (" << request_str << ")"; |
| 1562 } | 1582 } |
| 1563 | 1583 |
| 1564 // ---------------------------------------------------------------------------- | 1584 // ---------------------------------------------------------------------------- |
| 1565 // End of x11_util_internal.h | 1585 // End of x11_util_internal.h |
| 1566 | 1586 |
| 1567 | 1587 |
| 1568 } // namespace ui | 1588 } // namespace ui |
| OLD | NEW |