Skip to content
Snippets Groups Projects
Commit b45bdd66 authored by Olivier Fourdan's avatar Olivier Fourdan
Browse files

Optimize desktop swtching

(Old svn revision: 10969)
parent 0cb07890
No related branches found
No related tags found
No related merge requests found
......@@ -74,17 +74,8 @@ void workspaceSwitch(int new_ws, Client * c2)
workspace = new_ws;
/*
Do the switch in two passes :
- The first one, unmapping windows from bottom to top
- The second pass, mapping from top to bottom
==> this save a lot of expose events and make things a lot faster ;-)
*/
/* First pass */
for(last = clients, i = 0; i < client_count; last = last->next, i++);
for(c = last, i = 0; i < client_count; c = c->prev, i++)
for(c = clients->prev, i = 0; (c) && (i < client_count); c = c->prev, i++)
{
if(CLIENT_FLAG_TEST_AND_NOT(c, CLIENT_FLAG_VISIBLE, CLIENT_FLAG_STICKY) && !(c->transient_for) && ((c->win_workspace != new_ws)))
{
......@@ -92,7 +83,7 @@ void workspaceSwitch(int new_ws, Client * c2)
}
}
/* Second pass */
for(c = clients, i = 0; i < client_count; c = c->next, i++)
for(c = clients, i = 0; (c) && (i < client_count); c = c->next, i++)
{
if(CLIENT_FLAG_TEST(c, CLIENT_FLAG_STICKY))
{
......@@ -145,7 +136,7 @@ void workspaceSetCount(int count)
setNetHint(dpy, root, net_number_of_desktops, count);
params.workspace_count = count;
for(c = clients, i = 0; i < client_count; c = c->next, i++)
for(c = clients, i = 0; (c) && (i < client_count); c = c->next, i++)
{
if(c->win_workspace > count - 1)
{
......@@ -174,7 +165,7 @@ void workspaceUpdateArea(CARD32 * margins, CARD32 * gnome_margins)
{
margins[i] = gnome_margins[i];
}
for(c = clients, i = 0; i < client_count; c = c->next, i++)
for(c = clients, i = 0; (c) && (i < client_count); c = c->next, i++)
{
if(CLIENT_FLAG_TEST_ALL(c, CLIENT_FLAG_HAS_STRUTS | CLIENT_FLAG_VISIBLE))
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment