diff options
author | David Walter Seikel | 2014-05-05 20:04:08 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-05 20:04:08 +1000 |
commit | 969f1968f2f74f8f09c4788bc7f7b1c9655ad354 (patch) | |
tree | 90d1d572f57c03b65c105cdcc47e9b79640a617d /src/GuiLua/GuiLua.c | |
parent | GuiLuaDo() now returns astructure, and has that structure in Lua's C registry... (diff) | |
download | SledjHamr-969f1968f2f74f8f09c4788bc7f7b1c9655ad354.zip SledjHamr-969f1968f2f74f8f09c4788bc7f7b1c9655ad354.tar.gz SledjHamr-969f1968f2f74f8f09c4788bc7f7b1c9655ad354.tar.bz2 SledjHamr-969f1968f2f74f8f09c4788bc7f7b1c9655ad354.tar.xz |
Call skang modules from extantz. Needs some clean up.
Diffstat (limited to 'src/GuiLua/GuiLua.c')
-rw-r--r-- | src/GuiLua/GuiLua.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index 2b09675..4bed9ca 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -139,8 +139,12 @@ and ordinary elementary widgets. Proper introspection can come later. | |||
139 | */ | 139 | */ |
140 | 140 | ||
141 | 141 | ||
142 | 142 | #include "SledjHamr.h" | |
143 | #include "LumbrJack.h" | ||
144 | #include "Runnr.h" | ||
145 | #include "winFang.h" | ||
143 | #include "GuiLua.h" | 146 | #include "GuiLua.h" |
147 | //#include <stdio.h> | ||
144 | 148 | ||
145 | 149 | ||
146 | static int logDom; // Our logging domain. | 150 | static int logDom; // Our logging domain. |
@@ -232,17 +236,20 @@ static int colour(lua_State *L) | |||
232 | static int window(lua_State *L) | 236 | static int window(lua_State *L) |
233 | { | 237 | { |
234 | winFang *win = NULL; | 238 | winFang *win = NULL; |
239 | Evas_Object *parent = NULL; | ||
235 | char *name = "GuiLua"; | 240 | char *name = "GuiLua"; |
236 | char *title = "GuiLua test harness"; | 241 | char *title = "GuiLua test harness"; |
237 | int w = WIDTH, h = HEIGHT; | 242 | int w = WIDTH, h = HEIGHT; |
238 | GuiLua *gl; | 243 | GuiLua *gl; |
239 | 244 | ||
245 | pull_lua(L, 1, "%w %h $title $name", &w, &h, &title, &name); | ||
246 | |||
240 | lua_getfield(L, LUA_REGISTRYINDEX, glName); | 247 | lua_getfield(L, LUA_REGISTRYINDEX, glName); |
241 | gl = lua_touserdata(L, -1); | 248 | gl = lua_touserdata(L, -1); |
242 | lua_pop(L, 1); | 249 | lua_pop(L, 1); |
250 | if (gl && gl->parent) parent = gl->parent; | ||
243 | 251 | ||
244 | pull_lua(L, 1, "%w %h $title $name", &w, &h, &title, &name); | 252 | win = winFangAdd(parent, 25, 25, w, h, title, name); |
245 | win = winFangAdd(NULL, 0, 0, w, h, title, name); | ||
246 | eina_clist_add_head(&gl->winFangs, &win->node); | 253 | eina_clist_add_head(&gl->winFangs, &win->node); |
247 | lua_pushlightuserdata(L, win); | 254 | lua_pushlightuserdata(L, win); |
248 | 255 | ||
@@ -285,15 +292,6 @@ static int closeWindow(lua_State *L) | |||
285 | winFangDel(win); | 292 | winFangDel(win); |
286 | } | 293 | } |
287 | 294 | ||
288 | if (logDom >= 0) | ||
289 | { | ||
290 | eina_log_domain_unregister(logDom); | ||
291 | logDom = -1; | ||
292 | } | ||
293 | |||
294 | // This shuts down Elementary, but keeps the main loop running until all ecore_evas are freed. | ||
295 | elm_shutdown(); | ||
296 | |||
297 | return 0; | 295 | return 0; |
298 | } | 296 | } |
299 | 297 | ||
@@ -313,6 +311,7 @@ int luaopen_GuiLua(lua_State *L) | |||
313 | { | 311 | { |
314 | int skang; | 312 | int skang; |
315 | 313 | ||
314 | printf("**********************require GuiLua\n"); | ||
316 | // In theory this function only ever gets called once. | 315 | // In theory this function only ever gets called once. |
317 | logDom = loggingStartup("GuiLua", logDom); | 316 | logDom = loggingStartup("GuiLua", logDom); |
318 | 317 | ||
@@ -362,7 +361,7 @@ PD("GuiLua 3"); | |||
362 | return 1; | 361 | return 1; |
363 | } | 362 | } |
364 | 363 | ||
365 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) | 364 | GuiLua *GuiLuaDo(int argc, char **argv, Evas_Object *parent) |
366 | { | 365 | { |
367 | GuiLua *result; | 366 | GuiLua *result; |
368 | lua_State *L; | 367 | lua_State *L; |
@@ -409,6 +408,14 @@ GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) | |||
409 | PE("Error running - skang.loopWindow()"); | 408 | PE("Error running - skang.loopWindow()"); |
410 | lua_pop(L, closeWindow(L)); | 409 | lua_pop(L, closeWindow(L)); |
411 | lua_close(L); | 410 | lua_close(L); |
411 | if (logDom >= 0) | ||
412 | { | ||
413 | eina_log_domain_unregister(logDom); | ||
414 | logDom = -1; | ||
415 | } | ||
416 | |||
417 | // This shuts down Elementary, but keeps the main loop running until all ecore_evas are freed. | ||
418 | elm_shutdown(); | ||
412 | } | 419 | } |
413 | } | 420 | } |
414 | else | 421 | else |