[Xfce4-commits] <xfwm4:master> Rework focus and fullscreen windows to make xfwm4 simpler and more predictable.

Olivier Fourdan noreply at xfce.org
Sat Oct 15 17:04:02 CEST 2011


Updating branch refs/heads/master
         to 407a67dc68bcf3e10406f2d79bc7c1d649f098f5 (commit)
       from fcb7c94e8df769a909a85947d280ce4fcea75abd (commit)

commit 407a67dc68bcf3e10406f2d79bc7c1d649f098f5
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Sat Oct 15 17:02:09 2011 +0200

    Rework focus and fullscreen windows to make xfwm4 simpler and
    more predictable.

 src/focus.c      |   44 ++++++++++++++++++++++----------------------
 src/transients.c |    9 ++++++---
 2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/src/focus.c b/src/focus.c
index 49e4665..85c0441 100644
--- a/src/focus.c
+++ b/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)
         {
@@ -406,9 +407,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))
     {
@@ -503,6 +506,12 @@ clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
     }
 
     client_focus = c;
+    if (c2)
+    {
+        clientAdjustFullscreenLayer (c2, FALSE);
+        frameQueueDraw (c2, FALSE);
+        clientUpdateOpacity (c2);
+    }
     if (c)
     {
         user_focus = c;
@@ -521,15 +530,6 @@ clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
         frameQueueDraw (c, FALSE);
         clientUpdateOpacity (c);
     }
-    if (c2)
-    {
-        if (c)
-        {
-            clientAdjustFullscreenLayer (c2, FALSE);
-        }
-        frameQueueDraw (c2, FALSE);
-        clientUpdateOpacity (c2);
-    }
     clientSetNetActiveWindow (screen_info, c, 0);
     clientClearDelayedFocus ();
 }
diff --git a/src/transients.c b/src/transients.c
index 7910fe7..5706783 100644
--- a/src/transients.c
+++ b/src/transients.c
@@ -255,10 +255,13 @@ clientTransientOrModalHasAncestor (Client * c, guint ws)
     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;
         }


More information about the Xfce4-commits mailing list