Author: olivier
Date: 2008-11-27 14:54:19 +0000 (Thu, 27 Nov 2008)
New Revision: 28926

Modified:
   xfwm4/trunk/ChangeLog
   xfwm4/trunk/src/transients.c
Log:
        * src/transients.c: Based on previous change, we an now optimize 
          clientGetModalFor() and make it a lot simpler and more efficient.

Modified: xfwm4/trunk/ChangeLog
===================================================================
--- xfwm4/trunk/ChangeLog       2008-11-27 13:41:33 UTC (rev 28925)
+++ xfwm4/trunk/ChangeLog       2008-11-27 14:54:19 UTC (rev 28926)
@@ -1,5 +1,10 @@
 2008-11-27  olivier
 
+       * src/transients.c: Based on previous change, we an now optimize 
+         clientGetModalFor() and make it a lot simpler and more efficient.
+
+2008-11-27  olivier
+
        * src/transients.c: Do not consider all windows of the same group for
          modality (See comment in Bug #3586)
 

Modified: xfwm4/trunk/src/transients.c
===================================================================
--- xfwm4/trunk/src/transients.c        2008-11-27 13:41:33 UTC (rev 28925)
+++ xfwm4/trunk/src/transients.c        2008-11-27 14:54:19 UTC (rev 28926)
@@ -256,49 +256,25 @@
 clientGetModalFor (Client * c)
 {
     ScreenInfo *screen_info;
-    Client *latest_modal;
-    Client *c2, *c3;
-    GList *modals;
-    GList *index1, *index2;
+    Client *c2;
+    GList *index;
 
     g_return_val_if_fail (c != NULL, NULL);
     TRACE ("entering clientGetModalFor");
 
-    modals = NULL;
-    latest_modal = NULL;
     screen_info = c->screen_info;
-    for (index1 = screen_info->windows_stack; index1; index1 = g_list_next 
(index1))
+    for (index = g_list_last(screen_info->windows_stack); index; index = 
g_list_previous (index))
     {
-        c2 = (Client *) index1->data;
+        c2 = (Client *) index->data;
         if (c2)
         {
             if ((c2 != c) && clientIsModalFor (c2, c))
             {
-                modals = g_list_append (modals, c2);
-                latest_modal = c2;
+                return c2;
             }
-            else
-            {
-                for (index2 = modals; index2;
-                    index2 = g_list_next (index2))
-                {
-                    c3 = (Client *) index2->data;
-                    if ((c3 != c2) && clientIsModalFor (c2, c3))
-                    {
-                        modals = g_list_append (modals, c2);
-                        latest_modal = c2;
-                        break;
-                    }
-                }
-            }
         }
     }
-    if (modals)
-    {
-        g_list_free (modals);
-    }
-
-    return latest_modal;
+    return NULL;
 }
 
 Client *

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to