Oops do some focus magic just as before. Note this is still hosed due to

enternotify but that is an older issue.
This commit is contained in:
Marco Peereboom 2009-02-03 00:54:35 +00:00
parent a7d3c9fae6
commit 9603301049

View file

@ -2128,11 +2128,25 @@ manage_window(Window id)
void
unmanage_window(struct ws_win *win)
{
struct workspace *ws;
if (win == NULL)
return;
DNPRINTF(SWM_D_MISC, "unmanage_window: %lu\n", win->id);
ws = win->ws;
/* find a window to focus */
if (ws->focus == win)
ws->focus = TAILQ_PREV(win, ws_win_list, entry);
if (ws->focus == NULL)
ws->focus = TAILQ_FIRST(&ws->winlist);
if (ws->focus == NULL || ws->focus == win) {
ws->focus = NULL;
unfocus_all();
} else
focus_win(ws->focus);
TAILQ_REMOVE(&win->ws->winlist, win, entry);
set_win_state(win, WithdrawnState);
if (win->ch.res_class)
@ -2213,22 +2227,10 @@ destroynotify(XEvent *e)
{
struct ws_win *win;
XDestroyWindowEvent *ev = &e->xdestroywindow;
struct workspace *ws;
DNPRINTF(SWM_D_EVENT, "destroynotify: window %lu\n", ev->window);
if ((win = find_window(ev->window)) != NULL) {
ws = win->ws;
/* find a window to focus */
if (ws->focus == win)
ws->focus = TAILQ_PREV(win, ws_win_list, entry);
if (ws->focus == NULL)
ws->focus = TAILQ_FIRST(&ws->winlist);
if (ws->focus == NULL || ws->focus == win) {
ws->focus = NULL;
unfocus_all();
} else
focus_win(ws->focus);
unmanage_window(win);
stack();
}