示例#1
0
文件: tag.c 项目: azuwis/awesome
/** Remove a tag from screen. Tag must be on a screen and have no clients.
 * \param tag The tag to remove.
 */
static void
tag_remove_from_screen(tag_t *tag)
{
    int screen = tag->screen;
    int phys_screen = screen_virttophys(tag->screen);
    tag_array_t *tags = &globalconf.screens[tag->screen].tags;

    for(int i = 0; i < tags->len; i++)
        if(tags->tab[i] == tag)
        {
            tag_array_take(tags, i);
            break;
        }
    ewmh_update_net_numbers_of_desktop(phys_screen);
    ewmh_update_net_desktop_names(phys_screen);
    ewmh_update_workarea(phys_screen);
    tag->screen = SCREEN_UNDEF;

    /* call hook */
    if(globalconf.hooks.tags != LUA_REFNIL)
    {
        lua_pushnumber(globalconf.L, screen + 1);
        tag_push(globalconf.L, tag);
        lua_pushliteral(globalconf.L, "remove");
        luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0);
    }

    tag_unref(globalconf.L, tag);
}
示例#2
0
文件: tag.c 项目: kanru/awesome
/** Remove a tag from screen. Tag must be on a screen and have no clients.
 * \param tag The tag to remove.
 */
static void
tag_remove_from_screen(tag_t *tag)
{
    int screen = tag->screen;
    int phys_screen = screen_virttophys(tag->screen);
    tag_array_t *tags = &globalconf.screens[tag->screen].tags;

    for(int i = 0; i < tags->len; i++)
        if(tags->tab[i] == tag)
        {
            tag_array_take(tags, i);
            break;
        }
    ewmh_update_net_numbers_of_desktop(phys_screen);
    ewmh_update_net_desktop_names(phys_screen);
    ewmh_update_workarea(phys_screen);
    tag->screen = SCREEN_UNDEF;
    tag_unref(&tag);

    /* resave tag prop of all clients so the number of tag will be the
     * same */
    for(client_t *c = globalconf.clients; c; c = c->next)
        client_saveprops_tags(c);

    /* call hook */
    if(globalconf.hooks.tags != LUA_REFNIL)
    {
        lua_pushnumber(globalconf.L, screen + 1);
        luaA_dofunction(globalconf.L, globalconf.hooks.tags, 1, 0);
    }
}
示例#3
0
文件: tag.c 项目: azuwis/awesome
/** Append a tag which on top of the stack to a screen.
 * \param screen the screen id
 */
void
tag_append_to_screen(screen_t *s)
{
    int phys_screen = screen_virttophys(s->index);
    tag_t *tag = tag_ref(globalconf.L);

    tag->screen = s->index;
    tag_array_append(&s->tags, tag);
    ewmh_update_net_numbers_of_desktop(phys_screen);
    ewmh_update_net_desktop_names(phys_screen);
    ewmh_update_workarea(phys_screen);

    /* call hook */
    if(globalconf.hooks.tags != LUA_REFNIL)
    {
        lua_pushnumber(globalconf.L, s->index + 1);
        tag_push(globalconf.L, tag);
        lua_pushliteral(globalconf.L, "add");
        luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0);
    }
}
示例#4
0
文件: tag.c 项目: kanru/awesome
/** Append a tag to a screen.
 * \param tag the tag to append
 * \param screen the screen id
 */
void
tag_append_to_screen(tag_t *tag, screen_t *s)
{
    int phys_screen = screen_virttophys(s->index);

    tag->screen = s->index;
    tag_array_append(&s->tags, tag_ref(&tag));
    ewmh_update_net_numbers_of_desktop(phys_screen);
    ewmh_update_net_desktop_names(phys_screen);
    ewmh_update_workarea(phys_screen);

    /* resave tag prop of all clients so the number of tag will be the
     * same */
    for(client_t *c = globalconf.clients; c; c = c->next)
        client_saveprops_tags(c);

    /* call hook */
    if(globalconf.hooks.tags != LUA_REFNIL)
    {
        lua_pushnumber(globalconf.L, s->index + 1);
        luaA_dofunction(globalconf.L, globalconf.hooks.tags, 1, 0);
    }
}