| 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 window, | 879 window, |
| 880 name_atom, | 880 name_atom, |
| 881 type_atom, | 881 type_atom, |
| 882 32, // size in bits of items in 'value' | 882 32, // size in bits of items in 'value' |
| 883 PropModeReplace, | 883 PropModeReplace, |
| 884 reinterpret_cast<const unsigned char*>(data.get()), | 884 reinterpret_cast<const unsigned char*>(data.get()), |
| 885 value.size()); // num items | 885 value.size()); // num items |
| 886 return !err_tracker.FoundNewError(); | 886 return !err_tracker.FoundNewError(); |
| 887 } | 887 } |
| 888 | 888 |
| 889 bool SetAtomProperty(XID window, |
| 890 const std::string& name, |
| 891 const std::string& type, |
| 892 Atom value) { |
| 893 std::vector<Atom> values(1, value); |
| 894 return SetAtomArrayProperty(window, name, type, values); |
| 895 } |
| 896 |
| 889 bool SetAtomArrayProperty(XID window, | 897 bool SetAtomArrayProperty(XID window, |
| 890 const std::string& name, | 898 const std::string& name, |
| 891 const std::string& type, | 899 const std::string& type, |
| 892 const std::vector<Atom>& value) { | 900 const std::vector<Atom>& value) { |
| 893 DCHECK(!value.empty()); | 901 DCHECK(!value.empty()); |
| 894 Atom name_atom = GetAtom(name.c_str()); | 902 Atom name_atom = GetAtom(name.c_str()); |
| 895 Atom type_atom = GetAtom(type.c_str()); | 903 Atom type_atom = GetAtom(type.c_str()); |
| 896 | 904 |
| 897 // XChangeProperty() expects values of type 32 to be longs. | 905 // XChangeProperty() expects values of type 32 to be longs. |
| 898 scoped_ptr<Atom[]> data(new Atom[value.size()]); | 906 scoped_ptr<Atom[]> data(new Atom[value.size()]); |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1417 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
| 1410 << "minor_code " << static_cast<int>(error_event.minor_code) | 1418 << "minor_code " << static_cast<int>(error_event.minor_code) |
| 1411 << " (" << request_str << ")"; | 1419 << " (" << request_str << ")"; |
| 1412 } | 1420 } |
| 1413 | 1421 |
| 1414 // ---------------------------------------------------------------------------- | 1422 // ---------------------------------------------------------------------------- |
| 1415 // End of x11_util_internal.h | 1423 // End of x11_util_internal.h |
| 1416 | 1424 |
| 1417 | 1425 |
| 1418 } // namespace ui | 1426 } // namespace ui |
| OLD | NEW |