X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fstacking.c;h=075f13868b5e303cf10e231a1eacc6572eaf7ce6;hb=205d7ff4697c7941256e4ae71db8ea41e94494f3;hp=e323b569fd670e0d0098b0fe6813e59426847abe;hpb=47529e777f5d0ac222b6ed06c9644c3909bd6479;p=chaz%2Fopenbox diff --git a/openbox/stacking.c b/openbox/stacking.c index e323b569..075f1386 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -483,7 +483,10 @@ static gboolean stacking_occluded(ObClient *client, ObClient *sibling) it = (found ? g_list_previous(it) :g_list_next(it))) if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - if (found) { + if (found && !c->iconic && + (c->desktop == DESKTOP_ALL || client->desktop == DESKTOP_ALL || + c->desktop == client->desktop)) + { if (RECT_INTERSECTS_RECT(c->frame->area, client->frame->area)) { if (sibling != NULL) { @@ -522,7 +525,10 @@ static gboolean stacking_occludes(ObClient *client, ObClient *sibling) for (it = stacking_list; it; it = g_list_next(it)) if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - if (found) { + if (found && !c->iconic && + (c->desktop == DESKTOP_ALL || client->desktop == DESKTOP_ALL || + c->desktop == client->desktop)) + { if (RECT_INTERSECTS_RECT(c->frame->area, client->frame->area)) { if (sibling != NULL) { @@ -545,15 +551,28 @@ static gboolean stacking_occludes(ObClient *client, ObClient *sibling) return occludes; } -void stacking_restack_request(ObClient *client, ObClient *sibling, - gint detail, gboolean activate) +gboolean stacking_restack_request(ObClient *client, ObClient *sibling, + gint detail, gboolean activate) { + gboolean ret = FALSE; + + if (sibling && ((client->desktop != sibling->desktop && + client->desktop != DESKTOP_ALL && + sibling->desktop != DESKTOP_ALL) || + sibling->iconic)) + { + ob_debug("Setting restack sibling to NULL, they are not on the same " + "desktop or it is iconified\n"); + sibling = NULL; + } + switch (detail) { case Below: ob_debug("Restack request Below for client %s sibling %s\n", client->title, sibling ? sibling->title : "(all)"); /* just lower it */ stacking_lower(CLIENT_AS_WINDOW(client)); + ret = TRUE; break; case BottomIf: ob_debug("Restack request BottomIf for client %s sibling " @@ -561,8 +580,10 @@ void stacking_restack_request(ObClient *client, ObClient *sibling, client->title, sibling ? sibling->title : "(all)"); /* if this client occludes sibling (or anything if NULL), then lower it to the bottom */ - if (stacking_occludes(client, sibling)) + if (stacking_occludes(client, sibling)) { stacking_lower(CLIENT_AS_WINDOW(client)); + ret = TRUE; + } break; case Above: ob_debug("Restack request Above for client %s sibling %s\n", @@ -573,6 +594,7 @@ void stacking_restack_request(ObClient *client, ObClient *sibling, client_activate(client, FALSE, TRUE); else stacking_raise(CLIENT_AS_WINDOW(client)); + ret = TRUE; break; case TopIf: ob_debug("Restack request TopIf for client %s sibling %s\n", @@ -584,6 +606,7 @@ void stacking_restack_request(ObClient *client, ObClient *sibling, client_activate(client, FALSE, TRUE); else stacking_raise(CLIENT_AS_WINDOW(client)); + ret = TRUE; } break; case Opposite: @@ -597,9 +620,13 @@ void stacking_restack_request(ObClient *client, ObClient *sibling, client_activate(client, FALSE, TRUE); else stacking_raise(CLIENT_AS_WINDOW(client)); + ret = TRUE; } - else if (stacking_occludes(client, sibling)) + else if (stacking_occludes(client, sibling)) { stacking_lower(CLIENT_AS_WINDOW(client)); + ret = TRUE; + } break; } + return ret; }