X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fstacking.c;h=696ce354f09d6fec6ba348ee4fc21273d90c13fb;hb=069e9607fa433190307bb8242294a109e88165de;hp=d611246977f40fd837fcb30d4292a64c6b11182b;hpb=cea19c78c1d3bccb356fce21cda4a2fc85afce1b;p=chaz%2Fopenbox diff --git a/openbox/stacking.c b/openbox/stacking.c index d6112469..696ce354 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -243,23 +243,25 @@ void stacking_add_nonintrusive(ObWindow *win) if (!(it_before = g_list_find(stacking_list, parent))) { /* no parent to put above, try find the focused client to go under */ - if ((it_before = g_list_find(stacking_list, focus_client))) - it_before = it_before->next; - else { - /* out of ideas, just add it normally... */ - stacking_add(win); - return; + if (focus_client && focus_client->layer == client->layer) { + if ((it_before = g_list_find(stacking_list, focus_client))) + it_before = it_before->next; } } - stacking_list = g_list_insert_before(stacking_list, it_before, win); - - it_before = g_list_find(stacking_list, win)->prev; - if (!it_before) - wins[0] = focus_backup; - else - wins[0] = window_top(it_before->data); - wins[1] = window_top(win); - - XRestackWindows(ob_display, wins, 2); + if (!it_before) { + /* out of ideas, just add it normally... */ + stacking_add(win); + } else { + stacking_list = g_list_insert_before(stacking_list, it_before,win); + + it_before = g_list_find(stacking_list, win)->prev; + if (!it_before) + wins[0] = focus_backup; + else + wins[0] = window_top(it_before->data); + wins[1] = window_top(win); + + XRestackWindows(ob_display, wins, 2); + } } }