[Xfce4-commits] <xfwm4:master> Optimize workspace deletion

Olivier Fourdan noreply at xfce.org
Thu Oct 27 19:06:01 CEST 2011


Updating branch refs/heads/master
         to 8637c3a8f869dee3c74e9ccb241b10ebfa4e705e (commit)
       from 1ae48784501f5095b5c66bc4316aa7ce8f950d6a (commit)

commit 8637c3a8f869dee3c74e9ccb241b10ebfa4e705e
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Thu Oct 27 19:04:00 2011 +0200

    Optimize workspace deletion

 src/workspaces.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/workspaces.c b/src/workspaces.c
index 8625249..8927b18 100644
--- a/src/workspaces.c
+++ b/src/workspaces.c
@@ -422,7 +422,7 @@ workspaceSetCount (ScreenInfo * screen_info, guint count)
 {
     DisplayInfo *display_info;
     Client *c;
-    guint i;
+    GList *list;
 
     g_return_if_fail (screen_info != NULL);
 
@@ -441,8 +441,9 @@ workspaceSetCount (ScreenInfo * screen_info, guint count)
     setHint (display_info, screen_info->xroot, NET_NUMBER_OF_DESKTOPS, count);
     screen_info->workspace_count = count;
 
-    for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
+        c = (Client *) list->data;
         if (c->win_workspace > count - 1)
         {
             clientSetWorkspace (c, count - 1, TRUE);
@@ -463,7 +464,8 @@ void
 workspaceInsert (ScreenInfo * screen_info, guint position)
 {
     Client *c;
-    guint i, count;
+    GList *list;
+    guint count;
 
     g_return_if_fail (screen_info != NULL);
 
@@ -477,8 +479,9 @@ workspaceInsert (ScreenInfo * screen_info, guint position)
         return;
     }
 
-    for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
+        c = (Client *) list->data;
         if (c->win_workspace >= position)
         {
             clientSetWorkspace (c, c->win_workspace + 1, TRUE);
@@ -490,7 +493,8 @@ void
 workspaceDelete (ScreenInfo * screen_info, guint position)
 {
     Client *c;
-    guint i, count;
+    GList *list;
+    guint count;
 
     g_return_if_fail (screen_info != NULL);
 
@@ -502,14 +506,6 @@ workspaceDelete (ScreenInfo * screen_info, guint position)
         return;
     }
 
-    for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
-    {
-        if (c->win_workspace > position)
-        {
-            clientSetWorkspace (c, c->win_workspace - 1, TRUE);
-        }
-    }
-
     workspaceSetCount(screen_info, count - 1);
 }
 


More information about the Xfce4-commits mailing list