diff options
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r-- | apps/plugins/lua/rocklib.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 81b6f4ce2a..050fbc73b2 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -143,10 +143,17 @@ RB_WRAP(touchscreen_mode) | |||
143 | 143 | ||
144 | RB_WRAP(kbd_input) | 144 | RB_WRAP(kbd_input) |
145 | { | 145 | { |
146 | /*kbd_input(text, layout)* | ||
147 | note: layout needs special formatting | ||
148 | see includes/create_kbd_layout.lua | ||
149 | or lib/kbd_helper.c | ||
150 | */ | ||
146 | luaL_Buffer b; | 151 | luaL_Buffer b; |
147 | luaL_buffinit(L, &b); | 152 | luaL_buffinit(L, &b); |
148 | 153 | ||
149 | const char *input = lua_tostring(L, 1); | 154 | const char *input = lua_tostring(L, 1); |
155 | size_t layout_len; | ||
156 | const char *layout = lua_tolstring(L, 2, &layout_len); | ||
150 | char *buffer = luaL_prepbuffer(&b); | 157 | char *buffer = luaL_prepbuffer(&b); |
151 | 158 | ||
152 | if(input != NULL) | 159 | if(input != NULL) |
@@ -154,7 +161,10 @@ RB_WRAP(kbd_input) | |||
154 | else | 161 | else |
155 | buffer[0] = '\0'; | 162 | buffer[0] = '\0'; |
156 | 163 | ||
157 | if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, NULL)) | 164 | if(layout_len <= 1 || (unsigned short)layout[layout_len - 1] != 0xFFFE) |
165 | layout = NULL; | ||
166 | |||
167 | if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, (unsigned short *)layout)) | ||
158 | { | 168 | { |
159 | luaL_addstring(&b, buffer); | 169 | luaL_addstring(&b, buffer); |
160 | luaL_pushresult(&b); | 170 | luaL_pushresult(&b); |