diff options
Diffstat (limited to '')
-rw-r--r-- | src/GuiLua/GuiLua.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index 7463abb..3ff8f94 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -232,7 +232,7 @@ static int colour(lua_State *L) | |||
232 | static int window(lua_State *L) | 232 | static int window(lua_State *L) |
233 | { | 233 | { |
234 | winFang *win = NULL; | 234 | winFang *win = NULL; |
235 | Evas_Object *parent = NULL; | 235 | winFang *parent = NULL; |
236 | char *name = "GuiLua"; | 236 | char *name = "GuiLua"; |
237 | char *title = "GuiLua test harness"; | 237 | char *title = "GuiLua test harness"; |
238 | int w = WIDTH, h = HEIGHT; | 238 | int w = WIDTH, h = HEIGHT; |
@@ -246,7 +246,12 @@ static int window(lua_State *L) | |||
246 | if (gl && gl->parent) parent = gl->parent; | 246 | if (gl && gl->parent) parent = gl->parent; |
247 | 247 | ||
248 | win = winFangAdd(parent, 25, 25, w, h, title, name); | 248 | win = winFangAdd(parent, 25, 25, w, h, title, name); |
249 | eina_clist_add_head(&gl->winFangs, &win->node); | 249 | // If there's no parent, we become the parent. |
250 | if (gl && !parent) | ||
251 | { | ||
252 | gl->parent = win; | ||
253 | eina_clist_add_head(&gl->winFangs, &win->node); | ||
254 | } | ||
250 | lua_pushlightuserdata(L, win); | 255 | lua_pushlightuserdata(L, win); |
251 | 256 | ||
252 | return 1; | 257 | return 1; |
@@ -282,10 +287,12 @@ static int closeWindow(lua_State *L) | |||
282 | gl = lua_touserdata(L, -1); | 287 | gl = lua_touserdata(L, -1); |
283 | lua_pop(L, 1); | 288 | lua_pop(L, 1); |
284 | 289 | ||
285 | 290 | if (gl) | |
286 | EINA_CLIST_FOR_EACH_ENTRY(win, &gl->winFangs, winFang, node) | ||
287 | { | 291 | { |
288 | winFangDel(win); | 292 | EINA_CLIST_FOR_EACH_ENTRY(win, &gl->winFangs, winFang, node) |
293 | { | ||
294 | winFangDel(win); | ||
295 | } | ||
289 | } | 296 | } |
290 | 297 | ||
291 | return 0; | 298 | return 0; |
@@ -357,7 +364,7 @@ PD("GuiLua 3"); | |||
357 | return 1; | 364 | return 1; |
358 | } | 365 | } |
359 | 366 | ||
360 | GuiLua *GuiLuaDo(int argc, char **argv, Evas_Object *parent) | 367 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) |
361 | { | 368 | { |
362 | GuiLua *result; | 369 | GuiLua *result; |
363 | lua_State *L; | 370 | lua_State *L; |