/** 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); } }
/** 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); }
void value_take_tag (GValue* value, gpointer v_object) { Tag* old; g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TAG)); old = value->data[0].v_pointer; if (v_object) { g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TAG)); g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); value->data[0].v_pointer = v_object; } else { value->data[0].v_pointer = NULL; } if (old) { tag_unref (old); } }
/** Untag a client with specified tag. * \param c the client to tag * \param t the tag to tag the client with */ void untag_client(client_t *c, tag_t *t) { for(int i = 0; i < t->clients.len; i++) if(t->clients.tab[i] == c) { client_need_arrange(c); client_array_take(&t->clients, i); client_saveprops_tags(c); /* call hook */ if(globalconf.hooks.tagged != LUA_REFNIL) { luaA_client_userdata_new(globalconf.L, c); luaA_tag_userdata_new(globalconf.L, t); luaA_dofunction(globalconf.L, globalconf.hooks.tagged, 2, 0); } tag_unref(&t); return; } }
/** Untag a client with specified tag. * \param c the client to tag * \param t the tag to tag the client with */ void untag_client(client_t *c, tag_t *t) { for(int i = 0; i < t->clients.len; i++) if(t->clients.tab[i] == c) { client_need_arrange(c); client_array_take(&t->clients, i); ewmh_client_update_desktop(c); /* call hook */ if(globalconf.hooks.tagged != LUA_REFNIL) { client_push(globalconf.L, c); tag_push(globalconf.L, t); luaA_dofunction(globalconf.L, globalconf.hooks.tagged, 2, 0); } tag_unref(globalconf.L, t); return; } }
void tag_unref_simplified(tag_t **tag) { tag_unref(globalconf.L, *tag); }
static void value_tag_free_value (GValue* value) { if (value->data[0].v_pointer) { tag_unref (value->data[0].v_pointer); } }