From: Dana Jansens Date: Fri, 22 Aug 2003 15:36:44 +0000 (+0000) Subject: make the raiselower action smarter X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=ca8a3ac7bf7a9396e5cc4cbb4135da170057f252;p=chaz%2Fopenbox make the raiselower action smarter --- diff --git a/openbox/action.c b/openbox/action.c index 4e3b83ba..824fb35c 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -774,12 +774,28 @@ void action_iconify(union ActionData *data) void action_raiselower(union ActionData *data) { - if (data->client.c) { - if (data->client.c->frame->obscured) - stacking_raise(CLIENT_AS_WINDOW(data->client.c)); - else - stacking_lower(CLIENT_AS_WINDOW(data->client.c)); + ObClient *c = data->client.c; + GList *it; + gboolean raise = FALSE; + + if (!c) return; + + for (it = stacking_list; it; it = g_list_next(it)) { + ObClient *cit = it->data; + + if (cit == c) break; + if (client_normal(cit) && cit->layer == c->layer) { + if (RECT_INTERSECTS_RECT(cit->frame->area, c->frame->area)) { + raise = TRUE; + break; + } + } } + + if (raise) + stacking_raise(CLIENT_AS_WINDOW(c)); + else + stacking_lower(CLIENT_AS_WINDOW(c)); } void action_raise(union ActionData *data)