]> Dogcows Code - chaz/openbox/blob - openbox/xerror.c
yay no tabs in the source
[chaz/openbox] / openbox / xerror.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 xerror.c for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #include "openbox.h"
20 #include <glib.h>
21 #include <X11/Xlib.h>
22
23 static gboolean xerror_ignore = FALSE;
24 gboolean xerror_occured = FALSE;
25
26 gint xerror_handler(Display *d, XErrorEvent *e)
27 {
28 xerror_occured = TRUE;
29 #ifdef DEBUG
30 if (!xerror_ignore) {
31 gchar errtxt[128];
32
33 /*if (e->error_code != BadWindow) */
34 {
35 XGetErrorText(d, e->error_code, errtxt, 127);
36 if (e->error_code == BadWindow)
37 /*g_warning("X Error: %s", errtxt)*/;
38 else
39 g_error("X Error: %s", errtxt);
40 }
41 }
42 #else
43 (void)d; (void)e;
44 #endif
45 return 0;
46 }
47
48 void xerror_set_ignore(gboolean ignore)
49 {
50 XSync(ob_display, FALSE);
51 xerror_ignore = ignore;
52 }
This page took 0.037579 seconds and 4 git commands to generate.