From f0f8e548df853f21c4ea863ee9b63d42a67a8e4a Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Sat, 3 Oct 2009 20:35:01 +0000 Subject: [PATCH] More max stack love. When destroying a transient refocus parent. --- scrotwm.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scrotwm.c b/scrotwm.c index 1c835f8..2fe06fa 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -1247,7 +1247,7 @@ switchws(struct swm_region *r, union arg *args) { int wsid = args->id; struct swm_region *this_r, *other_r; - struct ws_win *win, *winfocus = NULL; + struct ws_win *win, *winfocus = NULL, *parent = NULL; struct workspace *new_ws, *old_ws; this_r = r; @@ -1298,7 +1298,16 @@ switchws(struct swm_region *r, union arg *args) ignore_enter = 1; stack(); - focus_win(winfocus); + if (winfocus) { + /* make sure we see the parent window */ + if (winfocus->transient) { + parent = find_window(winfocus->transient); + if (parent) + focus_win(parent); + } + + focus_win(winfocus); + } bar_update(); } @@ -1484,7 +1493,7 @@ void cycle_layout(struct swm_region *r, union arg *args) { struct workspace *ws = r->ws; - struct ws_win *winfocus; + struct ws_win *winfocus, *parent = NULL; DNPRINTF(SWM_D_EVENT, "cycle_layout: workspace: %d\n", ws->idx); @@ -1496,6 +1505,12 @@ cycle_layout(struct swm_region *r, union arg *args) ignore_enter = 1; stack(); + /* make sure we see the parent window */ + if (winfocus->transient) { + parent = find_window(winfocus->transient); + if (parent) + focus_win(parent); + } focus_win(winfocus); ignore_enter = 0; } -- 1.7.10.4