void
property_update_wm_transient_for(client_t *c, xcb_get_property_cookie_t cookie)
{
    xcb_window_t trans;
    int counter;
    client_t *tc, *tmp;

    if(!xcb_icccm_get_wm_transient_for_reply(globalconf.connection,
					     cookie,
					     &trans, NULL))
            return;

    tmp = tc = client_getbywin(trans);

    luaA_object_push(globalconf.L, c);
    client_set_type(globalconf.L, -1, WINDOW_TYPE_DIALOG);
    client_set_above(globalconf.L, -1, false);

    /* Verify that there are no loops in the transient_for relation after we are done */
    for(counter = 0; tmp != NULL && counter <= globalconf.stack.len; counter++)
    {
        if (tmp == c)
            /* We arrived back at the client we started from, so there is a loop */
            counter = globalconf.stack.len+1;
        tmp = tmp->transient_for;
    }
    if (counter <= globalconf.stack.len)
        client_set_transient_for(globalconf.L, -1, tc);

    lua_pop(globalconf.L, 1);
}
void
property_update_wm_transient_for(client_t *c, xcb_get_property_reply_t *reply)
{
    xcb_window_t trans;

    if(reply)
    {
        if(!xcb_icccm_get_wm_transient_for_from_reply(&trans, reply))
            return;
    }
    else
    {
        if(!xcb_icccm_get_wm_transient_for_reply(globalconf.connection,
                                            xcb_icccm_get_wm_transient_for_unchecked(globalconf.connection,
                                                                                     c->window),
                                            &trans, NULL))
            return;
    }

    luaA_object_push(globalconf.L, c);
    client_set_type(globalconf.L, -1, WINDOW_TYPE_DIALOG);
    client_set_above(globalconf.L, -1, false);
    client_set_transient_for(globalconf.L, -1, client_getbywin(trans));
    lua_pop(globalconf.L, 1);
}
Exemple #3
0
void
property_update_wm_transient_for(client_t *c, xcb_get_property_cookie_t cookie)
{
    xcb_window_t trans;

    if(!xcb_icccm_get_wm_transient_for_reply(globalconf.connection,
            cookie,
            &trans, NULL))
        return;

    luaA_object_push(globalconf.L, c);
    client_set_type(globalconf.L, -1, WINDOW_TYPE_DIALOG);
    client_set_above(globalconf.L, -1, false);
    client_set_transient_for(globalconf.L, -1, client_getbywin(trans));
    lua_pop(globalconf.L, 1);
}