use g_[s]list_next/previous consistantly, and check for "it" instead of "it != NULL" consistantly. props to Logan again :)

This commit is contained in:
Dana Jansens 2003-10-25 19:27:09 +00:00
parent 4cb183401c
commit 174de91c34
9 changed files with 71 additions and 61 deletions

View file

@ -119,7 +119,7 @@ void client_set_list()
if (size > 0) { if (size > 0) {
windows = g_new(Window, size); windows = g_new(Window, size);
win_it = windows; win_it = windows;
for (it = client_list; it != NULL; it = it->next, ++win_it) for (it = client_list; it; it = g_list_next(it), ++win_it)
*win_it = ((ObClient*)it->data)->window; *win_it = ((ObClient*)it->data)->window;
} else } else
windows = NULL; windows = NULL;
@ -138,7 +138,7 @@ void client_set_list()
{ {
GSList *it; GSList *it;
for (it = self->transients; it; it = it->next) { for (it = self->transients; it; it = g_slist_next(it)) {
if (!func(it->data, data)) return; if (!func(it->data, data)) return;
client_foreach_transient(it->data, func, data); client_foreach_transient(it->data, func, data);
} }
@ -153,7 +153,7 @@ void client_set_list()
} else { } else {
GSList *it; GSList *it;
for (it = self->group->members; it; it = it->next) for (it = self->group->members; it; it = g_slist_next(it))
if (it->data != self && if (it->data != self &&
!((ObClient*)it->data)->transient_for) { !((ObClient*)it->data)->transient_for) {
if (!func(it->data, data)) return; if (!func(it->data, data)) return;
@ -314,7 +314,7 @@ void client_manage(Window window)
if (self->group) { if (self->group) {
GSList *it; GSList *it;
for (it = self->group->members; it; it = it->next) for (it = self->group->members; it; it = g_slist_next(it))
{ {
if (client_focused(it->data)) if (client_focused(it->data))
{ {
@ -457,7 +457,7 @@ void client_unmanage(ObClient *self)
if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */ if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
GSList *it; GSList *it;
for (it = self->group->members; it; it = it->next) for (it = self->group->members; it; it = g_slist_next(it))
if (it->data != self) if (it->data != self)
((ObClient*)it->data)->transients = ((ObClient*)it->data)->transients =
g_slist_remove(((ObClient*)it->data)->transients, self); g_slist_remove(((ObClient*)it->data)->transients, self);
@ -467,7 +467,7 @@ void client_unmanage(ObClient *self)
} }
/* tell our transients that we're gone */ /* tell our transients that we're gone */
for (it = self->transients; it != NULL; it = it->next) { for (it = self->transients; it; it = g_slist_next(it)) {
if (((ObClient*)it->data)->transient_for != OB_TRAN_GROUP) { if (((ObClient*)it->data)->transient_for != OB_TRAN_GROUP) {
((ObClient*)it->data)->transient_for = NULL; ((ObClient*)it->data)->transient_for = NULL;
client_calc_layer(it->data); client_calc_layer(it->data);
@ -786,7 +786,7 @@ static void client_get_desktop(ObClient *self)
} else { } else {
GSList *it; GSList *it;
for (it = self->group->members; it; it = it->next) for (it = self->group->members; it; it = g_slist_next(it))
if (it->data != self && if (it->data != self &&
!((ObClient*)it->data)->transient_for) { !((ObClient*)it->data)->transient_for) {
self->desktop = ((ObClient*)it->data)->desktop; self->desktop = ((ObClient*)it->data)->desktop;
@ -1353,13 +1353,15 @@ void client_update_wmhints(ObClient *self)
/* remove from the old group if there was one */ /* remove from the old group if there was one */
if (self->group != NULL) { if (self->group != NULL) {
/* remove transients of the group */ /* remove transients of the group */
for (it = self->group->members; it; it = it->next) for (it = self->group->members; it; it = g_slist_next(it))
self->transients = g_slist_remove(self->transients, self->transients = g_slist_remove(self->transients,
it->data); it->data);
/* remove myself from parents in the group */ /* remove myself from parents in the group */
if (self->transient_for == OB_TRAN_GROUP) { if (self->transient_for == OB_TRAN_GROUP) {
for (it = self->group->members; it; it = it->next) { for (it = self->group->members; it;
it = g_slist_next(it))
{
ObClient *c = it->data; ObClient *c = it->data;
if (c != self && !c->transient_for) if (c != self && !c->transient_for)
@ -1379,7 +1381,9 @@ void client_update_wmhints(ObClient *self)
if (!self->transient_for) { if (!self->transient_for) {
/* add other transients of the group that are already /* add other transients of the group that are already
set up */ set up */
for (it = self->group->members; it; it = it->next) { for (it = self->group->members; it;
it = g_slist_next(it))
{
ObClient *c = it->data; ObClient *c = it->data;
if (c != self && c->transient_for == OB_TRAN_GROUP) if (c != self && c->transient_for == OB_TRAN_GROUP)
self->transients = self->transients =
@ -1433,7 +1437,7 @@ void client_update_title(ObClient *self)
/* look for duplicates and append a number */ /* look for duplicates and append a number */
nums = 0; nums = 0;
for (it = client_list; it; it = it->next) for (it = client_list; it; it = g_list_next(it))
if (it->data != self) { if (it->data != self) {
ObClient *c = it->data; ObClient *c = it->data;
if (0 == strncmp(c->title, data, strlen(data))) if (0 == strncmp(c->title, data, strlen(data)))
@ -1714,7 +1718,7 @@ ObClient *client_search_focus_tree(ObClient *self)
GSList *it; GSList *it;
ObClient *ret; ObClient *ret;
for (it = self->transients; it != NULL; it = it->next) { for (it = self->transients; it; it = g_slist_next(it)) {
if (client_focused(it->data)) return it->data; if (client_focused(it->data)) return it->data;
if ((ret = client_search_focus_tree(it->data))) return ret; if ((ret = client_search_focus_tree(it->data))) return ret;
} }
@ -1730,7 +1734,7 @@ ObClient *client_search_focus_tree_full(ObClient *self)
GSList *it; GSList *it;
gboolean recursed = FALSE; gboolean recursed = FALSE;
for (it = self->group->members; it; it = it->next) for (it = self->group->members; it; it = g_slist_next(it))
if (!((ObClient*)it->data)->transient_for) { if (!((ObClient*)it->data)->transient_for) {
ObClient *c; ObClient *c;
if ((c = client_search_focus_tree_full(it->data))) if ((c = client_search_focus_tree_full(it->data)))
@ -1780,7 +1784,7 @@ static void client_calc_layer_recursive(ObClient *self, ObClient *orig,
own = calc_layer(self); own = calc_layer(self);
self->layer = l > own ? l : own; self->layer = l > own ? l : own;
for (it = self->transients; it; it = it->next) for (it = self->transients; it; it = g_slist_next(it))
client_calc_layer_recursive(it->data, orig, client_calc_layer_recursive(it->data, orig,
l, raised ? raised : l != old); l, raised ? raised : l != old);
@ -2243,7 +2247,7 @@ static void client_iconify_recursive(ObClient *self,
} }
/* iconify all transients */ /* iconify all transients */
for (it = self->transients; it != NULL; it = it->next) for (it = self->transients; it; it = g_slist_next(it))
if (it->data != self) client_iconify_recursive(it->data, if (it->data != self) client_iconify_recursive(it->data,
iconic, curdesk); iconic, curdesk);
} }
@ -2435,7 +2439,7 @@ void client_set_desktop_recursive(ObClient *self,
} }
/* move all transients */ /* move all transients */
for (it = self->transients; it != NULL; it = it->next) for (it = self->transients; it; it = g_slist_next(it))
if (it->data != self) client_set_desktop_recursive(it->data, if (it->data != self) client_set_desktop_recursive(it->data,
target, donthide); target, donthide);
} }
@ -2451,7 +2455,7 @@ ObClient *client_search_modal_child(ObClient *self)
GSList *it; GSList *it;
ObClient *ret; ObClient *ret;
for (it = self->transients; it != NULL; it = it->next) { for (it = self->transients; it; it = g_slist_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
if ((ret = client_search_modal_child(c))) return ret; if ((ret = client_search_modal_child(c))) return ret;
if (c->modal) return c; if (c->modal) return c;
@ -2858,7 +2862,7 @@ ObClient *client_find_directional(ObClient *c, ObDirection dir)
best_score = -1; best_score = -1;
best_client = NULL; best_client = NULL;
for(it = g_list_first(client_list); it; it = it->next) { for(it = g_list_first(client_list); it; it = g_list_next(it)) {
cur = it->data; cur = it->data;
/* the currently selected window isn't interesting */ /* the currently selected window isn't interesting */
@ -2995,7 +2999,7 @@ ObClient *client_search_top_transient(ObClient *self)
g_assert(self->group); g_assert(self->group);
for (it = self->group->members; it; it = it->next) { for (it = self->group->members; it; it = g_slist_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
/* checking transient_for prevents infinate loops! */ /* checking transient_for prevents infinate loops! */
@ -3019,7 +3023,7 @@ ObClient *client_search_focus_parent(ObClient *self)
} else { } else {
GSList *it; GSList *it;
for (it = self->group->members; it; it = it->next) { for (it = self->group->members; it; it = g_slist_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
/* checking transient_for prevents infinate loops! */ /* checking transient_for prevents infinate loops! */
@ -3042,7 +3046,7 @@ ObClient *client_search_parent(ObClient *self, ObClient *search)
} else { } else {
GSList *it; GSList *it;
for (it = self->group->members; it; it = it->next) { for (it = self->group->members; it; it = g_slist_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
/* checking transient_for prevents infinate loops! */ /* checking transient_for prevents infinate loops! */
@ -3105,7 +3109,7 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
/* default: top of screen */ /* default: top of screen */
dest = a->y; dest = a->y;
for(it = g_list_first(client_list); it; it = it->next) { for(it = client_list; it; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset; gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data; ObClient *cur = it->data;
@ -3146,7 +3150,7 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
/* default: bottom of screen */ /* default: bottom of screen */
dest = a->y + a->height; dest = a->y + a->height;
for(it = g_list_first(client_list); it; it = it->next) { for(it = client_list; it; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset; gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data; ObClient *cur = it->data;
@ -3188,7 +3192,7 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
/* default: leftmost egde of screen */ /* default: leftmost egde of screen */
dest = a->x; dest = a->x;
for(it = g_list_first(client_list); it; it = it->next) { for(it = client_list; it; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset; gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data; ObClient *cur = it->data;
@ -3230,7 +3234,7 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
/* default: rightmost edge of screen */ /* default: rightmost edge of screen */
dest = a->x + a->width; dest = a->x + a->width;
for(it = g_list_first(client_list); it; it = it->next) { for(it = client_list; it; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset; gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data; ObClient *cur = it->data;
@ -3281,7 +3285,7 @@ ObClient* client_under_pointer()
ObClient *ret = NULL; ObClient *ret = NULL;
if (screen_pointer_pos(&x, &y)) { if (screen_pointer_pos(&x, &y)) {
for (it = stacking_list; it != NULL; it = it->next) { for (it = stacking_list; it; it = g_list_next(it)) {
if (WINDOW_IS_CLIENT(it->data)) { if (WINDOW_IS_CLIENT(it->data)) {
ObClient *c = WINDOW_AS_CLIENT(it->data); ObClient *c = WINDOW_AS_CLIENT(it->data);
if (c->frame->visible && if (c->frame->visible &&

View file

@ -224,7 +224,7 @@ void dock_configure()
dock->w = dock->h = 0; dock->w = dock->h = 0;
/* get the size */ /* get the size */
for (it = dock->dock_apps; it; it = it->next) { for (it = dock->dock_apps; it; it = g_list_next(it)) {
ObDockApp *app = it->data; ObDockApp *app = it->data;
switch (config_dock_orient) { switch (config_dock_orient) {
case OB_ORIENTATION_HORZ: case OB_ORIENTATION_HORZ:
@ -241,7 +241,7 @@ void dock_configure()
spot = (config_dock_orient == OB_ORIENTATION_HORZ ? minw : minh) / 2; spot = (config_dock_orient == OB_ORIENTATION_HORZ ? minw : minh) / 2;
/* position the apps */ /* position the apps */
for (it = dock->dock_apps; it; it = it->next) { for (it = dock->dock_apps; it; it = g_list_next(it)) {
ObDockApp *app = it->data; ObDockApp *app = it->data;
switch (config_dock_orient) { switch (config_dock_orient) {
case OB_ORIENTATION_HORZ: case OB_ORIENTATION_HORZ:
@ -550,7 +550,7 @@ void dock_app_drag(ObDockApp *app, XMotionEvent *e)
/* which dock app are we on top of? */ /* which dock app are we on top of? */
stop = FALSE; stop = FALSE;
for (it = dock->dock_apps; it; it = it->next) { for (it = dock->dock_apps; it; it = g_list_next(it)) {
over = it->data; over = it->data;
switch (config_dock_orient) { switch (config_dock_orient) {
case OB_ORIENTATION_HORZ: case OB_ORIENTATION_HORZ:

View file

@ -216,7 +216,7 @@ static ObClient *find_transient_recursive(ObClient *c, ObClient *top,
GSList *it; GSList *it;
ObClient *ret; ObClient *ret;
for (it = c->transients; it; it = it->next) { for (it = c->transients; it; it = g_slist_next(it)) {
if (it->data == top) return NULL; if (it->data == top) return NULL;
ret = find_transient_recursive(it->data, top, skip); ret = find_transient_recursive(it->data, top, skip);
if (ret && ret != skip && client_normal(ret)) return ret; if (ret && ret != skip && client_normal(ret)) return ret;
@ -266,15 +266,20 @@ ObClient* focus_fallback_target(ObFocusFallbackType type)
/* try for transient relations */ /* try for transient relations */
if (trans) { if (trans) {
if (old->transient_for == OB_TRAN_GROUP) { if (old->transient_for == OB_TRAN_GROUP) {
for (it = focus_order[screen_desktop]; it; it = it->next) { for (it = focus_order[screen_desktop]; it;
it = g_list_next(it))
{
GSList *sit; GSList *sit;
for (sit = old->group->members; sit; sit = sit->next) for (sit = old->group->members; sit;
sit = g_slist_next(sit))
{
if (sit->data == it->data) if (sit->data == it->data)
if ((target = if ((target =
focus_fallback_transient(sit->data, old))) focus_fallback_transient(sit->data, old)))
return target; return target;
} }
}
} else { } else {
if ((target = if ((target =
focus_fallback_transient(old->transient_for, old))) focus_fallback_transient(old->transient_for, old)))
@ -295,8 +300,8 @@ ObClient* focus_fallback_target(ObFocusFallbackType type)
if (old->group) { if (old->group) {
GSList *sit; GSList *sit;
for (it = focus_order[screen_desktop]; it != NULL; it = it->next) for (it = focus_order[screen_desktop]; it; it = g_list_next(it))
for (sit = old->group->members; sit; sit = sit->next) for (sit = old->group->members; sit; sit = g_slist_next(sit))
if (sit->data == it->data) if (sit->data == it->data)
if (sit->data != old && client_normal(sit->data)) if (sit->data != old && client_normal(sit->data))
if (client_can_focus(sit->data)) if (client_can_focus(sit->data))
@ -304,7 +309,7 @@ ObClient* focus_fallback_target(ObFocusFallbackType type)
} }
#endif #endif
for (it = focus_order[screen_desktop]; it != NULL; it = it->next) for (it = focus_order[screen_desktop]; it; it = g_list_next(it))
if (type != OB_FOCUS_FALLBACK_UNFOCUSING || it->data != old) if (type != OB_FOCUS_FALLBACK_UNFOCUSING || it->data != old)
if (client_normal(it->data) && client_can_focus(it->data)) if (client_normal(it->data) && client_can_focus(it->data))
return it->data; return it->data;
@ -699,7 +704,7 @@ static void to_top(ObClient *c, guint d)
/* insert before first iconic window */ /* insert before first iconic window */
for (it = focus_order[d]; for (it = focus_order[d];
it && !((ObClient*)it->data)->iconic; it = it->next); it && !((ObClient*)it->data)->iconic; it = g_list_next(it));
focus_order[d] = g_list_insert_before(focus_order[d], it, c); focus_order[d] = g_list_insert_before(focus_order[d], it, c);
} }
} }
@ -726,7 +731,7 @@ static void to_bottom(ObClient *c, guint d)
/* insert before first iconic window */ /* insert before first iconic window */
for (it = focus_order[d]; for (it = focus_order[d];
it && !((ObClient*)it->data)->iconic; it = it->next); it && !((ObClient*)it->data)->iconic; it = g_list_next(it));
g_list_insert_before(focus_order[d], it, c); g_list_insert_before(focus_order[d], it, c);
} }
} }

View file

@ -50,7 +50,7 @@ KeyBindingTree *tree_build(GList *keylist)
if (g_list_length(keylist) <= 0) if (g_list_length(keylist) <= 0)
return NULL; /* nothing in the list.. */ return NULL; /* nothing in the list.. */
for (it = g_list_last(keylist); it != NULL; it = it->prev) { for (it = g_list_last(keylist); it; it = g_list_previous(it)) {
p = ret; p = ret;
ret = g_new0(KeyBindingTree, 1); ret = g_new0(KeyBindingTree, 1);
if (p == NULL) { if (p == NULL) {
@ -58,7 +58,7 @@ KeyBindingTree *tree_build(GList *keylist)
/* this is the first built node, the bottom node of the tree */ /* this is the first built node, the bottom node of the tree */
ret->keylist = g_list_copy(keylist); /* shallow copy */ ret->keylist = g_list_copy(keylist); /* shallow copy */
for (it = ret->keylist; it != NULL; it = it->next) /* deep copy */ for (it = ret->keylist; it; it = g_list_next(it)) /* deep copy */
it->data = g_strdup(it->data); it->data = g_strdup(it->data);
} }
ret->first_child = p; ret->first_child = p;

View file

@ -93,7 +93,7 @@ void mouse_grab_for_client(ObClient *client, gboolean grab)
GSList *it; GSList *it;
for (i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i) for (i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i)
for (it = bound_contexts[i]; it != NULL; it = g_slist_next(it)) { for (it = bound_contexts[i]; it; it = g_slist_next(it)) {
/* grab/ungrab the button */ /* grab/ungrab the button */
ObMouseBinding *b = it->data; ObMouseBinding *b = it->data;
Window win; Window win;
@ -124,7 +124,7 @@ static void grab_all_clients(gboolean grab)
{ {
GList *it; GList *it;
for (it = client_list; it != NULL; it = it->next) for (it = client_list; it; it = g_list_next(it))
mouse_grab_for_client(it->data, grab); mouse_grab_for_client(it->data, grab);
} }
@ -134,14 +134,14 @@ void mouse_unbind_all()
GSList *it; GSList *it;
for(i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i) { for(i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i) {
for (it = bound_contexts[i]; it != NULL; it = it->next) { for (it = bound_contexts[i]; it; it = g_slist_next(it)) {
ObMouseBinding *b = it->data; ObMouseBinding *b = it->data;
gint j; gint j;
for (j = 0; j < OB_NUM_MOUSE_ACTIONS; ++j) { for (j = 0; j < OB_NUM_MOUSE_ACTIONS; ++j) {
GSList *it; GSList *it;
for (it = b->actions[j]; it; it = it->next) for (it = b->actions[j]; it; it = g_slist_next(it))
action_unref(it->data); action_unref(it->data);
g_slist_free(b->actions[j]); g_slist_free(b->actions[j]);
} }
@ -159,7 +159,7 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
GSList *it; GSList *it;
ObMouseBinding *b; ObMouseBinding *b;
for (it = bound_contexts[context]; it != NULL; it = it->next) { for (it = bound_contexts[context]; it; it = g_slist_next(it)) {
b = it->data; b = it->data;
if (b->state == state && b->button == button) if (b->state == state && b->button == button)
break; break;
@ -314,7 +314,7 @@ gboolean mouse_bind(const gchar *buttonstr, const gchar *contextstr,
return FALSE; return FALSE;
} }
for (it = bound_contexts[context]; it != NULL; it = it->next){ for (it = bound_contexts[context]; it; it = g_slist_next(it)) {
b = it->data; b = it->data;
if (b->state == state && b->button == button) { if (b->state == state && b->button == button) {
b->actions[mact] = g_slist_append(b->actions[mact], action); b->actions[mact] = g_slist_append(b->actions[mact], action);

View file

@ -346,7 +346,7 @@ static gboolean place_transient(ObClient *client, gint *x, gint *y)
GSList *it; GSList *it;
gboolean first = TRUE; gboolean first = TRUE;
gint l, r, t, b; gint l, r, t, b;
for (it = client->group->members; it; it = it->next) { for (it = client->group->members; it; it = g_slist_next(it)) {
ObClient *m = it->data; ObClient *m = it->data;
if (!(m == client || m->transient_for)) { if (!(m == client || m->transient_for)) {
if (first) { if (first) {

View file

@ -47,7 +47,7 @@ void resist_move_windows(ObClient *c, gint *x, gint *y)
cb = RECT_BOTTOM(c->frame->area); cb = RECT_BOTTOM(c->frame->area);
if (config_resist_win) if (config_resist_win)
for (it = stacking_list; it != NULL; it = it->next) { for (it = stacking_list; it; it = g_list_next(it)) {
ObClient *target; ObClient *target;
gint tl, tt, tr, tb; /* 1 past the target's edges on each side */ gint tl, tt, tr, tb; /* 1 past the target's edges on each side */
@ -187,7 +187,7 @@ void resist_size_windows(ObClient *c, gint *w, gint *h, ObCorner corn)
b = RECT_BOTTOM(c->frame->area); b = RECT_BOTTOM(c->frame->area);
if (config_resist_win) { if (config_resist_win) {
for (it = stacking_list; it != NULL; it = it->next) { for (it = stacking_list; it; it = g_list_next(it)) {
if (!WINDOW_IS_CLIENT(it->data)) if (!WINDOW_IS_CLIENT(it->data))
continue; continue;
target = it->data; target = it->data;

View file

@ -283,7 +283,7 @@ void screen_startup(gboolean reconfig)
/* set the names */ /* set the names */
screen_desktop_names = g_new(gchar*, screen_desktop_names = g_new(gchar*,
g_slist_length(config_desktops_names) + 1); g_slist_length(config_desktops_names) + 1);
for (i = 0, it = config_desktops_names; it; ++i, it = it->next) for (i = 0, it = config_desktops_names; it; ++i, it = g_slist_next(it))
screen_desktop_names[i] = it->data; /* dont strdup */ screen_desktop_names[i] = it->data; /* dont strdup */
screen_desktop_names[i] = NULL; screen_desktop_names[i] = NULL;
PROP_SETSS(RootWindow(ob_display, ob_screen), PROP_SETSS(RootWindow(ob_display, ob_screen),
@ -360,7 +360,7 @@ void screen_resize()
screen_update_areas(); screen_update_areas();
dock_configure(); dock_configure();
for (it = client_list; it; it = it->next) for (it = client_list; it; it = g_list_next(it))
client_move_onscreen(it->data, FALSE); client_move_onscreen(it->data, FALSE);
} }
@ -392,7 +392,7 @@ void screen_set_num_desktops(guint num)
screen_update_desktop_names(); screen_update_desktop_names();
/* move windows on desktops that will no longer exist! */ /* move windows on desktops that will no longer exist! */
for (it = client_list; it != NULL; it = it->next) { for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
if (c->desktop >= num && c->desktop != DESKTOP_ALL) if (c->desktop >= num && c->desktop != DESKTOP_ALL)
client_set_desktop(c, num - 1, FALSE); client_set_desktop(c, num - 1, FALSE);
@ -868,7 +868,7 @@ void screen_show_desktop(gboolean show)
if (show) { if (show) {
/* bottom to top */ /* bottom to top */
for (it = g_list_last(stacking_list); it != NULL; it = it->prev) { for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) {
if (WINDOW_IS_CLIENT(it->data)) { if (WINDOW_IS_CLIENT(it->data)) {
ObClient *client = it->data; ObClient *client = it->data;
if (client->frame->visible && !client_should_show(client)) if (client->frame->visible && !client_should_show(client))
@ -877,7 +877,7 @@ void screen_show_desktop(gboolean show)
} }
} else { } else {
/* top to bottom */ /* top to bottom */
for (it = stacking_list; it != NULL; it = it->next) { for (it = stacking_list; it; it = g_list_next(it)) {
if (WINDOW_IS_CLIENT(it->data)) { if (WINDOW_IS_CLIENT(it->data)) {
ObClient *client = it->data; ObClient *client = it->data;
if (!client->frame->visible && client_should_show(client)) if (!client->frame->visible && client_should_show(client))
@ -888,7 +888,7 @@ void screen_show_desktop(gboolean show)
if (show) { if (show) {
/* focus desktop */ /* focus desktop */
for (it = focus_order[screen_desktop]; it; it = it->next) for (it = focus_order[screen_desktop]; it; it = g_list_next(it))
if (((ObClient*)it->data)->type == OB_CLIENT_TYPE_DESKTOP && if (((ObClient*)it->data)->type == OB_CLIENT_TYPE_DESKTOP &&
client_focus(it->data)) client_focus(it->data))
break; break;
@ -1021,7 +1021,7 @@ void screen_update_areas()
o = MIN(o, area[i][x].x); o = MIN(o, area[i][x].x);
for (x = 0; x < screen_num_monitors; ++x) { for (x = 0; x < screen_num_monitors; ++x) {
for (it = client_list; it; it = it->next) { for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
screen_area_add_strut_left(&c->strut, screen_area_add_strut_left(&c->strut,
&monitor_area[x], &monitor_area[x],
@ -1043,7 +1043,7 @@ void screen_update_areas()
o = MIN(o, area[i][x].y); o = MIN(o, area[i][x].y);
for (x = 0; x < screen_num_monitors; ++x) { for (x = 0; x < screen_num_monitors; ++x) {
for (it = client_list; it; it = it->next) { for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
screen_area_add_strut_top(&c->strut, screen_area_add_strut_top(&c->strut,
&monitor_area[x], &monitor_area[x],
@ -1065,7 +1065,7 @@ void screen_update_areas()
o = MAX(o, area[i][x].x + area[i][x].width - 1); o = MAX(o, area[i][x].x + area[i][x].width - 1);
for (x = 0; x < screen_num_monitors; ++x) { for (x = 0; x < screen_num_monitors; ++x) {
for (it = client_list; it; it = it->next) { for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
screen_area_add_strut_right(&c->strut, screen_area_add_strut_right(&c->strut,
&monitor_area[x], &monitor_area[x],
@ -1090,7 +1090,7 @@ void screen_update_areas()
o = MAX(o, area[i][x].y + area[i][x].height - 1); o = MAX(o, area[i][x].y + area[i][x].height - 1);
for (x = 0; x < screen_num_monitors; ++x) { for (x = 0; x < screen_num_monitors; ++x) {
for (it = client_list; it; it = it->next) { for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
screen_area_add_strut_bottom(&c->strut, screen_area_add_strut_bottom(&c->strut,
&monitor_area[x], &monitor_area[x],
@ -1126,7 +1126,7 @@ void screen_update_areas()
/* the area has changed, adjust all the maximized /* the area has changed, adjust all the maximized
windows */ windows */
for (it = client_list; it; it = it->next) { for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
if (i < screen_num_desktops) { if (i < screen_num_desktops) {
if (c->desktop == i) if (c->desktop == i)

View file

@ -360,10 +360,11 @@ void stacking_add_nonintrusive(ObWindow *win)
GList *it; GList *it;
if (client->group) if (client->group)
for (it = stacking_list; !parent && it; it = it->next) { for (it = stacking_list; !parent && it; it = g_list_next(it)) {
if ((sit = g_slist_find(client->group->members, it->data))) if ((sit = g_slist_find(client->group->members, it->data)))
for (sit = client->group->members; !parent && sit; for (sit = client->group->members; !parent && sit;
sit = sit->next) { sit = g_slist_next(sit))
{
ObClient *c = sit->data; ObClient *c = sit->data;
/* checking transient_for prevents infinate loops! */ /* checking transient_for prevents infinate loops! */
if (sit->data == it->data && !c->transient_for) if (sit->data == it->data && !c->transient_for)