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;
}
/*
- void client_foreach_transient(ObClient *self, ObClientForeachFunc func, void *data)
+ void client_foreach_transient(ObClient *self, ObClientForeachFunc func, gpointer data)
{
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);
}
}
- void client_foreach_ancestor(ObClient *self, ObClientForeachFunc func, void *data)
+ void client_foreach_ancestor(ObClient *self, ObClientForeachFunc func, gpointer data)
{
if (self->transient_for) {
if (self->transient_for != OB_TRAN_GROUP) {
} 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;
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))
{
keyboard_grab_for_client(self, FALSE);
mouse_grab_for_client(self, FALSE);
+ /* potentially fix focusLast */
+ if (config_focus_last)
+ grab_pointer(TRUE, OB_CURSOR_NONE);
+
/* remove the window from our save set */
XChangeSaveSet(ob_display, self->window, SetModeDelete);
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);
/* update the list hints */
client_set_list();
+
+ if (config_focus_last)
+ grab_pointer(FALSE, OB_CURSOR_NONE);
}
static void client_urgent_notify(ObClient *self)
client_get_mwm_hints(self);
client_get_type(self);/* this can change the mwmhints for special cases */
+ /* The transient hint is used to pick a type, but the type can also affect
+ transiency (dialogs are always made transients). This is Havoc's idea,
+ but it is needed to make some apps work right (eg tsclient). */
+ client_update_transient_for(self);
+
client_get_state(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;
}
}
}
+ } else if (self->type == OB_CLIENT_TYPE_DIALOG && self->group) {
+ self->transient = TRUE;
+ target = OB_TRAN_GROUP;
} else
self->transient = FALSE;
/* finally, the user can have requested no decorations, which overrides
everything (but doesnt give it a border if it doesnt have one) */
if (self->undecorated)
- self->decorations &= OB_FRAME_DECOR_BORDER;
+ self->decorations = 0; //&= OB_FRAME_DECOR_BORDER;
/* if we don't have a titlebar, then we cannot shade! */
if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR))
/* 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)))
data = vdata;
}
+ // http://developer.gnome.org/projects/gup/hig/draft_hig_new/windows-alert.html
+ if (self->transient)
+ data = '\0';
+ else
+ data = g_strdup("Unnamed Window");
+
PROP_SETS(self->window, net_wm_visible_icon_name, data);
self->icon_title = 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)))
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);
w -= self->base_size.width;
h -= self->base_size.height;
- if (self->min_ratio)
- if (h * self->min_ratio > w) {
- h = (gint)(w / self->min_ratio);
+ if (!self->fullscreen) {
+ if (self->min_ratio)
+ if (h * self->min_ratio > w) {
+ h = (gint)(w / self->min_ratio);
- /* you cannot resize to nothing */
- if (h < 1) {
- h = 1;
- w = (gint)(h * self->min_ratio);
+ /* you cannot resize to nothing */
+ if (h < 1) {
+ h = 1;
+ w = (gint)(h * self->min_ratio);
+ }
}
- }
- if (self->max_ratio)
- if (h * self->max_ratio < w) {
- h = (gint)(w / self->max_ratio);
-
- /* you cannot resize to nothing */
- if (h < 1) {
- h = 1;
- w = (gint)(h * self->min_ratio);
+ if (self->max_ratio)
+ if (h * self->max_ratio < w) {
+ h = (gint)(w / self->max_ratio);
+
+ /* you cannot resize to nothing */
+ if (h < 1) {
+ h = 1;
+ w = (gint)(h * self->min_ratio);
+ }
}
- }
+ }
w += self->base_size.width;
h += self->base_size.height;
resizing in redraw mode */
send_resize_client = ((!user && resized) ||
(user && (final ||
- (resized && config_redraw_resize))));
+ (resized && config_resize_redraw))));
- /* if the client is enlarging, the resize the client before the frame */
+ /* if the client is enlarging, then resize the client before the frame */
if (send_resize_client && user && (w > oldw || h > oldh))
XResizeWindow(ob_display, self->window, MAX(w, oldw), MAX(h, oldh));
}
/* 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;
void client_lower(ObClient *self)
{
- action_run_string("Raise", self);
+ action_run_string("Lower", self);
}
gboolean client_focused(ObClient *self)
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 &&