diff
wm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/wm.c b/wm.c
index f7a3f2b..e219d03 100644
--- a/wm.c
+++ b/wm.c
@@ -14,6 +14,17 @@ static Window windows[max_windows];
static int window_workspace[max_windows], window_count, current_workspace;
static int is_root_child(Display *display, Window root_window, Window window);
+static int
+x_error_handler(Display *display, XErrorEvent *error)
+{
+ (void)display;
+ if (error->error_code == BadWindow ||
+ error->error_code == BadDrawable ||
+ error->error_code == BadMatch)
+ return 0;
+ return 0;
+}
+
static int
get_window_index(Window window)
{
@@ -151,6 +162,7 @@ main(void)
drag_window = None;
if ((display = XOpenDisplay(NULL)) == NULL)
return 1;
+ XSetErrorHandler(x_error_handler);
root_window = DefaultRootWindow(display);
control_atom = XInternAtom(display, "_WM_CTL", False);