summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2000-08-30 05:14:52 +0000
committersabetts <sabetts>2000-08-30 05:14:52 +0000
commita334f42803a72d2bcc2f64b7f734df8b5ece165e (patch)
treef44e516343e19a44734c048101443080371c7f7d
parent6cd6ecb80db16d4d44b92635dde4efa984f18b3d (diff)
downloadratpoison-a334f42803a72d2bcc2f64b7f734df8b5ece165e.zip
fixed a bug in destroy_window() where last_window wasn't being called
if the only destroy event was on a mapped window.
-rw-r--r--events.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/events.c b/events.c
index f60434a..6848782 100644
--- a/events.c
+++ b/events.c
@@ -131,12 +131,23 @@ more_destroy_events ()
void
destroy_window (XDestroyWindowEvent *ev)
{
- screen_info *s;
+ /* if there are multiple destroy events queued, and a mapped window
+ is deleted then switch_window_pending is set to 1 and the window
+ switch is done after all destroy events have been done. */
+ static int switch_window_pending = 0;
+ int last_destroy_event;
rp_window *win;
- s = find_screen (ev->event);
win = find_window (ev->window);
- if (s && win)
+
+ last_destroy_event = !more_destroy_events();
+ if (last_destroy_event && (switch_window_pending || win))
+ {
+ last_window ();
+ switch_window_pending = 0;
+ }
+
+ if (win)
{
/* Goto the last accessed window. */
if (win == rp_current_window)
@@ -147,7 +158,7 @@ destroy_window (XDestroyWindowEvent *ev)
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 ();
+ if (!last_destroy_event) switch_window_pending = 1;
unmanage (win);
}
else