From: Doyoun Kang <doyoun.kang@samsung.com>

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.



SVN revision: 66136
This commit is contained in:
Doyoun Kang 2011-12-13 07:30:01 +00:00 committed by Carsten Haitzler
parent 0434ce6574
commit 7974ea4cbf
5 changed files with 35 additions and 0 deletions

View File

@ -47,3 +47,4 @@ Rafael Antognolli <antognolli@profusion.mobi>
Kim Yunhan <spbear@gmail.com> Kim Yunhan <spbear@gmail.com>
Youness Alaoui <kakaroto@kakaroto.homelinux.net> Youness Alaoui <kakaroto@kakaroto.homelinux.net>
Bluezery <ohpowel@gmail.com> Bluezery <ohpowel@gmail.com>
Doyoun Kang <wayofmine@gmail.com> <doyoun.kang@samsung.com>

View File

@ -403,3 +403,7 @@
the same as timers and mark them as "just added" to skip in the same as timers and mark them as "just added" to skip in
this run of animators this run of animators
2011-12-13 Doyun Kang
* Add ability to get resource id of last x error in ecore_x.

View File

@ -1181,6 +1181,8 @@ EAPI int
ecore_x_error_request_get(void); ecore_x_error_request_get(void);
EAPI int EAPI int
ecore_x_error_code_get(void); ecore_x_error_code_get(void);
EAPI Ecore_X_ID
ecore_x_error_resource_id_get(void);
EAPI void EAPI void
ecore_x_event_mask_set(Ecore_X_Window w, ecore_x_event_mask_set(Ecore_X_Window w,

View File

@ -8,6 +8,7 @@ static void (*_io_error_func)(void *data) = NULL;
static void *_io_error_data = NULL; static void *_io_error_data = NULL;
static int _error_request_code = 0; static int _error_request_code = 0;
static int _error_code = 0; static int _error_code = 0;
static Ecore_X_ID _error_resource_id = 0;
/** /**
* Set the error handler. * Set the error handler.
@ -63,6 +64,18 @@ ecore_x_error_code_get(void)
return _error_code; 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 int
_ecore_xcb_error_handle(xcb_generic_error_t *err) _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_request_code = err->sequence;
_error_code = err->error_code; _error_code = err->error_code;
_error_resource_id = err->resource_id;
if (_error_func) if (_error_func)
_error_func(_error_data); _error_func(_error_data);

View File

@ -19,6 +19,7 @@ static void (*_io_error_func)(void *data) = NULL;
static void *_io_error_data = NULL; static void *_io_error_data = NULL;
static int _error_request_code = 0; static int _error_request_code = 0;
static int _error_code = 0; static int _error_code = 0;
static Ecore_X_ID _error_resource_id = 0;
/** /**
* Set the error handler. * Set the error handler.
@ -74,6 +75,18 @@ ecore_x_error_code_get(void)
return _error_code; 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 void
_ecore_x_error_handler_init(void) _ecore_x_error_handler_init(void)
{ {
@ -89,6 +102,7 @@ _ecore_x_error_handle(Display *d,
{ {
_error_request_code = ev->request_code; _error_request_code = ev->request_code;
_error_code = ev->error_code; _error_code = ev->error_code;
_error_resource_id = ev->resourceid;
if (_error_func) if (_error_func)
_error_func(_error_data); _error_func(_error_data);
} }