aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c')
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c123
1 files changed, 0 insertions, 123 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c
deleted file mode 100644
index fc32926..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c
+++ /dev/null
@@ -1,123 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <xcb/xcb_event.h>
3
4/* local variables */
5static void (*_error_func)(void *data) = NULL;
6static void *_error_data = NULL;
7static void (*_io_error_func)(void *data) = NULL;
8static void *_io_error_data = NULL;
9static int _error_request_code = 0;
10static int _error_code = 0;
11static Ecore_X_ID _error_resource_id = 0;
12
13/**
14 * Set the error handler.
15 * @param func The error handler function
16 * @param data The data to be passed to the handler function
17 *
18 * Set the X error handler function
19 */
20EAPI void
21ecore_x_error_handler_set(void (*func)(void *data),
22 const void *data)
23{
24 _error_func = func;
25 _error_data = (void *)data;
26}
27
28/**
29 * Set the I/O error handler.
30 * @param func The I/O error handler function
31 * @param data The data to be passed to the handler function
32 *
33 * Set the X I/O error handler function
34 */
35EAPI void
36ecore_x_io_error_handler_set(void (*func)(void *data),
37 const void *data)
38{
39 _io_error_func = func;
40 _io_error_data = (void *)data;
41}
42
43/**
44 * Get the request code that caused the error.
45 * @return The request code causing the X error
46 *
47 * Return the X request code that caused the last X error
48 */
49EAPI int
50ecore_x_error_request_get(void)
51{
52 return _error_request_code;
53}
54
55/**
56 * Get the error code from the error.
57 * @return The error code from the X error
58 *
59 * Return the error code from the last X error
60 */
61EAPI int
62ecore_x_error_code_get(void)
63{
64 return _error_code;
65}
66
67/**
68 * Get the resource id that caused the error.
69 * @return The resource id causing the X error
70 *
71 * Return the X resource id that caused the last X error
72 */
73EAPI Ecore_X_ID
74ecore_x_error_resource_id_get(void)
75{
76 return _error_resource_id;
77}
78
79int
80_ecore_xcb_error_handle(xcb_generic_error_t *err)
81{
82 WRN("Got Error:");
83 WRN("\tEvent: %s", xcb_event_get_request_label(err->major_code));
84 WRN("\tError: %s", xcb_event_get_error_label(err->error_code));
85
86#ifdef OLD_XCB_VERSION
87 if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE)
88 WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
89 else if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW)
90 WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
91#else
92 if (err->error_code == XCB_VALUE)
93 WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
94 else if (err->error_code == XCB_WINDOW)
95 WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
96#endif
97
98 _error_request_code = err->sequence;
99 _error_code = err->error_code;
100 _error_resource_id = err->resource_id;
101 if (_error_func)
102 _error_func(_error_data);
103
104 return 0;
105}
106
107int
108_ecore_xcb_io_error_handle(xcb_generic_error_t *err)
109{
110 CRIT("IO Error:");
111 if (err)
112 {
113 CRIT("\tRequest: %d", err->sequence);
114 CRIT("\tCode: %d", err->error_code);
115 }
116 if (_io_error_func)
117 _io_error_func(_io_error_data);
118 else
119 exit(-1);
120
121 return 0;
122}
123