From 65a47e5685546d2810293f249d2fdd589239926f Mon Sep 17 00:00:00 2001 From: sabetts Date: Fri, 23 Feb 2001 10:12:14 +0000 Subject: * main.c (main): passes return value of find_window_other() to set_active_window(). * list.h (remove_from_window_list): removed prototype (find_window_in_list): new prototype (append_to_list): likewise (insert_into_list): likewise (remove_from_list): likewise * list.c: propogated use of rp_unmapped_window_sentinel and rp_mapped_window_sentinel. (find_window_in_list): new function (find_window): calls find_window_in_list to search mapped and unmapped window lists. (remove_from_window_list): removed function (init_window_list): initialized sentinels (find_window_prev): searches only the mapped window list. (find_window_next): likewise (find_window_other): likewise (append_to_list): new function (insert_into_list): new function (remove_from_list): new function * events.c (unmap_notify): Searches only the mapped window list. moves the window from the unmapped window list to the mapped window list. * data.h: removed rp_window_head and rp_window_tail, updated dependant files. Added rp_mapped_window_sentinel and rp_unmapped_window_sentinel globals. * bar.c (update_window_names): loops only through mapped window list. --- src/manage.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/manage.c') diff --git a/src/manage.c b/src/manage.c index 7d9f552..ebdae08 100644 --- a/src/manage.c +++ b/src/manage.c @@ -196,6 +196,10 @@ manage (rp_window *win, screen_info *s) win->state = STATE_MAPPED; win->number = get_unique_window_number (); + /* Put win in the mapped window list */ + remove_from_list (win); + insert_into_list (win, rp_mapped_window_sentinel); + /* sort_window_list_by_number(); */ PRINT_DEBUG ("window '%s' managed.\n", win->name); @@ -205,13 +209,23 @@ void unmanage (rp_window *w) { return_window_number (w->number); - remove_from_window_list (w); + remove_from_list (w); + XFree (w->hints); + + free (w); #ifdef AUTO_CLOSE - if (!rp_current_window) + if (rp_mapped_window_sentinel->next == rp_mapped_window_sentinel + && rp_mapped_window_sentinel->prev == rp_mapped_window_sentinel) { - /* If rp_current_window is NULL then we have run out of managed - windows, So kill ratpoison. */ + /* If the mapped window list is empty then we have run out of + managed windows, So kill ratpoison. */ + + /* FIXME: The unmapped window list may also have to be checked + in the case that the only mapped window in unmapped and + shortly after another window is mapped most likely by the + same app. */ + send_kill(); } #endif -- cgit v1.2.3