a bunch of thigns got squashed into this commit.. sorry..

1. soem bug fixes for window stacking
2. clarify some functions behavior with their names
3. add (untested) support for legacy fullscreen apps. i have no idea what they do on a multihead xinerama setup though and if this would help there or need some changes.
This commit is contained in:
Dana Jansens 2007-05-06 08:32:03 +00:00
parent 007e62fa77
commit 277db2822d
6 changed files with 72 additions and 27 deletions

View file

@ -90,6 +90,9 @@ static void client_update_transient_tree(ObClient *self,
ObClient* oldparent, ObClient* oldparent,
ObClient *newparent); ObClient *newparent);
static void client_present(ObClient *self, gboolean here, gboolean raise); static void client_present(ObClient *self, gboolean here, gboolean raise);
static GSList *client_search_all_top_parents_internal(ObClient *self,
gboolean bylayer,
ObStackingLayer layer);
void client_startup(gboolean reconfig) void client_startup(gboolean reconfig)
{ {
@ -2180,7 +2183,14 @@ static ObStackingLayer calc_layer(ObClient *self)
{ {
ObStackingLayer l; ObStackingLayer l;
if (self->fullscreen && if ((self->fullscreen ||
/* no decorations and fills the monitor means oldskool fullscreen */
(self->frame != NULL &&
(self->frame->size.top == 0 && self->frame->size.left == 0 &&
self->frame->size.bottom == 0 && self->frame->size.right == 0 &&
RECT_EQUAL(self->area,
*screen_physical_area_monitor(client_monitor(self))))))
&&
(client_focused(self) || client_search_focus_tree(self))) (client_focused(self) || client_search_focus_tree(self)))
l = OB_STACKING_LAYER_FULLSCREEN; l = OB_STACKING_LAYER_FULLSCREEN;
else if (self->type == OB_CLIENT_TYPE_DESKTOP) else if (self->type == OB_CLIENT_TYPE_DESKTOP)
@ -2765,7 +2775,7 @@ static void client_iconify_recursive(ObClient *self,
void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk) void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk)
{ {
/* move up the transient chain as far as possible first */ /* move up the transient chain as far as possible first */
self = client_search_top_parent(self); self = client_search_top_normal_parent(self);
client_iconify_recursive(self, iconic, curdesk); client_iconify_recursive(self, iconic, curdesk);
} }
@ -2960,7 +2970,7 @@ void client_set_desktop_recursive(ObClient *self,
void client_set_desktop(ObClient *self, guint target, gboolean donthide) void client_set_desktop(ObClient *self, guint target, gboolean donthide)
{ {
self = client_search_top_parent(self); self = client_search_top_normal_parent(self);
client_set_desktop_recursive(self, target, donthide); client_set_desktop_recursive(self, target, donthide);
} }
@ -3451,20 +3461,24 @@ guint client_monitor(ObClient *self)
return screen_find_monitor(&self->frame->area); return screen_find_monitor(&self->frame->area);
} }
ObClient *client_search_top_parent(ObClient *self) ObClient *client_search_top_normal_parent(ObClient *self)
{ {
while (self->transient_for && self->transient_for != OB_TRAN_GROUP && while (self->transient_for && self->transient_for != OB_TRAN_GROUP &&
client_normal(self)) client_normal(self->transient_for))
self = self->transient_for; self = self->transient_for;
return self; return self;
} }
GSList *client_search_all_top_parents(ObClient *self) static GSList *client_search_all_top_parents_internal(ObClient *self,
gboolean bylayer,
ObStackingLayer layer)
{ {
GSList *ret = NULL; GSList *ret = NULL;
/* move up the direct transient chain as far as possible */ /* move up the direct transient chain as far as possible */
while (self->transient_for && self->transient_for != OB_TRAN_GROUP) while (self->transient_for && self->transient_for != OB_TRAN_GROUP &&
(!bylayer || self->transient_for->layer == layer) &&
client_normal(self->transient_for))
self = self->transient_for; self = self->transient_for;
if (!self->transient_for) if (!self->transient_for)
@ -3477,9 +3491,12 @@ GSList *client_search_all_top_parents(ObClient *self)
for (it = self->group->members; it; it = g_slist_next(it)) { for (it = self->group->members; it; it = g_slist_next(it)) {
ObClient *c = it->data; ObClient *c = it->data;
if (!c->transient_for && client_normal(c)) if (!c->transient_for && client_normal(c) &&
(!bylayer || c->layer == layer))
{
ret = g_slist_prepend(ret, c); ret = g_slist_prepend(ret, c);
} }
}
if (ret == NULL) /* no group parents */ if (ret == NULL) /* no group parents */
ret = g_slist_prepend(ret, self); ret = g_slist_prepend(ret, self);
@ -3488,6 +3505,16 @@ GSList *client_search_all_top_parents(ObClient *self)
return ret; return ret;
} }
GSList *client_search_all_top_parents(ObClient *self)
{
return client_search_all_top_parents_internal(self, FALSE, 0);
}
GSList *client_search_all_top_parents_layer(ObClient *self)
{
return client_search_all_top_parents_internal(self, TRUE, self->layer);
}
ObClient *client_search_focus_parent(ObClient *self) ObClient *client_search_focus_parent(ObClient *self)
{ {
if (self->transient_for) { if (self->transient_for) {

View file

@ -634,10 +634,17 @@ ObClient *client_search_modal_child(ObClient *self);
*/ */
GSList *client_search_all_top_parents(ObClient *self); GSList *client_search_all_top_parents(ObClient *self);
/*! Returns a list of top-level windows which this is a transient for, and
which are in the same layer as this client.
It will only contain more than 1 element if the client is transient for its
group.
*/
GSList *client_search_all_top_parents_layer(ObClient *self);
/*! Returns a window's top level parent. This only counts direct parents, /*! Returns a window's top level parent. This only counts direct parents,
not groups if it is transient for its group. not groups if it is transient for its group.
*/ */
ObClient *client_search_top_parent(ObClient *self); ObClient *client_search_top_normal_parent(ObClient *self);
/*! Is one client a direct child of another (i.e. not through the group.) */ /*! Is one client a direct child of another (i.e. not through the group.) */
gboolean client_is_direct_child(ObClient *parent, ObClient *child); gboolean client_is_direct_child(ObClient *parent, ObClient *child);

View file

@ -306,12 +306,14 @@ static void popup_cycle(ObClient *c, gboolean show)
icon_popup_width(focus_cycle_popup, MAX(a->width/3, POPUP_WIDTH)); icon_popup_width(focus_cycle_popup, MAX(a->width/3, POPUP_WIDTH));
icon_popup_height(focus_cycle_popup, POPUP_HEIGHT); icon_popup_height(focus_cycle_popup, POPUP_HEIGHT);
/* use the transient's parent's title/icon */ /* find our highest direct parent, including non-normal windows */
p = client_search_top_parent(c); for (p = c; p->transient_for && p->transient_for != OB_TRAN_GROUP;
p = p->transient_for);
if (c->desktop != DESKTOP_ALL && c->desktop != screen_desktop) if (c->desktop != DESKTOP_ALL && c->desktop != screen_desktop)
desk = screen_desktop_names[c->desktop]; desk = screen_desktop_names[c->desktop];
/* use the transient's parent's title/icon if we don't have one */
if (p != c && !strcmp("", (c->iconic ? c->icon_title : c->title))) if (p != c && !strcmp("", (c->iconic ? c->icon_title : c->title)))
title = g_strdup(p->iconic ? p->icon_title : p->title); title = g_strdup(p->iconic ? p->icon_title : p->title);
/*ptitle = g_strconcat((c->iconic ? c->icon_title : c->title), /*ptitle = g_strconcat((c->iconic ? c->icon_title : c->title),

View file

@ -379,19 +379,27 @@ gint main(gint argc, gchar **argv)
} }
/* we remove the session arguments from argv, so put them back */ /* we remove the session arguments from argv, so put them back */
if (ob_sm_save_file != NULL || ob_sm_id != NULL) {
gchar **nargv;
gint i, l;
l = argc +
(ob_sm_save_file != NULL ? 2 : 0) +
(ob_sm_id != NULL ? 2 : 0);
nargv = g_new0(gchar*, l+1);
for (i = 0; i < argc; ++i)
nargv[i] = argv[i];
if (ob_sm_save_file != NULL) { if (ob_sm_save_file != NULL) {
guint l = g_strv_length(argv); nargv[i++] = g_strdup("--sm-save-file");
argv = g_renew(gchar*, argv, l+2); nargv[i++] = ob_sm_save_file;
argv[l] = g_strdup("--sm-save-file");
argv[l+1] = ob_sm_save_file;
argv[l+2] = NULL;
} }
if (ob_sm_id != NULL) { if (ob_sm_id != NULL) {
guint l = g_strv_length(argv); nargv[i++] = g_strdup("--sm-client-id");
argv = g_renew(gchar*, argv, l+2); nargv[i++] = ob_sm_id;
argv[l] = g_strdup("--sm-client-id"); }
argv[l+1] = ob_sm_id; g_assert(i == l);
argv[l+2] = NULL; argv = nargv;
} }
/* re-run me */ /* re-run me */

View file

@ -358,6 +358,7 @@ static void sm_save_yourself(SmcConn conn, SmPointer data, gint save_type,
Bool shutdown, gint interact_style, Bool fast) Bool shutdown, gint interact_style, Bool fast)
{ {
ob_debug_type(OB_DEBUG_SM, "Session save requested\n"); ob_debug_type(OB_DEBUG_SM, "Session save requested\n");
if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_2, data)) { if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_2, data)) {
ob_debug_type(OB_DEBUG_SM, "Requst for phase 2 failed\n"); ob_debug_type(OB_DEBUG_SM, "Requst for phase 2 failed\n");
SmcSaveYourselfDone(conn, FALSE); SmcSaveYourselfDone(conn, FALSE);

View file

@ -174,7 +174,7 @@ static void restack_windows(ObClient *selected, gboolean raise)
/* if it's a transient lowering, lower its parents so that we can lower /* if it's a transient lowering, lower its parents so that we can lower
this window, or it won't move */ this window, or it won't move */
top = client_search_all_top_parents(selected); top = client_search_all_top_parents_layer(selected);
/* that is, if it has any parents */ /* that is, if it has any parents */
if (!(top->data == selected && top->next == NULL)) { if (!(top->data == selected && top->next == NULL)) {
@ -375,7 +375,7 @@ static GList *find_highest_relative(ObClient *client)
GSList *top; GSList *top;
/* get all top level relatives of this client */ /* get all top level relatives of this client */
top = client_search_all_top_parents(client); top = client_search_all_top_parents_layer(client);
/* go from the top of the stacking order down */ /* go from the top of the stacking order down */
for (it = stacking_list; !ret && it; it = g_list_next(it)) { for (it = stacking_list; !ret && it; it = g_list_next(it)) {