]> Dogcows Code - chaz/openbox/commitdiff
make the raiselower action smarter
authorDana Jansens <danakj@orodu.net>
Fri, 22 Aug 2003 15:36:44 +0000 (15:36 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 22 Aug 2003 15:36:44 +0000 (15:36 +0000)
openbox/action.c

index 4e3b83ba9cec36724437b106bffd4ac79f48f964..824fb35cd2ac67e3bcdf360b612c058c978703ab 100644 (file)
@@ -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)
This page took 0.023027 seconds and 4 git commands to generate.