]> icculus.org git repositories - mikachu/openbox.git/blob - openbox/xerror.c
fix a memory leak in the mainloop timers correctly
[mikachu/openbox.git] / openbox / xerror.c
1 #include "openbox.h"
2 #include <glib.h>
3 #include <X11/Xlib.h>
4
5 static gboolean xerror_ignore = FALSE;
6 gboolean xerror_occured = FALSE;
7
8 int xerror_handler(Display *d, XErrorEvent *e)
9 {
10     xerror_occured = TRUE;
11 #ifdef DEBUG
12     if (!xerror_ignore) {
13         char errtxt[128];
14           
15         /*if (e->error_code != BadWindow) */
16         {
17             XGetErrorText(d, e->error_code, errtxt, 127);
18             if (e->error_code == BadWindow)
19                 /*g_warning("X Error: %s", errtxt)*/;
20             else
21                 g_error("X Error: %s", errtxt);
22         }
23     }
24 #else
25     (void)d; (void)e;
26 #endif
27     return 0;
28 }
29
30 void xerror_set_ignore(gboolean ignore)
31 {
32     XSync(ob_display, FALSE);
33     xerror_ignore = ignore;
34 }