OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 APP_X11_UTIL_INTERNAL_H_ | 5 #ifndef APP_X11_UTIL_INTERNAL_H_ |
6 #define APP_X11_UTIL_INTERNAL_H_ | 6 #define APP_X11_UTIL_INTERNAL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file declares utility functions for X11 (Linux only). | 9 // This file declares utility functions for X11 (Linux only). |
10 // | 10 // |
11 // These functions require the inclusion of the Xlib headers. Since the Xlib | 11 // These functions require the inclusion of the Xlib headers. Since the Xlib |
12 // headers pollute so much of the namespace, this should only be included | 12 // headers pollute so much of the namespace, this should only be included |
13 // when needed. | 13 // when needed. |
14 | 14 |
15 extern "C" { | 15 extern "C" { |
16 #include <X11/Xatom.h> | 16 #include <X11/Xatom.h> |
17 #include <X11/Xlib.h> | 17 #include <X11/Xlib.h> |
18 #include <X11/extensions/XShm.h> | 18 #include <X11/extensions/XShm.h> |
19 #include <X11/extensions/Xrender.h> | 19 #include <X11/extensions/Xrender.h> |
20 } | 20 } |
21 | 21 |
22 namespace x11_util { | 22 namespace x11_util { |
23 // NOTE: these function caches the results and must be called from the UI | 23 // -------------------------------------------------------------------------- |
| 24 // NOTE: these functions cache the results and must be called from the UI |
24 // thread. | 25 // thread. |
25 | |
26 // Get the XRENDER format id for ARGB32 (Skia's format). | 26 // Get the XRENDER format id for ARGB32 (Skia's format). |
27 // | 27 // |
28 // NOTE:Currently this don't support multiple screens/displays. | 28 // NOTE:Currently this don't support multiple screens/displays. |
29 XRenderPictFormat* GetRenderARGB32Format(Display* dpy); | 29 XRenderPictFormat* GetRenderARGB32Format(Display* dpy); |
30 | 30 |
31 // Get the XRENDER format id for the default visual on the first screen. This | 31 // Get the XRENDER format id for the default visual on the first screen. This |
32 // is the format which our GTK window will have. | 32 // is the format which our GTK window will have. |
33 XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual); | 33 XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual); |
| 34 |
| 35 // -------------------------------------------------------------------------- |
| 36 // X11 error handling. |
| 37 // Sets the X Error Handlers. Passing NULL for either will enable the default |
| 38 // error handler, which if called will log the error and abort the process. |
| 39 void SetX11ErrorHandlers(XErrorHandler error_handler, |
| 40 XIOErrorHandler io_error_handler); |
| 41 |
| 42 // Returns a string suitable for logging the error event. |
| 43 std::string GetErrorEventDescription(XErrorEvent* error_event); |
34 }; | 44 }; |
35 | 45 |
36 #endif // APP_X11_UTIL_INTERNAL_H_ | 46 #endif // APP_X11_UTIL_INTERNAL_H_ |
OLD | NEW |