Chromium Code Reviews| Index: ui/base/x/x11_util.cc |
| diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc |
| index 82cdab78f54bc87e603501517f112e3db282c54e..374ceaf77681456a0db51bdac7215742c38190ec 100644 |
| --- a/ui/base/x/x11_util.cc |
| +++ b/ui/base/x/x11_util.cc |
| @@ -68,6 +68,14 @@ int DefaultX11IOErrorHandler(Display* d) { |
| _exit(1); |
| } |
| +XErrorHandler current_error_handler = DefaultX11ErrorHandler; |
| +XErrorEvent* last_error_event = NULL; |
| + |
| +int BaseX11ErrorHandler(Display* d, XErrorEvent* e) { |
| + last_error_event = e; |
|
Ami GONE FROM CHROMIUM
2011/09/14 23:23:11
(this is the comment referenced from the .h commen
|
| + return current_error_handler(d, e); |
| +} |
| + |
| // Note: The caller should free the resulting value data. |
| bool GetProperty(XID window, const std::string& property_name, long max_length, |
| Atom* type, int* format, unsigned long* num_items, |
| @@ -679,6 +687,7 @@ bool ChangeWindowDesktop(XID window, XID destination) { |
| } |
| void SetDefaultX11ErrorHandlers() { |
| + XSetErrorHandler(BaseX11ErrorHandler); |
| SetX11ErrorHandlers(NULL, NULL); |
| } |
| @@ -710,6 +719,13 @@ bool IsX11WindowFullScreen(XID window) { |
| monitor_rect.height == window_rect.height(); |
| } |
| +XErrorEvent* GetLastX11Error(Display* display) { |
| + XSync(display, False); |
| + XErrorEvent* e = last_error_event; |
| + last_error_event = NULL; |
| + return e; |
| +} |
| + |
| // ---------------------------------------------------------------------------- |
| // These functions are declared in x11_util_internal.h because they require |
| // XLib.h to be included, and it conflicts with many other headers. |
| @@ -788,9 +804,10 @@ XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual) { |
| void SetX11ErrorHandlers(XErrorHandler error_handler, |
| XIOErrorHandler io_error_handler) { |
| - XSetErrorHandler(error_handler ? error_handler : DefaultX11ErrorHandler); |
| - XSetIOErrorHandler( |
| - io_error_handler ? io_error_handler : DefaultX11IOErrorHandler); |
| + current_error_handler = error_handler ? |
| + error_handler : DefaultX11ErrorHandler; |
| + XSetIOErrorHandler(io_error_handler ? |
| + io_error_handler : DefaultX11IOErrorHandler); |
| } |
| void LogErrorEventDescription(Display* dpy, |