client: Improve handling of transient windows.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Maarten Maathuis 2008-12-04 15:16:38 +01:00 committed by Julien Danjou
parent 49258e7805
commit 0aba4013e9
2 changed files with 27 additions and 8 deletions

View File

@ -441,7 +441,7 @@ void
client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, int screen) client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, int screen)
{ {
xcb_get_property_cookie_t ewmh_icon_cookie; xcb_get_property_cookie_t ewmh_icon_cookie;
client_t *c, *group = NULL; client_t *c, *tc = NULL, *group = NULL;
image_t *icon; image_t *icon;
const uint32_t select_input_val[] = const uint32_t select_input_val[] =
{ {
@ -486,8 +486,10 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
property_update_wm_transient_for(c, NULL); property_update_wm_transient_for(c, NULL);
property_update_wm_client_leader(c, NULL); property_update_wm_client_leader(c, NULL);
if(c->transient_for) /* Recursively find the parent. */
screen = c->transient_for->screen; for(tc = c; tc->transient_for; tc = tc->transient_for);
if(tc != c)
screen = tc->screen;
/* Try to load props, if it fails check for group windows. /* Try to load props, if it fails check for group windows.
* transient_for windows are excluded, because they inherit the parent tags. */ * transient_for windows are excluded, because they inherit the parent tags. */
@ -516,7 +518,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
if (!c->issticky) if (!c->issticky)
{ {
if(c->transient_for) if(c->transient_for)
client_duplicate_tags(c->transient_for, c); client_duplicate_tags(tc, c);
else if (group) else if (group)
client_duplicate_tags(group, c); client_duplicate_tags(group, c);
else else

View File

@ -79,9 +79,23 @@ DO_SLIST(client_t, client, client_unref)
static inline void static inline void
client_raise(client_t *c) client_raise(client_t *c)
{ {
client_t *tc = c;
int counter = 0;
/* Find number of transient layers. */
for(counter = 0; tc->transient_for; counter++)
tc = tc->transient_for;
/* Push them in reverse order. */
for(; counter > 0; counter--)
{
tc = c;
for(int i = 0; i < counter; i++)
tc = tc->transient_for;
stack_client_push(tc);
}
/* Push c on top of the stack. */ /* Push c on top of the stack. */
if(c->transient_for)
stack_client_push(c->transient_for);
stack_client_push(c); stack_client_push(c);
client_stack(); client_stack();
} }
@ -93,8 +107,11 @@ static inline void
client_lower(client_t *c) client_lower(client_t *c)
{ {
stack_client_append(c); stack_client_append(c);
if(c->transient_for)
stack_client_append(c->transient_for); /* Traverse all transient layers. */
for(client_t *tc = c->transient_for; tc; tc = tc->transient_for)
stack_client_append(tc);
client_stack(); client_stack();
} }