summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rwxr-xr-xapps/plugins/lua/action_helper.pl6
-rw-r--r--apps/plugins/lua/lua.make2
-rw-r--r--apps/plugins/lua/rocklib.c20
3 files changed, 27 insertions, 1 deletions
diff --git a/apps/plugins/lua/action_helper.pl b/apps/plugins/lua/action_helper.pl
index eb66c2b01e..f225952bf9 100755
--- a/apps/plugins/lua/action_helper.pl
+++ b/apps/plugins/lua/action_helper.pl
@@ -28,6 +28,12 @@ while(my $line = <STDIN>)
28 $actions[$i] = sprintf("\t%s = %d,\n", $1, $i); 28 $actions[$i] = sprintf("\t%s = %d,\n", $1, $i);
29 $i++; 29 $i++;
30 } 30 }
31 elsif($line =~ /^\s*(PLA_[^\s]+)(\s*=.*)?,\s*$/)
32 {
33 # PLA_* begins at LAST_ACTION_PLACEHOLDER+1, thus i+1
34 $actions[$i] = sprintf("\t%s = %d,\n", $1, $i+1);
35 $i++;
36 }
31 elsif($line =~ /^\s*(CONTEXT_[^\s]+)(\s*=.*)?,\s*$/) 37 elsif($line =~ /^\s*(CONTEXT_[^\s]+)(\s*=.*)?,\s*$/)
32 { 38 {
33 $contexts[$j] = sprintf("\t%s = %d,\n", $1, $j); 39 $contexts[$j] = sprintf("\t%s = %d,\n", $1, $j);
diff --git a/apps/plugins/lua/lua.make b/apps/plugins/lua/lua.make
index f4dd7710c9..9e2db62e39 100644
--- a/apps/plugins/lua/lua.make
+++ b/apps/plugins/lua/lua.make
@@ -33,7 +33,7 @@ endif
33$(LUA_BUILDDIR)/lua.rock: $(LUA_OBJ) $(LUA_BUILDDIR)/actions.lua $(LUA_BUILDDIR)/buttons.lua $(LUA_BUILDDIR)/rocklib_aux.o 33$(LUA_BUILDDIR)/lua.rock: $(LUA_OBJ) $(LUA_BUILDDIR)/actions.lua $(LUA_BUILDDIR)/buttons.lua $(LUA_BUILDDIR)/rocklib_aux.o
34 34
35$(LUA_BUILDDIR)/actions.lua: $(LUA_OBJ) $(LUA_SRCDIR)/action_helper.pl 35$(LUA_BUILDDIR)/actions.lua: $(LUA_OBJ) $(LUA_SRCDIR)/action_helper.pl
36 $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E $(APPSDIR)/action.h | $(LUA_SRCDIR)/action_helper.pl > $(LUA_BUILDDIR)/actions.lua 36 $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E $(APPSDIR)/plugins/lib/pluginlib_actions.h | $(LUA_SRCDIR)/action_helper.pl > $(LUA_BUILDDIR)/actions.lua
37 37
38$(LUA_BUILDDIR)/buttons.lua: $(LUA_OBJ) $(LUA_SRCDIR)/button_helper.pl 38$(LUA_BUILDDIR)/buttons.lua: $(LUA_OBJ) $(LUA_SRCDIR)/button_helper.pl
39 $(SILENT)$(CC) $(INCLUDES) -dM -E -include button-target.h - < /dev/null | $(LUA_SRCDIR)/button_helper.pl | $(HOSTCC) -fno-builtin $(INCLUDES) -x c -o $(LUA_BUILDDIR)/button_helper - 39 $(SILENT)$(CC) $(INCLUDES) -dM -E -include button-target.h - < /dev/null | $(LUA_SRCDIR)/button_helper.pl | $(HOSTCC) -fno-builtin $(INCLUDES) -x c -o $(LUA_BUILDDIR)/button_helper -
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 8e1ab19941..809b269b47 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -28,6 +28,7 @@
28#include "lauxlib.h" 28#include "lauxlib.h"
29#include "rocklib.h" 29#include "rocklib.h"
30#include "lib/helper.h" 30#include "lib/helper.h"
31#include "lib/pluginlib_actions.h"
31 32
32/* 33/*
33 * http://www.lua.org/manual/5.1/manual.html#lua_CFunction 34 * http://www.lua.org/manual/5.1/manual.html#lua_CFunction
@@ -613,6 +614,24 @@ RB_WRAP(backlight_brightness_set)
613SIMPLE_VOID_WRAPPER(backlight_brightness_use_setting); 614SIMPLE_VOID_WRAPPER(backlight_brightness_use_setting);
614#endif 615#endif
615 616
617RB_WRAP(get_plugin_action)
618{
619 static const struct button_mapping *m1[] = { pla_main_ctx };
620 int timeout = luaL_checkint(L, 1);
621 int btn;
622#ifdef HAVE_REMOTE_LCD
623 static const struct button_mapping *m2[] = { pla_main_ctx, pla_remote_ctx };
624 bool with_remote = luaL_optint(L, 2, 0);
625 if (with_remote)
626 btn = pluginlib_getaction(timeout, m2, 2);
627 else
628#endif
629 btn = pluginlib_getaction(timeout, m1, 1);
630
631 lua_pushinteger(L, btn);
632 return 1;
633}
634
616#define R(NAME) {#NAME, rock_##NAME} 635#define R(NAME) {#NAME, rock_##NAME}
617static const luaL_Reg rocklib[] = 636static const luaL_Reg rocklib[] =
618{ 637{
@@ -670,6 +689,7 @@ static const luaL_Reg rocklib[] =
670 R(backlight_brightness_set), 689 R(backlight_brightness_set),
671 R(backlight_brightness_use_setting), 690 R(backlight_brightness_use_setting),
672#endif 691#endif
692 R(get_plugin_action),
673 693
674 {"new_image", rli_new}, 694 {"new_image", rli_new},
675 695