static void client_get_area(ObClient *self);
static void client_get_desktop(ObClient *self);
static void client_get_state(ObClient *self);
-static void client_get_layer(ObClient *self);
static void client_get_shaped(ObClient *self);
static void client_get_mwm_hints(ObClient *self);
static void client_get_colormap(ObClient *self);
/* non-zero defaults */
self->wmstate = WithdrawnState; /* make sure it gets updated first time */
- self->layer = -1;
self->desktop = screen_num_desktops; /* always an invalid value */
self->user_time = focus_client ? focus_client->user_time : CurrentTime;
/* the session should get the last say */
client_restore_session_state(self);
- client_calc_layer(self);
+ client_setup_decor_and_functions(self);
{
Time t = sn_app_started(self->startup_id, self->class);
grab_server(FALSE);
- stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
+ /* do this to add ourselves to the stacking list in a non-intrusive way */
+ client_calc_layer(self);
/* focus the new window? */
if (ob_state() != OB_STATE_STARTING &&
uses too */
settings = client_get_settings_state(self);
- /* create the decoration frame for the client window */
+ client_setup_decor_and_functions(self);
+
+ /* create the decoration frame for the client window and adjust its size */
self->frame = frame_new(self);
+ frame_adjust_area(self->frame, FALSE, TRUE, TRUE);
return self;
}
/* this can change the mwmhints for special cases */
client_get_type_and_transientness(self);
client_get_state(self);
- client_update_protocols(self);
client_update_normal_hints(self);
- /* got the type, the mwmhints, the protocols, and the normal hints
- (min/max sizes), so we're ready to set up the decorations/functions */
- client_setup_decor_and_functions(self);
+ /* get the session related properties, these can change decorations
+ from per-app settings */
+ client_get_session_ids(self);
- if (real) {
- client_update_wmhints(self);
- /* this may have already been called from client_update_wmhints */
- if (self->transient_for == NULL)
- client_update_transient_for(self);
+ /* now we got everything that can affect the decorations */
+ if (!real)
+ return;
- client_get_startup_id(self);
- client_get_desktop(self);/* uses transient data/group/startup id if a
- desktop is not specified */
- client_get_shaped(self);
+ client_update_protocols(self);
- client_get_layer(self); /* if layer hasn't been specified, get it from
- other sources if possible */
+ client_update_wmhints(self);
+ /* this may have already been called from client_update_wmhints */
+ if (self->transient_for == NULL)
+ client_update_transient_for(self);
- {
- /* a couple type-based defaults for new windows */
+ client_get_startup_id(self);
+ client_get_desktop(self);/* uses transient data/group/startup id if a
+ desktop is not specified */
+ client_get_shaped(self);
- /* this makes sure that these windows appear on all desktops */
- if (self->type == OB_CLIENT_TYPE_DESKTOP)
- self->desktop = DESKTOP_ALL;
- }
+ {
+ /* 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;
+ }
#ifdef SYNC
- client_update_sync_request_counter(self);
+ client_update_sync_request_counter(self);
#endif
- /* get the session related properties */
- client_get_session_ids(self);
-
- client_get_colormap(self);
- client_update_title(self);
- client_update_strut(self);
- client_update_icons(self);
- client_update_user_time_window(self);
- if (!self->user_time_window) /* check if this would have been called */
- client_update_user_time(self);
- client_update_icon_geometry(self);
- }
+ client_get_colormap(self);
+ client_update_title(self);
+ client_update_strut(self);
+ client_update_icons(self);
+ client_update_user_time_window(self);
+ if (!self->user_time_window) /* check if this would have been called */
+ client_update_user_time(self);
+ client_update_icon_geometry(self);
}
static void client_get_startup_id(ObClient *self)
}
}
-static void client_get_layer(ObClient *self)
-{
- if (!(self->above || self->below)) {
- if (self->group) {
- /* apply stuff from the group */
- GSList *it;
- gint layer = -2;
-
- for (it = self->group->members; it; it = g_slist_next(it)) {
- ObClient *c = it->data;
- if (c != self && !client_search_transient(self, c) &&
- client_normal(self) && client_normal(c))
- {
- layer = MAX(layer,
- (c->above ? 1 : (c->below ? -1 : 0)));
- }
- }
- switch (layer) {
- case -1:
- self->below = TRUE;
- break;
- case -2:
- case 0:
- break;
- case 1:
- self->above = TRUE;
- break;
- default:
- g_assert_not_reached();
- break;
- }
- }
- }
-}
-
static void client_get_state(ObClient *self)
{
guint32 *state;
else self->shaded = FALSE;
}
if (!(self->functions & OB_CLIENT_FUNC_ICONIFY) && self->iconic) {
- if (self->frame) client_iconify(self, FALSE, TRUE);
+ if (self->frame) client_iconify(self, FALSE, TRUE, FALSE);
else self->iconic = FALSE;
}
if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) && self->fullscreen) {
}
static void client_calc_layer_recursive(ObClient *self, ObClient *orig,
- ObStackingLayer min, gboolean raised)
+ ObStackingLayer min)
{
ObStackingLayer old, own;
GSList *it;
own = calc_layer(self);
self->layer = MAX(own, min);
+ if (self->layer != old) {
+ stacking_remove(CLIENT_AS_WINDOW(self));
+ stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
+ }
+
for (it = self->transients; it; it = g_slist_next(it))
client_calc_layer_recursive(it->data, orig,
- self->layer,
- raised ? raised : self->layer > old);
-
- /* restack. but only if the original window is managed.
-
- raised is used so that only the bottom-most window in the stacking
- order is raised, the others will automatically come with it.
-
- also only the highest windows in the stacking order (no transients)
- are lowered, cuz the rest come for free
- */
- if (!raised && orig->frame) {
- if (self->layer > old) {
- stacking_remove(CLIENT_AS_WINDOW(self));
- stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
- } else if (self->layer < old && self->transients == NULL) {
- stacking_remove(CLIENT_AS_WINDOW(self));
- stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
- }
- }
+ self->layer);
}
void client_calc_layer(ObClient *self)
it = client_search_all_top_parents(self);
for (; it; it = g_slist_next(it))
- client_calc_layer_recursive(it->data, orig, 0, FALSE);
+ client_calc_layer_recursive(it->data, orig, 0);
}
gboolean client_should_show(ObClient *self)
if (self->iconic) {
self->iconic = FALSE;
- client_iconify(self, TRUE, FALSE);
+ client_iconify(self, TRUE, FALSE, TRUE);
}
if (self->fullscreen) {
self->fullscreen = FALSE;
}
static void client_iconify_recursive(ObClient *self,
- gboolean iconic, gboolean curdesk)
+ gboolean iconic, gboolean curdesk,
+ gboolean hide_animation)
{
GSList *it;
gboolean changed = FALSE;
if (changed) {
client_change_state(self);
- if (ob_state() != OB_STATE_STARTING && config_animate_iconify)
+ if (config_animate_iconify && !hide_animation)
frame_begin_iconify_animation(self->frame, iconic);
/* do this after starting the animation so it doesn't flash */
client_showhide(self);
for (it = self->transients; it; it = g_slist_next(it))
if (it->data != self)
if (client_is_direct_child(self, it->data) || !iconic)
- client_iconify_recursive(it->data, iconic, curdesk);
+ client_iconify_recursive(it->data, iconic, curdesk,
+ hide_animation);
}
-void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk)
+void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk,
+ gboolean hide_animation)
{
if (self->functions & OB_CLIENT_FUNC_ICONIFY || !iconic) {
/* move up the transient chain as far as possible first */
self = client_search_top_normal_parent(self);
- client_iconify_recursive(self, iconic, curdesk);
+ client_iconify_recursive(self, iconic, curdesk, hide_animation);
}
}
switch (state) {
case IconicState:
- client_iconify(self, TRUE, TRUE);
+ client_iconify(self, TRUE, TRUE, FALSE);
break;
case NormalState:
- client_iconify(self, FALSE, TRUE);
+ client_iconify(self, FALSE, TRUE, FALSE);
break;
}
}
stacking_raise(CLIENT_AS_WINDOW(self));
}
if (iconic != self->iconic)
- client_iconify(self, iconic, FALSE);
+ client_iconify(self, iconic, FALSE, FALSE);
if (demands_attention != self->demands_attention)
client_hilite(self, demands_attention);
event_halt_focus_delay();
if (client_normal(self) && screen_showing_desktop)
- screen_show_desktop(FALSE, FALSE);
+ screen_show_desktop(FALSE, self);
if (self->iconic)
- client_iconify(self, FALSE, here);
+ client_iconify(self, FALSE, here, FALSE);
if (self->desktop != DESKTOP_ALL &&
self->desktop != screen_desktop)
{