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:
parent
49258e7805
commit
0aba4013e9
10
client.c
10
client.c
|
@ -441,7 +441,7 @@ void
|
|||
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;
|
||||
client_t *c, *group = NULL;
|
||||
client_t *c, *tc = NULL, *group = NULL;
|
||||
image_t *icon;
|
||||
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_client_leader(c, NULL);
|
||||
|
||||
if(c->transient_for)
|
||||
screen = c->transient_for->screen;
|
||||
/* Recursively find the parent. */
|
||||
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.
|
||||
* 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->transient_for)
|
||||
client_duplicate_tags(c->transient_for, c);
|
||||
client_duplicate_tags(tc, c);
|
||||
else if (group)
|
||||
client_duplicate_tags(group, c);
|
||||
else
|
||||
|
|
25
client.h
25
client.h
|
@ -79,9 +79,23 @@ DO_SLIST(client_t, client, client_unref)
|
|||
static inline void
|
||||
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. */
|
||||
if(c->transient_for)
|
||||
stack_client_push(c->transient_for);
|
||||
stack_client_push(c);
|
||||
client_stack();
|
||||
}
|
||||
|
@ -93,8 +107,11 @@ static inline void
|
|||
client_lower(client_t *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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue