summaryrefslogtreecommitdiff
path: root/events.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2000-08-30 03:15:20 +0000
committersabetts <sabetts>2000-08-30 03:15:20 +0000
commitd64a253f86bf0f298ee8f362e2e0656177264e0c (patch)
tree8e0c2ece6d1df70dfbe0f4990f0e78c9f9ab92a3 /events.c
parentd50d5f9ecb4f0edf8d92b6b6150a9d5dd58d3ac8 (diff)
downloadratpoison-d64a253f86bf0f298ee8f362e2e0656177264e0c.zip
hopefully put an end to BadWindow crashes by waiting until the last
DestroyNotify event before switching to the last window in destroy_window().
Diffstat (limited to 'events.c')
-rw-r--r--events.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/events.c b/events.c
index 5ca04a3..f60434a 100644
--- a/events.c
+++ b/events.c
@@ -115,6 +115,19 @@ map_request (XEvent *ev)
}
}
+int
+more_destroy_events ()
+{
+ XEvent ev;
+
+ if (XCheckTypedEvent (dpy, DestroyNotify, &ev))
+ {
+ XPutBackEvent (dpy, &ev);
+ return 1;
+ }
+ return 0;
+}
+
void
destroy_window (XDestroyWindowEvent *ev)
{
@@ -128,18 +141,21 @@ destroy_window (XDestroyWindowEvent *ev)
/* Goto the last accessed window. */
if (win == rp_current_window)
{
- last_window ();
+ printf ("Destroying current window.\n");
+
+ /* If there are more DestroyNotify events, then it is unsafe
+ to go to the last window since it could be
+ deleted. Therefore, wait until the last DestroyNotify
+ event and then switch windows. */
+ if (!more_destroy_events ()) last_window ();
unmanage (win);
}
else
{
+ printf ("Destroying some other window.\n");
unmanage (win);
}
}
-
-#ifdef DEBUG
- printf ("Remove window event.\n");
-#endif
}
void