a window maps since its not based on an action from the user like
clicking a window to activate is. so keep the new window out of the way
but do focus it. */
- if (activate) client_focus(self);
+ if (activate) {
+ /* if using focus_delay, stop the timer now so that focus doesn't go
+ moving on us */
+ event_halt_focus_delay();
+
+ client_focus(self);
+ /* since focus can change the stacking orders, if we focus the window
+ then the standard raise it gets is not enough, we need to queue one
+ for after the focus change takes place */
+ client_raise(self);
+ }
/* client_activate does this but we aret using it so we have to do it
here as well */
client_get_mwm_hints(self);
client_get_type(self);/* this can change the mwmhints for special cases */
+ {
+ /* 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);
client_get_gravity(self); /* get the attribute gravity */
self->type = -1;
if (PROP_GETA32(self->window, net_wm_window_type, atom, &val, &num)) {
- /* use the first value that we know about in the array */
- for (i = 0; i < num; ++i) {
- if (val[i] == prop_atoms.net_wm_window_type_desktop)
- self->type = OB_CLIENT_TYPE_DESKTOP;
- else if (val[i] == prop_atoms.net_wm_window_type_dock)
- self->type = OB_CLIENT_TYPE_DOCK;
- else if (val[i] == prop_atoms.net_wm_window_type_toolbar)
- self->type = OB_CLIENT_TYPE_TOOLBAR;
- else if (val[i] == prop_atoms.net_wm_window_type_menu)
- self->type = OB_CLIENT_TYPE_MENU;
- else if (val[i] == prop_atoms.net_wm_window_type_utility)
- self->type = OB_CLIENT_TYPE_UTILITY;
- else if (val[i] == prop_atoms.net_wm_window_type_splash)
- self->type = OB_CLIENT_TYPE_SPLASH;
- else if (val[i] == prop_atoms.net_wm_window_type_dialog)
- self->type = OB_CLIENT_TYPE_DIALOG;
- else if (val[i] == prop_atoms.net_wm_window_type_normal)
- self->type = OB_CLIENT_TYPE_NORMAL;
- else if (val[i] == prop_atoms.kde_net_wm_window_type_override) {
- /* prevent this window from getting any decor or
- functionality */
- self->mwmhints.flags &= (OB_MWM_FLAG_FUNCTIONS |
- OB_MWM_FLAG_DECORATIONS);
- self->mwmhints.decorations = 0;
- self->mwmhints.functions = 0;
- }
- if (self->type != (ObClientType) -1)
- break; /* grab the first legit type */
- }
- g_free(val);
+ /* use the first value that we know about in the array */
+ for (i = 0; i < num; ++i) {
+ if (val[i] == prop_atoms.net_wm_window_type_desktop)
+ self->type = OB_CLIENT_TYPE_DESKTOP;
+ else if (val[i] == prop_atoms.net_wm_window_type_dock)
+ self->type = OB_CLIENT_TYPE_DOCK;
+ else if (val[i] == prop_atoms.net_wm_window_type_toolbar)
+ self->type = OB_CLIENT_TYPE_TOOLBAR;
+ else if (val[i] == prop_atoms.net_wm_window_type_menu)
+ self->type = OB_CLIENT_TYPE_MENU;
+ else if (val[i] == prop_atoms.net_wm_window_type_utility)
+ self->type = OB_CLIENT_TYPE_UTILITY;
+ else if (val[i] == prop_atoms.net_wm_window_type_splash)
+ self->type = OB_CLIENT_TYPE_SPLASH;
+ else if (val[i] == prop_atoms.net_wm_window_type_dialog)
+ self->type = OB_CLIENT_TYPE_DIALOG;
+ else if (val[i] == prop_atoms.net_wm_window_type_normal)
+ self->type = OB_CLIENT_TYPE_NORMAL;
+ else if (val[i] == prop_atoms.kde_net_wm_window_type_override) {
+ /* prevent this window from getting any decor or
+ functionality */
+ self->mwmhints.flags &= (OB_MWM_FLAG_FUNCTIONS |
+ OB_MWM_FLAG_DECORATIONS);
+ self->mwmhints.decorations = 0;
+ self->mwmhints.functions = 0;
+ }
+ if (self->type != (ObClientType) -1)
+ break; /* grab the first legit type */
+ }
+ g_free(val);
}
if (self->type == (ObClientType) -1) {
OB_FRAME_DECOR_ALLDESKTOPS |
OB_FRAME_DECOR_ICONIFY |
OB_FRAME_DECOR_MAXIMIZE |
- OB_FRAME_DECOR_SHADE);
+ OB_FRAME_DECOR_SHADE |
+ OB_FRAME_DECOR_CLOSE);
self->functions =
(OB_CLIENT_FUNC_RESIZE |
OB_CLIENT_FUNC_MOVE |
OB_CLIENT_FUNC_ICONIFY |
OB_CLIENT_FUNC_MAXIMIZE |
- OB_CLIENT_FUNC_SHADE);
- if (self->delete_window) {
- self->functions |= OB_CLIENT_FUNC_CLOSE;
- self->decorations |= OB_FRAME_DECOR_CLOSE;
- }
+ OB_CLIENT_FUNC_SHADE |
+ OB_CLIENT_FUNC_CLOSE);
if (!(self->min_size.width < self->max_size.width ||
self->min_size.height < self->max_size.height))
self->decorations &= ~OB_FRAME_DECOR_HANDLE;
/* finally, the user can have requested no decorations, which overrides
- everything */
+ everything (but doesnt give it a border if it doesnt have one) */
if (self->undecorated)
- self->decorations = OB_FRAME_DECOR_BORDER;
+ self->decorations &= OB_FRAME_DECOR_BORDER;
/* if we don't have a titlebar, then we cannot shade! */
if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR))
if (self->frame) {
/* adjust the client's decorations, etc. */
client_reconfigure(self);
- } else {
- /* this makes sure that these windows appear on all desktops */
- if (self->type == OB_CLIENT_TYPE_DESKTOP &&
- self->desktop != DESKTOP_ALL)
- {
- self->desktop = DESKTOP_ALL;
- }
}
}
actions[num++] = prop_atoms.net_wm_action_change_desktop;
if (self->functions & OB_CLIENT_FUNC_SHADE)
- actions[num++] = prop_atoms.net_wm_action_shade;
+ actions[num++] = prop_atoms.net_wm_action_shade;
if (self->functions & OB_CLIENT_FUNC_CLOSE)
- actions[num++] = prop_atoms.net_wm_action_close;
+ actions[num++] = prop_atoms.net_wm_action_close;
if (self->functions & OB_CLIENT_FUNC_MOVE)
- actions[num++] = prop_atoms.net_wm_action_move;
+ actions[num++] = prop_atoms.net_wm_action_move;
if (self->functions & OB_CLIENT_FUNC_ICONIFY)
- actions[num++] = prop_atoms.net_wm_action_minimize;
+ actions[num++] = prop_atoms.net_wm_action_minimize;
if (self->functions & OB_CLIENT_FUNC_RESIZE)
- actions[num++] = prop_atoms.net_wm_action_resize;
+ actions[num++] = prop_atoms.net_wm_action_resize;
if (self->functions & OB_CLIENT_FUNC_FULLSCREEN)
- actions[num++] = prop_atoms.net_wm_action_fullscreen;
+ actions[num++] = prop_atoms.net_wm_action_fullscreen;
if (self->functions & OB_CLIENT_FUNC_MAXIMIZE) {
- actions[num++] = prop_atoms.net_wm_action_maximize_horz;
- actions[num++] = prop_atoms.net_wm_action_maximize_vert;
+ actions[num++] = prop_atoms.net_wm_action_maximize_horz;
+ actions[num++] = prop_atoms.net_wm_action_maximize_vert;
}
PROP_SETA32(self->window, net_wm_allowed_actions, atom, actions, num);
/* make sure the window isn't breaking any rules now */
if (!(self->functions & OB_CLIENT_FUNC_SHADE) && self->shaded) {
- if (self->frame) client_shade(self, FALSE);
- else self->shaded = FALSE;
+ if (self->frame) client_shade(self, FALSE);
+ else self->shaded = FALSE;
}
if (!(self->functions & OB_CLIENT_FUNC_ICONIFY) && self->iconic) {
- if (self->frame) client_iconify(self, FALSE, TRUE);
- else self->iconic = FALSE;
+ if (self->frame) client_iconify(self, FALSE, TRUE);
+ else self->iconic = FALSE;
}
if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) && self->fullscreen) {
- if (self->frame) client_fullscreen(self, FALSE, TRUE);
- else self->fullscreen = FALSE;
+ if (self->frame) client_fullscreen(self, FALSE, TRUE);
+ else self->fullscreen = FALSE;
}
if (!(self->functions & OB_CLIENT_FUNC_MAXIMIZE) && (self->max_horz ||
self->max_vert)) {
- if (self->frame) client_maximize(self, FALSE, 0, TRUE);
- else self->max_vert = self->max_horz = FALSE;
+ if (self->frame) client_maximize(self, FALSE, 0, TRUE);
+ else self->max_vert = self->max_horz = FALSE;
}
}
/* try netwm */
if (!PROP_GETS(self->window, net_wm_name, utf8, &data))
- /* try old x stuff */
- if (!PROP_GETS(self->window, wm_name, locale, &data))
- data = g_strdup("Unnamed Window");
+ /* try old x stuff */
+ if (!PROP_GETS(self->window, wm_name, locale, &data))
+ data = g_strdup("Unnamed Window");
/* did the title change? then reset the title_count */
if (old_title && 0 != strncmp(old_title, data, strlen(data)))
self->title = data;
if (self->frame)
- frame_adjust_title(self->frame);
+ frame_adjust_title(self->frame);
g_free(old_title);
gboolean client_normal(ObClient *self) {
return ! (self->type == OB_CLIENT_TYPE_DESKTOP ||
self->type == OB_CLIENT_TYPE_DOCK ||
- self->type == OB_CLIENT_TYPE_SPLASH);
+ self->type == OB_CLIENT_TYPE_SPLASH);
}
static void client_apply_startup_state(ObClient *self)
if (!(self->functions & OB_CLIENT_FUNC_CLOSE)) return;
+ /* in the case that the client provides no means to requesting that it
+ close, we just kill it */
+ if (!self->delete_window)
+ client_kill(self);
+
/*
XXX: itd be cool to do timeouts and shit here for killing the client's
process off
}
return ret;
}
+
+gboolean client_has_group_siblings(ObClient *self)
+{
+ return self->group && self->group->members->next;
+}