aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c')
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c
index 837ff53..11e9f20 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c
@@ -9,7 +9,7 @@
9#include "ecore_x_private.h" 9#include "ecore_x_private.h"
10#include "Ecore_X.h" 10#include "Ecore_X.h"
11 11
12static int _ecore_x_error_handle(Display *d, 12static int _ecore_x_error_handle(Display *d,
13 XErrorEvent *ev); 13 XErrorEvent *ev);
14static int _ecore_x_io_error_handle(Display *d); 14static int _ecore_x_io_error_handle(Display *d);
15 15
@@ -19,6 +19,7 @@ static void (*_io_error_func)(void *data) = NULL;
19static void *_io_error_data = NULL; 19static void *_io_error_data = NULL;
20static int _error_request_code = 0; 20static int _error_request_code = 0;
21static int _error_code = 0; 21static int _error_code = 0;
22static Ecore_X_ID _error_resource_id = 0;
22 23
23/** 24/**
24 * Set the error handler. 25 * Set the error handler.
@@ -28,12 +29,12 @@ static int _error_code = 0;
28 * Set the X error handler function 29 * Set the X error handler function
29 */ 30 */
30EAPI void 31EAPI void
31ecore_x_error_handler_set(void (*func)(void *data), 32ecore_x_error_handler_set(void (*func)(void *data),
32 const void *data) 33 const void *data)
33{ 34{
34 _error_func = func; 35 _error_func = func;
35 _error_data = (void *)data; 36 _error_data = (void *)data;
36} /* ecore_x_error_handler_set */ 37}
37 38
38/** 39/**
39 * Set the I/O error handler. 40 * Set the I/O error handler.
@@ -43,12 +44,12 @@ ecore_x_error_handler_set(void (*func)(void *data),
43 * Set the X I/O error handler function 44 * Set the X I/O error handler function
44 */ 45 */
45EAPI void 46EAPI void
46ecore_x_io_error_handler_set(void (*func)(void *data), 47ecore_x_io_error_handler_set(void (*func)(void *data),
47 const void *data) 48 const void *data)
48{ 49{
49 _io_error_func = func; 50 _io_error_func = func;
50 _io_error_data = (void *)data; 51 _io_error_data = (void *)data;
51} /* ecore_x_io_error_handler_set */ 52}
52 53
53/** 54/**
54 * Get the request code that caused the error. 55 * Get the request code that caused the error.
@@ -60,7 +61,7 @@ EAPI int
60ecore_x_error_request_get(void) 61ecore_x_error_request_get(void)
61{ 62{
62 return _error_request_code; 63 return _error_request_code;
63} /* ecore_x_error_request_get */ 64}
64 65
65/** 66/**
66 * Get the error code from the error. 67 * Get the error code from the error.
@@ -72,28 +73,41 @@ EAPI int
72ecore_x_error_code_get(void) 73ecore_x_error_code_get(void)
73{ 74{
74 return _error_code; 75 return _error_code;
75} /* ecore_x_error_code_get */ 76}
77
78/**
79 * Get the resource id that caused the error.
80 * @return The resource id causing the X error
81 *
82 * Return the X resource id that caused the last X error
83 */
84EAPI Ecore_X_ID
85ecore_x_error_resource_id_get(void)
86{
87 return _error_resource_id;
88}
76 89
77void 90void
78_ecore_x_error_handler_init(void) 91_ecore_x_error_handler_init(void)
79{ 92{
80 XSetErrorHandler((XErrorHandler)_ecore_x_error_handle); 93 XSetErrorHandler((XErrorHandler)_ecore_x_error_handle);
81 XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle); 94 XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle);
82} /* _ecore_x_error_handler_init */ 95}
83 96
84static int 97static int
85_ecore_x_error_handle(Display *d, 98_ecore_x_error_handle(Display *d,
86 XErrorEvent *ev) 99 XErrorEvent *ev)
87{ 100{
88 if (d == _ecore_x_disp) 101 if (d == _ecore_x_disp)
89 { 102 {
90 _error_request_code = ev->request_code; 103 _error_request_code = ev->request_code;
91 _error_code = ev->error_code; 104 _error_code = ev->error_code;
105 _error_resource_id = ev->resourceid;
92 if (_error_func) 106 if (_error_func)
93 _error_func(_error_data); 107 _error_func(_error_data);
94 } 108 }
95 return 0; 109 return 0;
96} /* _ecore_x_error_handle */ 110}
97 111
98static int 112static int
99_ecore_x_io_error_handle(Display *d) 113_ecore_x_io_error_handle(Display *d)
@@ -107,5 +121,5 @@ _ecore_x_io_error_handle(Display *d)
107 } 121 }
108 122
109 return 0; 123 return 0;
110} /* _ecore_x_io_error_handle */ 124}
111 125