From 8085c9885372e08b8e4f68a76b9f66e2e5dd80ce Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <fourdan.olivier@wanadoo.fr>
Date: Thu, 3 Nov 2005 21:09:53 +0000
Subject: [PATCH] Be more permissive with above/below states for transients
 (fixes Bug #1207)

(Old svn revision: 18614)
---
 src/client.c | 14 ++++----------
 src/netwm.c  |  6 +++---
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/client.c b/src/client.c
index 6f915aaa4..5fb9df16f 100644
--- a/src/client.c
+++ b/src/client.c
@@ -1307,19 +1307,13 @@ clientApplyInitialState (Client * c)
     }
     if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_ABOVE, CLIENT_FLAG_BELOW))
     {
-        if (!clientIsValidTransientOrModal (c))
-        {
-            TRACE ("Applying client's initial state: above");
-            clientUpdateAboveState (c);
-        }
+        TRACE ("Applying client's initial state: above");
+        clientUpdateAboveState (c);
     }
     if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_BELOW, CLIENT_FLAG_ABOVE))
     {
-        if (!clientIsValidTransientOrModal (c))
-        {
-            TRACE ("Applying client's initial state: below");
-            clientUpdateBelowState (c);
-        }
+        TRACE ("Applying client's initial state: below");
+        clientUpdateBelowState (c);
     }
     if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) &&
         FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK))
diff --git a/src/netwm.c b/src/netwm.c
index ed02423ea..bef1bcc36 100644
--- a/src/netwm.c
+++ b/src/netwm.c
@@ -453,7 +453,7 @@ clientUpdateNetState (Client * c, XClientMessageEvent * ev)
     if ((first  == display_info->atoms[NET_WM_STATE_ABOVE]) || 
         (second == display_info->atoms[NET_WM_STATE_ABOVE]))
     {
-        if (!clientIsValidTransientOrModal (c) && !FLAG_TEST (c->flags, CLIENT_FLAG_BELOW))
+        if (!FLAG_TEST (c->flags, CLIENT_FLAG_BELOW))
         {
             if ((action == NET_WM_STATE_ADD) && !FLAG_TEST (c->flags, CLIENT_FLAG_ABOVE))
             {
@@ -476,7 +476,7 @@ clientUpdateNetState (Client * c, XClientMessageEvent * ev)
     if ((first  == display_info->atoms[NET_WM_STATE_BELOW]) || 
         (second == display_info->atoms[NET_WM_STATE_BELOW]))
     {
-        if (!clientIsValidTransientOrModal (c) && !FLAG_TEST (c->flags, CLIENT_FLAG_ABOVE))
+        if (!FLAG_TEST (c->flags, CLIENT_FLAG_ABOVE))
         {
             if ((action == NET_WM_STATE_ADD) && !FLAG_TEST (c->flags, CLIENT_FLAG_BELOW))
             {
@@ -997,7 +997,7 @@ clientWindowType (Client * c)
         TRACE ("Window \"%s\" is a transient or a modal", c->name);
 
         c2 = clientGetHighestTransientOrModalFor (c);
-        if (c2)
+        if ((c2) && (c->win_layer < c2->win_layer))
         {
             if (clientIsTransient (c))
             {
-- 
GitLab