mirror of
https://github.com/vale981/spectrwm
synced 2025-03-05 09:51:38 -05:00
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:
parent
a7d3c9fae6
commit
9603301049
1 changed files with 14 additions and 12 deletions
26
scrotwm.c
26
scrotwm.c
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue