Chromium Code Reviews| 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 #ifndef UI_BASE_X_X11_UTIL_H_ | 5 #ifndef UI_BASE_X_X11_UTIL_H_ |
| 6 #define UI_BASE_X_X11_UTIL_H_ | 6 #define UI_BASE_X_X11_UTIL_H_ |
| 7 | 7 |
| 8 // This file declares utility functions for X11 (Linux only). | 8 // This file declares utility functions for X11 (Linux only). |
| 9 // | 9 // |
| 10 // These functions do not require the Xlib headers to be included (which is why | 10 // These functions do not require the Xlib headers to be included (which is why |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 | 157 |
| 158 // Returns the bounds of |window|. | 158 // Returns the bounds of |window|. |
| 159 UI_EXPORT bool GetWindowRect(XID window, gfx::Rect* rect); | 159 UI_EXPORT bool GetWindowRect(XID window, gfx::Rect* rect); |
| 160 | 160 |
| 161 // Returns true if |window| contains the point |screen_loc|. | 161 // Returns true if |window| contains the point |screen_loc|. |
| 162 UI_EXPORT bool WindowContainsPoint(XID window, gfx::Point screen_loc); | 162 UI_EXPORT bool WindowContainsPoint(XID window, gfx::Point screen_loc); |
| 163 | 163 |
| 164 // Return true if |window| has any property with |property_name|. | 164 // Return true if |window| has any property with |property_name|. |
| 165 UI_EXPORT bool PropertyExists(XID window, const std::string& property_name); | 165 UI_EXPORT bool PropertyExists(XID window, const std::string& property_name); |
| 166 | 166 |
| 167 // Returns the raw bytes from a property with minimal interpretation. | |
|
Daniel Erat
2013/06/17 22:09:57
document ownership of the memory pointed at by |ou
| |
| 168 UI_EXPORT bool GetRawBytesOfProperty(XID window, | |
| 169 Atom property, | |
| 170 unsigned char** out_data, | |
| 171 size_t* out_data_bytes, | |
| 172 size_t* out_data_items, | |
| 173 Atom* out_type); | |
| 174 | |
| 167 // Get the value of an int, int array, atom array or string property. On | 175 // Get the value of an int, int array, atom array or string property. On |
| 168 // success, true is returned and the value is stored in |value|. | 176 // success, true is returned and the value is stored in |value|. |
| 169 // | 177 // |
| 170 // TODO(erg): Once we remove the gtk port and are 100% aura, all of these | 178 // TODO(erg): Once we remove the gtk port and are 100% aura, all of these |
| 171 // should accept an Atom instead of a string. | 179 // should accept an Atom instead of a string. |
| 172 UI_EXPORT bool GetIntProperty(XID window, const std::string& property_name, | 180 UI_EXPORT bool GetIntProperty(XID window, const std::string& property_name, |
| 173 int* value); | 181 int* value); |
| 182 UI_EXPORT bool GetXIDProperty(XID window, const std::string& property_name, | |
| 183 XID* value); | |
| 174 UI_EXPORT bool GetIntArrayProperty(XID window, const std::string& property_name, | 184 UI_EXPORT bool GetIntArrayProperty(XID window, const std::string& property_name, |
| 175 std::vector<int>* value); | 185 std::vector<int>* value); |
| 176 UI_EXPORT bool GetAtomArrayProperty(XID window, | 186 UI_EXPORT bool GetAtomArrayProperty(XID window, |
| 177 const std::string& property_name, | 187 const std::string& property_name, |
| 178 std::vector<Atom>* value); | 188 std::vector<Atom>* value); |
| 179 UI_EXPORT bool GetStringProperty( | 189 UI_EXPORT bool GetStringProperty( |
| 180 XID window, const std::string& property_name, std::string* value); | 190 XID window, const std::string& property_name, std::string* value); |
| 181 | 191 |
| 182 UI_EXPORT bool SetIntProperty(XID window, | 192 UI_EXPORT bool SetIntProperty(XID window, |
| 183 const std::string& name, | 193 const std::string& name, |
| 184 const std::string& type, | 194 const std::string& type, |
| 185 int value); | 195 int value); |
| 186 UI_EXPORT bool SetIntArrayProperty(XID window, | 196 UI_EXPORT bool SetIntArrayProperty(XID window, |
| 187 const std::string& name, | 197 const std::string& name, |
| 188 const std::string& type, | 198 const std::string& type, |
| 189 const std::vector<int>& value); | 199 const std::vector<int>& value); |
| 200 UI_EXPORT bool SetAtomArrayProperty(XID window, | |
| 201 const std::string& name, | |
| 202 const std::string& type, | |
| 203 const std::vector<Atom>& value); | |
| 190 | 204 |
| 191 // Gets the X atom for default display corresponding to atom_name. | 205 // Gets the X atom for default display corresponding to atom_name. |
| 192 Atom GetAtom(const char* atom_name); | 206 Atom GetAtom(const char* atom_name); |
| 193 | 207 |
| 194 // Get |window|'s parent window, or None if |window| is the root window. | 208 // Get |window|'s parent window, or None if |window| is the root window. |
| 195 UI_EXPORT XID GetParentWindow(XID window); | 209 UI_EXPORT XID GetParentWindow(XID window); |
| 196 | 210 |
| 197 // Walk up |window|'s hierarchy until we find a direct child of |root|. | 211 // Walk up |window|'s hierarchy until we find a direct child of |root|. |
| 198 XID GetHighestAncestorWindow(XID window, XID root); | 212 XID GetHighestAncestorWindow(XID window, XID root); |
| 199 | 213 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 private: | 383 private: |
| 370 ::Cursor cursor_; | 384 ::Cursor cursor_; |
| 371 Display* display_; | 385 Display* display_; |
| 372 | 386 |
| 373 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); | 387 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
| 374 }; | 388 }; |
| 375 | 389 |
| 376 } // namespace ui | 390 } // namespace ui |
| 377 | 391 |
| 378 #endif // UI_BASE_X_X11_UTIL_H_ | 392 #endif // UI_BASE_X_X11_UTIL_H_ |
| OLD | NEW |