Merge pull request #2660 from psychon/selection_setup

Move setup of selection() to selection.c
This commit is contained in:
mergify[bot] 2019-02-18 01:35:32 +00:00 committed by GitHub
commit c3a8ba7065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

6
luaa.c
View File

@ -385,9 +385,6 @@ luaA_fixups(lua_State *L)
/* replace type */ /* replace type */
lua_pushcfunction(L, luaAe_type); lua_pushcfunction(L, luaAe_type);
lua_setglobal(L, "type"); lua_setglobal(L, "type");
/* set selection */
lua_pushcfunction(L, luaA_selection_get);
lua_setglobal(L, "selection");
} }
static const char * static const char *
@ -1043,6 +1040,9 @@ luaA_init(xdgHandle* xdg, string_array_t *searchpath)
/* Export selection watcher */ /* Export selection watcher */
selection_watcher_class_setup(L); selection_watcher_class_setup(L);
/* Setup the selection interface */
selection_setup(L);
/* add Lua search paths */ /* add Lua search paths */
lua_getglobal(L, "package"); lua_getglobal(L, "package");
if (LUA_TTABLE != lua_type(L, 1)) if (LUA_TTABLE != lua_type(L, 1))

View File

@ -49,7 +49,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.
*/ */
int static int
luaA_selection_get(lua_State *L) luaA_selection_get(lua_State *L)
{ {
if(selection_window == XCB_NONE) if(selection_window == XCB_NONE)
@ -132,4 +132,11 @@ luaA_selection_get(lua_State *L)
return 0; return 0;
} }
void
selection_setup(lua_State *L)
{
lua_pushcfunction(L, luaA_selection_get);
lua_setglobal(L, "selection");
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -24,7 +24,7 @@
#include <lua.h> #include <lua.h>
int luaA_selection_get(lua_State *); void selection_setup(lua_State *);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80