]> Dogcows Code - chaz/openbox/blobdiff - openbox/stacking.c
fix non instrusive stacking adds, they didnt account for layers at all
[chaz/openbox] / openbox / stacking.c
index bedc10c817e2973f144ca54288003302d4b2dd99..ff5a943be9a03a4f1c870e978d545cbf76a0dcb6 100644 (file)
@@ -1,6 +1,7 @@
 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
 
    stacking.c for the Openbox window manager
+   Copyright (c) 2006        Mikael Magnusson
    Copyright (c) 2003        Ben Jansens
 
    This program is free software; you can redistribute it and/or modify
@@ -283,7 +284,8 @@ void stacking_raise(ObWindow *window, gboolean group)
         selected = WINDOW_AS_CLIENT(window);
         c = client_search_top_transient(selected);
         wins = pick_windows(c, selected, TRUE);
-        wins = g_list_concat(wins, pick_group_windows(c, selected, TRUE, group));
+        wins = g_list_concat(wins,
+                             pick_group_windows(c, selected, TRUE, group));
     } else {
         wins = g_list_append(NULL, window);
         stacking_list = g_list_remove(stacking_list, window);
@@ -302,7 +304,8 @@ void stacking_lower(ObWindow *window, gboolean group)
         selected = WINDOW_AS_CLIENT(window);
         c = client_search_top_transient(selected);
         wins = pick_windows(c, selected, FALSE);
-        wins = g_list_concat(pick_group_windows(c, selected, FALSE, group), wins);
+        wins = g_list_concat(pick_group_windows(c, selected, FALSE, group),
+                             wins);
     } else {
         wins = g_list_append(NULL, window);
         stacking_list = g_list_remove(stacking_list, window);
@@ -327,15 +330,9 @@ void stacking_below(ObWindow *window, ObWindow *below)
 
 void stacking_add(ObWindow *win)
 {
-    ObStackingLayer l;
-    GList *wins;
-
     g_assert(screen_support_win != None); /* make sure I dont break this in the
                                              future */
 
-    l = window_layer(win);
-    wins = g_list_append(NULL, win); /* list of 1 element */
-
     stacking_list = g_list_append(stacking_list, win);
     stacking_raise(win, FALSE);
 }
@@ -388,6 +385,15 @@ void stacking_add_nonintrusive(ObWindow *win)
         /* out of ideas, just add it normally... */
         stacking_add(win);
     } else {
+        GList *it;
+
+        /* make sure it's not in the wrong layer though ! */
+        while (it_before && client->layer < ((ObClient*)it_before->data)->layer)
+            it_before = g_list_next(it_before);
+        while (it_before != stacking_list &&
+               client->layer > ((ObClient*)g_list_previous(it_before)->data)->layer)
+            it_before = g_list_previous(it_before);
+
         GList *wins = g_list_append(NULL, win);
         do_restack(wins, it_before);
         g_list_free(wins);
This page took 0.024896 seconds and 4 git commands to generate.