[Xfce4-commits] <xfwm4:xfce-4.8> 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:04 CEST 2011


Updating branch refs/heads/xfce-4.8
         to 9015305a2e4f46a938b88f0029c19db26657c0ad (commit)
       from 41ce9e6b77ce2b601cc6cec46d29a6c59cebde82 (commit)

commit 9015305a2e4f46a938b88f0029c19db26657c0ad
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 67c5f36..e5e56ca 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 f3aadcf..e1f9588 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1982,7 +1982,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