X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=71451089735c23e87c1cb992f5e04a4b5ae9b20b;hb=8e288840b3294c3d4f46a7205b8f3c8df3607e21;hp=0558a4cd94985f4060ac2c5c00073cea05d185e6;hpb=838dae60f10a285d103e3ad26ef9fccaeadae159;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 0558a4c..7145108 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -52,7 +52,7 @@ static const char *cvstag = "$scrotwm$"; -#define SWM_VERSION "0.9.25" +#define SWM_VERSION "0.9.26" #include #include @@ -1109,9 +1109,8 @@ unmap_window(struct ws_win *win) set_win_state(win, IconicState); XUnmapWindow(display, win->id); - if (win->ws->r) - XSetWindowBorder(display, win->id, - win->ws->r->s->c[SWM_S_COLOR_UNFOCUS].color); + XSetWindowBorder(display, win->id, + win->s->c[SWM_S_COLOR_UNFOCUS].color); } void @@ -1392,7 +1391,7 @@ unfocus_win(struct ws_win *win) return; if (validate_ws(win->ws)) - abort(); + abort(); /* XXX replace with return at some point */ if (win->ws->r == NULL) return; @@ -1457,7 +1456,8 @@ focus_win(struct ws_win *win) return; if (validate_ws(win->ws)) - abort(); + abort(); /* XXX replace with return at some point */ + if (validate_win(win)) { kill_refs(win); return; @@ -1743,10 +1743,10 @@ focus_prev(struct ws_win *win) /* if in max_stack try harder */ if (ws->cur_layout->flags & SWM_L_FOCUSPREV) { - if (cur_focus != ws->focus_prev) - winfocus = ws->focus_prev; - else if (cur_focus != ws->focus) - winfocus = ws->focus; + if (cur_focus != ws->focus_prev) + winfocus = ws->focus_prev; + else if (cur_focus != ws->focus) + winfocus = ws->focus; else winfocus = TAILQ_PREV(win, ws_win_list, entry); if (winfocus) @@ -1800,7 +1800,7 @@ focus(struct swm_region *r, union arg *args) winlostfocus = cur_focus; switch (args->id) { - case SWM_ARG_ID_FOCUSPREV: + case SWM_ARG_ID_FOCUSPREV: winfocus = TAILQ_PREV(cur_focus, ws_win_list, entry); if (winfocus == NULL) winfocus = TAILQ_LAST(wl, ws_win_list); @@ -4071,9 +4071,17 @@ focus_magic(struct ws_win *win, int do_trans) if (win->child_trans->take_focus) client_msg(win, takefocus); } else { - focus_win(win->child_trans); - if (win->child_trans->take_focus) - client_msg(win->child_trans, takefocus); + /* make sure transient hasn't dissapeared */ + if (validate_win(win->child_trans) == 0) { + focus_win(win->child_trans); + if (win->child_trans->take_focus) + client_msg(win->child_trans, takefocus); + } else { + win->child_trans = NULL; + focus_win(win); + if (win->take_focus) + client_msg(win, takefocus); + } } } else { /* regular focus */