selection: do not use a useless module

We rather just export the function.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-01-06 17:02:08 +01:00
parent 7e324e962e
commit 33372ea318
3 changed files with 38 additions and 18 deletions

12
luaa.c
View File

@ -1,7 +1,7 @@
/* /*
* lua.c - Lua configuration management * lua.c - Lua configuration management
* *
* Copyright © 2008 Julien Danjou <julien@danjou.info> * Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -48,6 +48,7 @@
#include "screen.h" #include "screen.h"
#include "event.h" #include "event.h"
#include "mouse.h" #include "mouse.h"
#include "selection.h"
#include "common/socket.h" #include "common/socket.h"
#include "common/buffer.h" #include "common/buffer.h"
@ -76,8 +77,6 @@ extern const struct luaL_reg awesome_wibox_meta[];
extern const struct luaL_reg awesome_key_methods[]; extern const struct luaL_reg awesome_key_methods[];
extern const struct luaL_reg awesome_key_meta[]; extern const struct luaL_reg awesome_key_meta[];
extern const struct luaL_reg awesome_keybinding_methods[]; extern const struct luaL_reg awesome_keybinding_methods[];
extern const struct luaL_reg awesome_selection_methods[];
extern const struct luaL_reg awesome_selection_meta[];
static struct sockaddr_un *addr; static struct sockaddr_un *addr;
static ev_io csio = { .fd = -1 }; static ev_io csio = { .fd = -1 };
@ -388,6 +387,10 @@ luaA_fixups(lua_State *L)
lua_pushliteral(L, "type"); lua_pushliteral(L, "type");
lua_pushcfunction(L, luaAe_type); lua_pushcfunction(L, luaAe_type);
lua_settable(L, LUA_GLOBALSINDEX); lua_settable(L, LUA_GLOBALSINDEX);
/* set selection */
lua_pushliteral(L, "selection");
lua_pushcfunction(L, luaA_selection_get);
lua_settable(L, LUA_GLOBALSINDEX);
} }
/** __next function for wtable objects. /** __next function for wtable objects.
@ -894,9 +897,6 @@ luaA_init(void)
luaA_openlib(L, "key", awesome_key_methods, awesome_key_meta); luaA_openlib(L, "key", awesome_key_methods, awesome_key_meta);
luaA_openlib(L, "keybinding", awesome_keybinding_methods, awesome_key_meta); luaA_openlib(L, "keybinding", awesome_keybinding_methods, awesome_key_meta);
/* Export selection */
luaA_openlib(L, "selection", awesome_selection_methods, awesome_selection_meta);
lua_pushliteral(L, "AWESOME_VERSION"); lua_pushliteral(L, "AWESOME_VERSION");
lua_pushstring(L, AWESOME_VERSION); lua_pushstring(L, AWESOME_VERSION);
lua_settable(L, LUA_GLOBALSINDEX); lua_settable(L, LUA_GLOBALSINDEX);

View File

@ -22,6 +22,7 @@
#include <xcb/xcb_atom.h> #include <xcb/xcb_atom.h>
#include "selection.h"
#include "structs.h" #include "structs.h"
#include "event.h" #include "event.h"
#include "common/atoms.h" #include "common/atoms.h"
@ -36,7 +37,7 @@ static xcb_window_t selection_window = XCB_NONE;
* \luastack * \luastack
* \lreturn A string with the current X selection buffer. * \lreturn A string with the current X selection buffer.
*/ */
static int int
luaA_selection_get(lua_State *L) luaA_selection_get(lua_State *L)
{ {
if(selection_window == XCB_NONE) if(selection_window == XCB_NONE)
@ -116,14 +117,3 @@ luaA_selection_get(lua_State *L)
p_delete(&event); p_delete(&event);
return 0; return 0;
} }
const struct luaL_reg awesome_selection_methods[] =
{
{ "__call", luaA_selection_get },
{ NULL, NULL }
};
const struct luaL_reg awesome_selection_meta[] =
{
{ NULL, NULL }
};

30
selection.h Normal file
View File

@ -0,0 +1,30 @@
/*
* selection.h - Selection handling header
*
* Copyright © 2009 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef AWESOME_SELECTION_H
#define AWESOME_SELECTION_H
#include <lua.h>
int luaA_selection_get(lua_State *);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80