| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 UI_BASE_EXPORT bool SetAtomArrayProperty(XID window, | 172 UI_BASE_EXPORT bool SetAtomArrayProperty(XID window, |
| 173 const std::string& name, | 173 const std::string& name, |
| 174 const std::string& type, | 174 const std::string& type, |
| 175 const std::vector<Atom>& value); | 175 const std::vector<Atom>& value); |
| 176 UI_BASE_EXPORT bool SetStringProperty(XID window, | 176 UI_BASE_EXPORT bool SetStringProperty(XID window, |
| 177 Atom property, | 177 Atom property, |
| 178 Atom type, | 178 Atom type, |
| 179 const std::string& value); | 179 const std::string& value); |
| 180 | 180 |
| 181 // Gets the X atom for default display corresponding to atom_name. | 181 // Gets the X atom for default display corresponding to atom_name. |
| 182 Atom GetAtom(const char* atom_name); | 182 UI_BASE_EXPORT Atom GetAtom(const char* atom_name); |
| 183 | 183 |
| 184 // Sets the WM_CLASS attribute for a given X11 window. | 184 // Sets the WM_CLASS attribute for a given X11 window. |
| 185 UI_BASE_EXPORT void SetWindowClassHint(XDisplay* display, | 185 UI_BASE_EXPORT void SetWindowClassHint(XDisplay* display, |
| 186 XID window, | 186 XID window, |
| 187 const std::string& res_name, | 187 const std::string& res_name, |
| 188 const std::string& res_class); | 188 const std::string& res_class); |
| 189 | 189 |
| 190 // Sets the WM_WINDOW_ROLE attribute for a given X11 window. | 190 // Sets the WM_WINDOW_ROLE attribute for a given X11 window. |
| 191 UI_BASE_EXPORT void SetWindowRole(XDisplay* display, | 191 UI_BASE_EXPORT void SetWindowRole(XDisplay* display, |
| 192 XID window, | 192 XID window, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 }; | 255 }; |
| 256 // Attempts to guess the window maager. Returns WM_UNKNOWN if we can't | 256 // Attempts to guess the window maager. Returns WM_UNKNOWN if we can't |
| 257 // determine it for one reason or another. | 257 // determine it for one reason or another. |
| 258 UI_BASE_EXPORT WindowManagerName GuessWindowManager(); | 258 UI_BASE_EXPORT WindowManagerName GuessWindowManager(); |
| 259 | 259 |
| 260 // Enable the default X error handlers. These will log the error and abort | 260 // Enable the default X error handlers. These will log the error and abort |
| 261 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h | 261 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h |
| 262 // to set your own error handlers. | 262 // to set your own error handlers. |
| 263 UI_BASE_EXPORT void SetDefaultX11ErrorHandlers(); | 263 UI_BASE_EXPORT void SetDefaultX11ErrorHandlers(); |
| 264 | 264 |
| 265 // Return true if a given window is in full-screen mode. | 265 // Returns true if a given window is in full-screen mode. |
| 266 UI_BASE_EXPORT bool IsX11WindowFullScreen(XID window); | 266 UI_BASE_EXPORT bool IsX11WindowFullScreen(XID window); |
| 267 | 267 |
| 268 // Returns true if the window manager supports the given hint. |
| 269 UI_BASE_EXPORT bool WmSupportsHint(Atom atom); |
| 270 |
| 268 // Manages a piece of X11 allocated memory as a RefCountedMemory segment. This | 271 // Manages a piece of X11 allocated memory as a RefCountedMemory segment. This |
| 269 // object takes ownership over the passed in memory and will free it with the | 272 // object takes ownership over the passed in memory and will free it with the |
| 270 // X11 allocator when done. | 273 // X11 allocator when done. |
| 271 class UI_BASE_EXPORT XRefcountedMemory : public base::RefCountedMemory { | 274 class UI_BASE_EXPORT XRefcountedMemory : public base::RefCountedMemory { |
| 272 public: | 275 public: |
| 273 XRefcountedMemory(unsigned char* x11_data, size_t length) | 276 XRefcountedMemory(unsigned char* x11_data, size_t length) |
| 274 : x11_data_(length ? x11_data : NULL), length_(length) {} | 277 : x11_data_(length ? x11_data : NULL), length_(length) {} |
| 275 | 278 |
| 276 // Overridden from RefCountedMemory: | 279 // Overridden from RefCountedMemory: |
| 277 virtual const unsigned char* front() const OVERRIDE; | 280 virtual const unsigned char* front() const OVERRIDE; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 UI_BASE_EXPORT void ResetXCursorCache(); | 347 UI_BASE_EXPORT void ResetXCursorCache(); |
| 345 | 348 |
| 346 // Returns the cached XcursorImage for |cursor|. | 349 // Returns the cached XcursorImage for |cursor|. |
| 347 UI_BASE_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); | 350 UI_BASE_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); |
| 348 | 351 |
| 349 } // namespace test | 352 } // namespace test |
| 350 | 353 |
| 351 } // namespace ui | 354 } // namespace ui |
| 352 | 355 |
| 353 #endif // UI_BASE_X_X11_UTIL_H_ | 356 #endif // UI_BASE_X_X11_UTIL_H_ |
| OLD | NEW |