| 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 |
| 168 // interpretation. |out_data| should be freed by XFree() after use. |
| 169 UI_EXPORT bool GetRawBytesOfProperty(XID window, |
| 170 Atom property, |
| 171 unsigned char** out_data, |
| 172 size_t* out_data_bytes, |
| 173 size_t* out_data_items, |
| 174 Atom* out_type); |
| 175 |
| 167 // Get the value of an int, int array, atom array or string property. On | 176 // 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|. | 177 // success, true is returned and the value is stored in |value|. |
| 169 // | 178 // |
| 170 // TODO(erg): Once we remove the gtk port and are 100% aura, all of these | 179 // TODO(erg): Once we remove the gtk port and are 100% aura, all of these |
| 171 // should accept an Atom instead of a string. | 180 // should accept an Atom instead of a string. |
| 172 UI_EXPORT bool GetIntProperty(XID window, const std::string& property_name, | 181 UI_EXPORT bool GetIntProperty(XID window, const std::string& property_name, |
| 173 int* value); | 182 int* value); |
| 183 UI_EXPORT bool GetXIDProperty(XID window, const std::string& property_name, |
| 184 XID* value); |
| 174 UI_EXPORT bool GetIntArrayProperty(XID window, const std::string& property_name, | 185 UI_EXPORT bool GetIntArrayProperty(XID window, const std::string& property_name, |
| 175 std::vector<int>* value); | 186 std::vector<int>* value); |
| 176 UI_EXPORT bool GetAtomArrayProperty(XID window, | 187 UI_EXPORT bool GetAtomArrayProperty(XID window, |
| 177 const std::string& property_name, | 188 const std::string& property_name, |
| 178 std::vector<Atom>* value); | 189 std::vector<Atom>* value); |
| 179 UI_EXPORT bool GetStringProperty( | 190 UI_EXPORT bool GetStringProperty( |
| 180 XID window, const std::string& property_name, std::string* value); | 191 XID window, const std::string& property_name, std::string* value); |
| 181 | 192 |
| 193 // These setters all make round trips. |
| 182 UI_EXPORT bool SetIntProperty(XID window, | 194 UI_EXPORT bool SetIntProperty(XID window, |
| 183 const std::string& name, | 195 const std::string& name, |
| 184 const std::string& type, | 196 const std::string& type, |
| 185 int value); | 197 int value); |
| 186 UI_EXPORT bool SetIntArrayProperty(XID window, | 198 UI_EXPORT bool SetIntArrayProperty(XID window, |
| 187 const std::string& name, | 199 const std::string& name, |
| 188 const std::string& type, | 200 const std::string& type, |
| 189 const std::vector<int>& value); | 201 const std::vector<int>& value); |
| 202 UI_EXPORT bool SetAtomArrayProperty(XID window, |
| 203 const std::string& name, |
| 204 const std::string& type, |
| 205 const std::vector<Atom>& value); |
| 190 | 206 |
| 191 // Gets the X atom for default display corresponding to atom_name. | 207 // Gets the X atom for default display corresponding to atom_name. |
| 192 Atom GetAtom(const char* atom_name); | 208 Atom GetAtom(const char* atom_name); |
| 193 | 209 |
| 194 // Get |window|'s parent window, or None if |window| is the root window. | 210 // Get |window|'s parent window, or None if |window| is the root window. |
| 195 UI_EXPORT XID GetParentWindow(XID window); | 211 UI_EXPORT XID GetParentWindow(XID window); |
| 196 | 212 |
| 197 // Walk up |window|'s hierarchy until we find a direct child of |root|. | 213 // Walk up |window|'s hierarchy until we find a direct child of |root|. |
| 198 XID GetHighestAncestorWindow(XID window, XID root); | 214 XID GetHighestAncestorWindow(XID window, XID root); |
| 199 | 215 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 private: | 385 private: |
| 370 ::Cursor cursor_; | 386 ::Cursor cursor_; |
| 371 Display* display_; | 387 Display* display_; |
| 372 | 388 |
| 373 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); | 389 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
| 374 }; | 390 }; |
| 375 | 391 |
| 376 } // namespace ui | 392 } // namespace ui |
| 377 | 393 |
| 378 #endif // UI_BASE_X_X11_UTIL_H_ | 394 #endif // UI_BASE_X_X11_UTIL_H_ |
| OLD | NEW |