[Xfce4-commits] <xfwm4:master> Some apps that I wouldn't name try to manipulate the win layer by themselves and cause havoc when doing so on transient dialogs, so we need to be extra careful before allowing apps to change the layer.

Olivier Fourdan noreply at xfce.org
Tue Oct 11 08:28:02 CEST 2011


Updating branch refs/heads/master
         to 081869d56c7d1210288a9f320e1c1fe25fbc4f02 (commit)
       from e77b4762e1484fe36f37347bc3d691f30ea791b3 (commit)

commit 081869d56c7d1210288a9f320e1c1fe25fbc4f02
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Mon Oct 10 10:33:03 2011 +0200

    Some apps that I wouldn't name try to manipulate the win layer by
    themselves and cause havoc when doing so on transient dialogs, so
    we need to be extra careful before allowing apps to change the
    layer.

 src/client.c   |    5 +++--
 src/events.c   |    8 +++++++-
 src/stacking.c |   22 ++++++++++++----------
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/client.c b/src/client.c
index e8d92e0..879ca02 100644
--- a/src/client.c
+++ b/src/client.c
@@ -983,6 +983,7 @@ clientGetMWMHints (Client * c, gboolean update)
             && !FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN))
         {
             /* legacy app changed its decoration, put it back on regular layer */
+            TRACE ("Legacy app changed its decoration \"%s\" (0x%lx)", c->name, c->window);
             FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN);
             clientSetLayer (c, WIN_LAYER_NORMAL);
         }
@@ -1834,7 +1835,7 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
         (c->win_layer == WIN_LAYER_NORMAL) &&
         (c->type == WINDOW_NORMAL))
     {
-        g_print ("Full screen for old apps\n");
+        TRACE ("Fullscreen for old apps \"%s\" (0x%lx)", c->name, c->window);
         FLAG_SET (c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN);
     }
 
@@ -2730,7 +2731,7 @@ clientSetLayer (Client * c, guint l)
     Client *c2 = NULL;
 
     g_return_if_fail (c != NULL);
-    TRACE ("entering clientSetLayer");
+    TRACE ("entering clientSetLayer for \"%s\" (0x%lx) on layer %d", c->name, c->window, l);
 
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
diff --git a/src/events.c b/src/events.c
index c6f9d82..dec1174 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1976,7 +1976,13 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
         else if ((ev->message_type == display_info->atoms[WIN_LAYER]) && (ev->format == 32))
         {
             TRACE ("client \"%s\" (0x%lx) has received a WIN_LAYER event", c->name, c->window);
-            if ((unsigned long) ev->data.l[0] != c->win_layer)
+            /*
+             * Some apps that I wouldn't name try to manipulate the win layer by themselves
+             * and cause havoc when doing so on transient dialogs, so we need to be extra careful
+             * here before allowing apps to change the layer.
+             * Actually, I beleive twe should get rid of support of this old protocol...
+             */
+            if (!clientIsTransientOrModal(c) && ((unsigned long) ev->data.l[0] != c->win_layer))
             {
                 clientSetLayer (c, ev->data.l[0]);
             }
diff --git a/src/stacking.c b/src/stacking.c
index c299d74..180ea61 100644
--- a/src/stacking.c
+++ b/src/stacking.c
@@ -544,6 +544,9 @@ clientAdjustFullscreenLayer (Client *c, gboolean set)
 {
     g_return_val_if_fail (c, FALSE);
 
+    TRACE ("entering clientAdjustFullscreenLayer");
+    TRACE ("Adjusting fullscreen layer for  \"%s\" (0x%lx)", c->name, c->window);
+
     if (set)
     {
         if (FLAG_TEST(c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN)
@@ -555,17 +558,16 @@ clientAdjustFullscreenLayer (Client *c, gboolean set)
     }
     else if (c->win_layer == WIN_LAYER_FULLSCREEN)
     {
-        if (FLAG_TEST(c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN)
-            || FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN))
+        if (FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN))
         {
-            if (FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN))
-            {
-                clientSetLayer (c, c->fullscreen_old_layer);
-            }
-            else
-            {
-                clientSetLayer (c, WIN_LAYER_NORMAL);
-            }
+            TRACE ("Moving \"%s\" (0x%lx) to initial layer %d", c->name, c->window, c->fullscreen_old_layer);
+            clientSetLayer (c, c->fullscreen_old_layer);
+            return TRUE;
+        }
+        if (FLAG_TEST(c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN))
+        {
+            TRACE ("Moving \"%s\" (0x%lx) to layer %d", c->name, c->window, WIN_LAYER_FULLSCREEN);
+            clientSetLayer (c, WIN_LAYER_NORMAL);
             return TRUE;
         }
     }


More information about the Xfce4-commits mailing list