From 6c93e7755a928ed13e03fbaeac6a67f14654609a Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 13 Dec 2011 07:30:01 +0000 Subject: [PATCH] From: Doyoun Kang Subject: [E-devel] [Patch] Add ecore_x API for error handling I added ecore_x_error_resource_id_get() api. It returns the resource id that caused the last X error. I think it will be useful for handling X error. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@66136 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- AUTHORS | 1 + ChangeLog | 4 ++++ src/lib/ecore_x/Ecore_X.h | 2 ++ src/lib/ecore_x/xcb/ecore_xcb_error.c | 14 ++++++++++++++ src/lib/ecore_x/xlib/ecore_x_error.c | 14 ++++++++++++++ 5 files changed, 35 insertions(+) diff --git a/AUTHORS b/AUTHORS index 7677f08..d2b47da 100644 --- a/AUTHORS +++ b/AUTHORS @@ -47,3 +47,4 @@ Rafael Antognolli Kim Yunhan Youness Alaoui Bluezery +Doyoun Kang diff --git a/ChangeLog b/ChangeLog index ac9065f..7cf1d9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -403,3 +403,7 @@ the same as timers and mark them as "just added" to skip in this run of animators +2011-12-13 Doyun Kang + + * Add ability to get resource id of last x error in ecore_x. + diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index ecd19f3..b5d2c3f 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -1181,6 +1181,8 @@ EAPI int ecore_x_error_request_get(void); EAPI int ecore_x_error_code_get(void); +EAPI Ecore_X_ID +ecore_x_error_resource_id_get(void); EAPI void ecore_x_event_mask_set(Ecore_X_Window w, diff --git a/src/lib/ecore_x/xcb/ecore_xcb_error.c b/src/lib/ecore_x/xcb/ecore_xcb_error.c index bbd9c2a..fc32926 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_error.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_error.c @@ -8,6 +8,7 @@ static void (*_io_error_func)(void *data) = NULL; static void *_io_error_data = NULL; static int _error_request_code = 0; static int _error_code = 0; +static Ecore_X_ID _error_resource_id = 0; /** * Set the error handler. @@ -63,6 +64,18 @@ ecore_x_error_code_get(void) return _error_code; } +/** + * Get the resource id that caused the error. + * @return The resource id causing the X error + * + * Return the X resource id that caused the last X error + */ +EAPI Ecore_X_ID +ecore_x_error_resource_id_get(void) +{ + return _error_resource_id; +} + int _ecore_xcb_error_handle(xcb_generic_error_t *err) { @@ -84,6 +97,7 @@ _ecore_xcb_error_handle(xcb_generic_error_t *err) _error_request_code = err->sequence; _error_code = err->error_code; + _error_resource_id = err->resource_id; if (_error_func) _error_func(_error_data); diff --git a/src/lib/ecore_x/xlib/ecore_x_error.c b/src/lib/ecore_x/xlib/ecore_x_error.c index 9f18772..11e9f20 100644 --- a/src/lib/ecore_x/xlib/ecore_x_error.c +++ b/src/lib/ecore_x/xlib/ecore_x_error.c @@ -19,6 +19,7 @@ static void (*_io_error_func)(void *data) = NULL; static void *_io_error_data = NULL; static int _error_request_code = 0; static int _error_code = 0; +static Ecore_X_ID _error_resource_id = 0; /** * Set the error handler. @@ -74,6 +75,18 @@ ecore_x_error_code_get(void) return _error_code; } +/** + * Get the resource id that caused the error. + * @return The resource id causing the X error + * + * Return the X resource id that caused the last X error + */ +EAPI Ecore_X_ID +ecore_x_error_resource_id_get(void) +{ + return _error_resource_id; +} + void _ecore_x_error_handler_init(void) { @@ -89,6 +102,7 @@ _ecore_x_error_handle(Display *d, { _error_request_code = ev->request_code; _error_code = ev->error_code; + _error_resource_id = ev->resourceid; if (_error_func) _error_func(_error_data); } -- 2.7.4