File xfwm4-fix-sticky-parentless-dialogs.patch of Package xfwm4.505

From 407a67dc68bcf3e10406f2d79bc7c1d649f098f5 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <fourdan@xfce.org>
Date: Sat, 15 Oct 2011 15:02:09 +0000
Subject: Rework focus and fullscreen windows to make xfwm4 simpler and

more predictable.
---
Index: xfwm4-4.8.3/src/focus.c
===================================================================
--- xfwm4-4.8.3.orig/src/focus.c
+++ xfwm4-4.8.3/src/focus.c
@@ -193,11 +193,13 @@ clientFocusNew(Client * c)
             }
         }
     }
-
-    if ((give_focus) || FLAG_TEST(c->flags, CLIENT_FLAG_STATE_MODAL))
+    if (FLAG_TEST(c->flags, CLIENT_FLAG_STATE_MODAL))
     {
         give_focus = TRUE;
-        if ((client_focus) && !(clientIsTransientOrModalFor (c, client_focus)))
+    }
+    if (give_focus)
+    {
+        if (client_focus)
         {
             clientAdjustFullscreenLayer (client_focus, FALSE);
         }
@@ -212,22 +214,21 @@ clientFocusNew(Client * c)
     {
         Client *c2 = clientGetFocus();
 
-        /*
-         * Place windows under the currently focused only if focus
-         * stealing prevention had prevented the focus transition,
-         * otherwise, leave the unfocused window on top.
-         */
+        clientSortRing(c);
         if ((c2 != NULL) && (c2->win_layer == c->win_layer) && prevented)
         {
-            clientSortRing(c);
+            /*
+             * Place windows under the currently focused only if focus
+             * stealing prevention had prevented the focus transition,
+             * otherwise, leave the unfocused window on top.
+             */
             clientLower (c, c2->frame);
-            clientSortRing(c2);
         }
         else
         {
             clientRaise (c, None);
-            clientSortRing(c);
         }
+        clientSortRing(c2);
 
         if (prevented)
         {
@@ -411,9 +412,11 @@ clientSortRing(Client *c)
 {
     ScreenInfo *screen_info;
 
-    g_return_if_fail (c != NULL);
     TRACE ("entering clientSortRing");
-
+    if (c == NULL)
+    {
+        return;
+    }
     screen_info = c->screen_info;
     if ((screen_info->client_count > 2) && (c != screen_info->clients))
     {
@@ -509,6 +512,12 @@ clientUpdateFocus (ScreenInfo *screen_in
     }
 
     client_focus = c;
+    if (c2)
+    {
+        clientAdjustFullscreenLayer (c2, FALSE);
+        frameQueueDraw (c2, FALSE);
+        clientUpdateOpacity (c2);
+    }
     if (c)
     {
         user_focus = c;
@@ -527,15 +536,6 @@ clientUpdateFocus (ScreenInfo *screen_in
         frameQueueDraw (c, FALSE);
         clientUpdateOpacity (c);
     }
-    if (c2)
-    {
-        if (c)
-        {
-            clientAdjustFullscreenLayer (c2, FALSE);
-        }
-        frameQueueDraw (c2, FALSE);
-        clientUpdateOpacity (c2);
-    }
     clientSetNetActiveWindow (screen_info, c, 0);
     clientClearDelayedFocus ();
     pending_focus = NULL;
Index: xfwm4-4.8.3/src/transients.c
===================================================================
--- xfwm4-4.8.3.orig/src/transients.c
+++ xfwm4-4.8.3/src/transients.c
@@ -255,10 +255,13 @@ clientTransientOrModalHasAncestor (Clien
     for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
         c2 = (Client *) list->data;
-        if ((c2 != c) && !clientIsTransientOrModal (c2)
+        if ((c2 != c)
+            && !clientIsTransientOrModal (c2)
             && clientIsTransientOrModalFor (c, c2)
-            && !FLAG_TEST (c2->flags, CLIENT_FLAG_ICONIFIED)
-            && (c2->win_workspace == ws))
+            && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE)
+            && (c2->win_workspace == ws)
+            && (((ws == screen_info->current_ws) && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE))
+                || !FLAG_TEST (c2->flags, CLIENT_FLAG_ICONIFIED)))
         {
             return TRUE;
         }
openSUSE Build Service is sponsored by