From f9e3bc8a7ae99b09b2b6165514bf2300079d8746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Wed, 6 Jun 2012 00:35:11 +0200 Subject: [PATCH] Get mousegrabber running state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a function mousegrabber.isrunning() which return a boolean state of mousegrabber Signed-off-by: Sébastien Luttringer Signed-off-by: Julien Danjou --- mousegrabber.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mousegrabber.c b/mousegrabber.c index 61f1c00c..e8685fce 100644 --- a/mousegrabber.c +++ b/mousegrabber.c @@ -110,10 +110,24 @@ luaA_mousegrabber_stop(lua_State *L) return 0; } +/** Check if mousegrabber is running. + * \param L The Lua VM state. + * \return The number of elements pushed on stack. + * \luastack + * \lreturn A boolean value, true if mousegrabber is running, false otherwise. + */ +static int +luaA_mousegrabber_isrunning(lua_State *L) +{ + lua_pushboolean(L, globalconf.mousegrabber != LUA_REFNIL); + return 1; +} + const struct luaL_reg awesome_mousegrabber_lib[] = { { "run", luaA_mousegrabber_run }, { "stop", luaA_mousegrabber_stop }, + { "isrunning", luaA_mousegrabber_isrunning }, { NULL, NULL } };