From: Doyoun Kang <doyoun.kang@samsung.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 13 Dec 2011 07:30:01 +0000 (07:30 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 13 Dec 2011 07:30:01 +0000 (07:30 +0000)
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
ChangeLog
src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/xcb/ecore_xcb_error.c
src/lib/ecore_x/xlib/ecore_x_error.c

diff --git a/AUTHORS b/AUTHORS
index 7677f08..d2b47da 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -47,3 +47,4 @@ Rafael Antognolli <antognolli@profusion.mobi>
 Kim Yunhan <spbear@gmail.com>
 Youness Alaoui <kakaroto@kakaroto.homelinux.net>
 Bluezery <ohpowel@gmail.com>
+Doyoun Kang <wayofmine@gmail.com> <doyoun.kang@samsung.com>
index ac9065f..7cf1d9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
         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.
+
index ecd19f3..b5d2c3f 100644 (file)
@@ -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,
index bbd9c2a..fc32926 100644 (file)
@@ -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);
 
index 9f18772..11e9f20 100644 (file)
@@ -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);
      }