if (size > 0) {
windows = g_new(Window, size);
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;
} else
windows = NULL;
{
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;
client_foreach_transient(it->data, func, data);
}
} else {
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 &&
!((ObClient*)it->data)->transient_for) {
if (!func(it->data, data)) return;
sn_app_started(self->class);
+ /* update the focus lists, do this before the call to change_state or
+ it can end up in the list twice! */
+ focus_order_add_new(self);
+
client_change_state(self);
/* remove the client's border (and adjust re gravity) */
client_apply_startup_state(self);
- /* update the focus lists */
- focus_order_add_new(self);
-
stacking_add(CLIENT_AS_WINDOW(self));
client_restore_session_stacking(self);
if (self->group) {
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 (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
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)
((ObClient*)it->data)->transients =
g_slist_remove(((ObClient*)it->data)->transients, self);
}
/* 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) {
((ObClient*)it->data)->transient_for = NULL;
client_calc_layer(it->data);
client_update_wmhints(self);
client_get_startup_id(self);
client_get_desktop(self);
- client_get_state(self);
client_get_shaped(self);
client_get_mwm_hints(self);
client_get_type(self);/* this can change the mwmhints for special cases */
+ client_get_state(self);
+
{
/* a couple type-based defaults for new windows */
/* this makes sure that these windows appear on all desktops */
if (self->type == OB_CLIENT_TYPE_DESKTOP)
self->desktop = DESKTOP_ALL;
-
- /* dock windows default to ABOVE */
- if (self->type == OB_CLIENT_TYPE_DOCK && !self->below)
- self->above = TRUE;
}
client_update_protocols(self);
} else {
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 &&
!((ObClient*)it->data)->transient_for) {
self->desktop = ((ObClient*)it->data)->desktop;
for (it = self->group->members; it; it = g_slist_next(it)) {
ObClient *c = it->data;
- if (c != self && !client_search_transient(self, c))
+ if (c != self && !client_search_transient(self, c) &&
+ client_normal(self) && client_normal(c))
{
layer = MAX(layer,
(c->above ? 1 : (c->below ? -1 : 0)));
/* remove from the old group if there was one */
if (self->group != NULL) {
/* 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,
it->data);
/* remove myself from parents in the 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;
if (c != self && !c->transient_for)
if (!self->transient_for) {
/* add other transients of the group that are already
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;
if (c != self && c->transient_for == OB_TRAN_GROUP)
self->transients =
/* look for duplicates and append a number */
nums = 0;
- for (it = client_list; it; it = it->next)
+ for (it = client_list; it; it = g_list_next(it))
if (it->data != self) {
ObClient *c = it->data;
if (0 == strncmp(c->title, data, strlen(data)))
GSList *it;
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 ((ret = client_search_focus_tree(it->data))) return ret;
}
GSList *it;
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) {
ObClient *c;
if ((c = client_search_focus_tree_full(it->data)))
else if (self->type == OB_CLIENT_TYPE_DOCK) {
if (self->above) l = OB_STACKING_LAYER_DOCK_ABOVE;
else if (self->below) l = OB_STACKING_LAYER_DOCK_BELOW;
- else l = OB_STACKING_LAYER_NORMAL;
+ else l = OB_STACKING_LAYER_DOCK_NORMAL;
}
else if (self->above) l = OB_STACKING_LAYER_ABOVE;
else if (self->below) l = OB_STACKING_LAYER_BELOW;
own = calc_layer(self);
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,
l, raised ? raised : l != old);
}
/* 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,
iconic, curdesk);
}
}
/* 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,
target, donthide);
}
GSList *it;
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;
if ((ret = client_search_modal_child(c))) return ret;
if (c->modal) return c;
fullscreen = TRUE;
} else if (state == prop_atoms.net_wm_state_above) {
self->above = TRUE;
+ self->below = FALSE;
} else if (state == prop_atoms.net_wm_state_below) {
+ self->above = FALSE;
self->below = TRUE;
} else if (state == prop_atoms.ob_wm_state_undecorated) {
undecorated = TRUE;
best_score = -1;
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;
/* the currently selected window isn't interesting */
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;
/* checking transient_for prevents infinate loops! */
} else {
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;
/* checking transient_for prevents infinate loops! */
} else {
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;
/* checking transient_for prevents infinate loops! */
/* default: top of screen */
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;
ObClient *cur = it->data;
/* default: bottom of screen */
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;
ObClient *cur = it->data;
/* default: leftmost egde of screen */
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;
ObClient *cur = it->data;
/* default: rightmost edge of screen */
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;
ObClient *cur = it->data;
ObClient *ret = NULL;
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)) {
ObClient *c = WINDOW_AS_CLIENT(it->data);
if (c->frame->visible &&