From: Rui Guo Date: Wed, 24 Jun 2009 14:11:51 +0000 (+0800) Subject: Introduce window.activate method. X-Git-Url: https://repo.or.cz/w/screen-lua.git/commitdiff_plain/e63f94c0a641574d9c6ce83543548a7d5261e366 Introduce window.activate method. --- diff --git a/src/drafts/scripting b/src/drafts/scripting index 871e1b9..c3a017d 100644 --- a/src/drafts/scripting +++ b/src/drafts/scripting @@ -200,6 +200,9 @@ void set_monitor_status(bool activity, int status); void stuff(string buf); put the string into the input buffer. +void activate(); + Show the window in current focused canvas. + int waitfor(string pattern); Waiting for a specified output pattern. The pattern is limited to plain text. NOTICE: This is an asynchronous method call and can only be called in diff --git a/src/lua.c b/src/lua.c index 07341f4..94041c0 100644 --- a/src/lua.c +++ b/src/lua.c @@ -444,9 +444,18 @@ window_stuff(lua_State *L) return 0; } +static int +window_activate(lua_State *L) +{ + struct win *w = check_window(L, 1); + SetForeWindow(w); + return 0; +} + static const luaL_reg window_methods[] = { {"get_monitor_status", window_get_monitor_status}, {"stuff", window_stuff}, + {"activate", window_activate}, {"hook", LuaRegEvent}, {0, 0} };