mouse: garbage collector for mouse objects

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-13 23:59:51 +02:00
parent 412e074bf8
commit b2daa2acb3
1 changed files with 12 additions and 0 deletions

12
mouse.c
View File

@ -875,6 +875,17 @@ luaA_mouse_new(lua_State *L)
return luaA_mouse_userdata_new(button);
}
/** Handle mouse garbage collection.
*/
static int
luaA_mouse_gc(lua_State *L)
{
button_t **b = luaA_checkudata(L, 1, "mouse");
button_unref(b);
*b = NULL;
return 0;
}
const struct luaL_reg awesome_mouse_methods[] =
{
{ "new", luaA_mouse_new },
@ -884,6 +895,7 @@ const struct luaL_reg awesome_mouse_methods[] =
};
const struct luaL_reg awesome_mouse_meta[] =
{
{ "__gc", luaA_mouse_gc },
{ NULL, NULL }
};