aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/GuiLua/GuiLua.c71
-rw-r--r--src/GuiLua/GuiLua.h5
-rwxr-xr-xsrc/GuiLua/build.lua7
-rwxr-xr-xsrc/extantz/build.lua4
-rwxr-xr-xsrc/libraries/build.lua5
-rw-r--r--src/libraries/winFang.c (renamed from src/extantz/winFang.c)9
-rw-r--r--src/libraries/winFang.h (renamed from src/extantz/winFang.h)10
7 files changed, 35 insertions, 76 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c
index 34c747f..21c9bdf 100644
--- a/src/GuiLua/GuiLua.c
+++ b/src/GuiLua/GuiLua.c
@@ -156,18 +156,6 @@ win.quitter:colour(1,2,3,4) -> win.quitter.colour(win.quitter, 1,2,3,4) -> __
156win.quitter.colour.r = 5 -> direct access to the table, well "direct" via Thing and Mum. We eventually want to call skang.colour() though. 156win.quitter.colour.r = 5 -> direct access to the table, well "direct" via Thing and Mum. We eventually want to call skang.colour() though.
157*/ 157*/
158 158
159struct _Widget
160{
161 char magic[8];
162 Evas_Object *obj;
163 Eina_Clist node;
164 char *label, *look, *action, *help;
165 // foreground / background colour
166 // thing
167 // types {}
168 // skangCoord x, y, w, h
169};
170
171 159
172// TODO - These functions should be able to deal with multiple windows. 160// TODO - These functions should be able to deal with multiple windows.
173// TODO - Should be able to open external and internal windows, and even switch between them on the fly. 161// TODO - Should be able to open external and internal windows, and even switch between them on the fly.
@@ -175,7 +163,7 @@ static void _on_click(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
175{ 163{
176 globals *ourGlobals; 164 globals *ourGlobals;
177 lua_State *L = data; 165 lua_State *L = data;
178 struct _Widget *wid; 166 Widget *wid;
179 167
180 lua_getfield(L, LUA_REGISTRYINDEX, globName); 168 lua_getfield(L, LUA_REGISTRYINDEX, globName);
181 ourGlobals = lua_touserdata(L, -1); 169 ourGlobals = lua_touserdata(L, -1);
@@ -215,18 +203,12 @@ static int widget(lua_State *L)
215 // TODO - The alternative is to just lookup the ELM_*_CLASS in a hash table? 203 // TODO - The alternative is to just lookup the ELM_*_CLASS in a hash table?
216 if (strcmp(type, "button") == 0) 204 if (strcmp(type, "button") == 0)
217 { 205 {
218 struct _Widget *wid; 206 Widget *wid;
219
220 wid = calloc(1, sizeof(struct _Widget));
221 strcpy(wid->magic, "Widget");
222 eina_clist_add_head(&ourGlobals->widgets, &wid->node);
223 wid->label = strdup(title);
224 207
225 // These two lines are likely the only ones that will be different for the different sorts of widgets. 208 // These two lines are likely the only ones that will be different for the different sorts of widgets.
226 wid->obj = eo_add(ELM_OBJ_BUTTON_CLASS, ourGlobals->win); 209 wid = widgetAdd(ourGlobals->win, ELM_OBJ_BUTTON_CLASS, ourGlobals->win->win, title);
227 evas_object_smart_callback_add(wid->obj, "clicked", _on_click, L); 210 evas_object_smart_callback_add(wid->obj, "clicked", _on_click, L);
228 211
229 elm_object_part_text_set(wid->obj, NULL, wid->label);
230 eo_do(wid->obj, 212 eo_do(wid->obj,
231// elm_obj_widget_part_text_set(NULL, wid->label), 213// elm_obj_widget_part_text_set(NULL, wid->label),
232 evas_obj_size_set(w, h), 214 evas_obj_size_set(w, h),
@@ -250,7 +232,7 @@ static int widget(lua_State *L)
250static int action(lua_State *L) 232static int action(lua_State *L)
251{ 233{
252 globals *ourGlobals; 234 globals *ourGlobals;
253 struct _Widget *wid = lua_touserdata(L, 1); 235 Widget *wid = lua_touserdata(L, 1);
254 char *action = "nada"; 236 char *action = "nada";
255 237
256 lua_getfield(L, LUA_REGISTRYINDEX, globName); 238 lua_getfield(L, LUA_REGISTRYINDEX, globName);
@@ -278,7 +260,6 @@ static int window(lua_State *L)
278 globals *ourGlobals; 260 globals *ourGlobals;
279 char *name = "GuiLua"; 261 char *name = "GuiLua";
280 char *title = "GuiLua test harness"; 262 char *title = "GuiLua test harness";
281 Evas_Object *obj;
282 int result = 0; 263 int result = 0;
283 int w = WIDTH, h = HEIGHT; 264 int w = WIDTH, h = HEIGHT;
284 265
@@ -287,38 +268,9 @@ static int window(lua_State *L)
287 lua_pop(L, 1); 268 lua_pop(L, 1);
288 269
289 pull_lua(L, 1, "%w %h $title $name", &w, &h, &title, &name); 270 pull_lua(L, 1, "%w %h $title $name", &w, &h, &title, &name);
290 271 ourGlobals->win = winFangAdd(NULL, 0, 0, w, h, title, name);
291 // Set the engine to opengl_x11, then open the window. 272 lua_pushlightuserdata(L, &ourGlobals->win);
292 elm_config_preferred_engine_set("opengl_x11"); 273 result = 1;
293 if ((ourGlobals->win = elm_win_util_standard_add(name, title)))
294 {
295 eina_clist_init(&ourGlobals->widgets);
296
297 evas_object_smart_callback_add(ourGlobals->win, "delete,request", _on_done, ourGlobals);
298 evas_object_resize(ourGlobals->win, w, h);
299 evas_object_move(ourGlobals->win, 0, 0);
300 evas_object_show(ourGlobals->win);
301
302 // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas.
303 ourGlobals->evas = evas_object_evas_get(ourGlobals->win);
304
305 // Add a background image object.
306 obj = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win);
307 eo_do(obj,
308 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
309 elm_obj_image_fill_outside_set(EINA_TRUE),
310 elm_obj_image_file_set("../../media/sky_01.jpg", NULL),
311 evas_obj_visibility_set(EINA_TRUE)
312 );
313 elm_win_resize_object_add(ourGlobals->win, obj);
314 eo_unref(obj);
315
316 lua_pushlightuserdata(L, &ourGlobals->win);
317 result = 1;
318 }
319
320 // Set preferred engine back to default from config
321 elm_config_preferred_engine_set(NULL);
322 274
323 return result; 275 return result;
324} 276}
@@ -367,14 +319,7 @@ static int closeWindow(lua_State *L)
367 319
368 if (ourGlobals->win) 320 if (ourGlobals->win)
369 { 321 {
370 struct _Widget *wid; 322 winFangDel(ourGlobals->win);
371
372 // Elm will delete our widgets, but if we are using eo, we need to unref them.
373 EINA_CLIST_FOR_EACH_ENTRY(wid, &ourGlobals->widgets, struct _Widget, node)
374 {
375 eo_unref(wid->obj);
376 }
377 evas_object_del(ourGlobals->win);
378 } 323 }
379 324
380 if (ourGlobals->logDom >= 0) 325 if (ourGlobals->logDom >= 0)
diff --git a/src/GuiLua/GuiLua.h b/src/GuiLua/GuiLua.h
index ee669ce..82415c9 100644
--- a/src/GuiLua/GuiLua.h
+++ b/src/GuiLua/GuiLua.h
@@ -1,6 +1,7 @@
1#include "SledjHamr.h" 1#include "SledjHamr.h"
2#include "LumbrJack.h" 2#include "LumbrJack.h"
3#include "Runnr.h" 3#include "Runnr.h"
4#include "winFang.h"
4 5
5 6
6#define WIDTH (300) 7#define WIDTH (300)
@@ -14,9 +15,7 @@
14 15
15typedef struct _globals 16typedef struct _globals
16{ 17{
17 Evas *evas; 18 winFang *win;
18 Evas_Object *win; // Our Elm window.
19 Eina_Clist widgets; // Our windows widgets.
20 int logDom; // Our logging domain. 19 int logDom; // Our logging domain.
21} globals; 20} globals;
22 21
diff --git a/src/GuiLua/build.lua b/src/GuiLua/build.lua
index 169e198..8b4a1c8 100755
--- a/src/GuiLua/build.lua
+++ b/src/GuiLua/build.lua
@@ -18,6 +18,7 @@ LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS
18removeFiles(dir, {'test_c.so', 'GuiLua.o', lib_d .. '/libGuiLua.so', '../../skang'}) 18removeFiles(dir, {'test_c.so', 'GuiLua.o', lib_d .. '/libGuiLua.so', '../../skang'})
19 19
20runCommand('C modules', dir, 'gcc ' .. CFLAGS .. ' -fPIC -shared -o test_c.so test_c.c') 20runCommand('C modules', dir, 'gcc ' .. CFLAGS .. ' -fPIC -shared -o test_c.so test_c.c')
21runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c GuiLua.c') 21
22runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libGuiLua.so -o ' .. lib_d .. '/libGuiLua.so GuiLua.o') 22runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -fPIC -c GuiLua.c')
23runCommand('C apps', dir, 'gcc ' .. CFLAGS .. ' -Wl,-export-dynamic -o ../../skang skang.c ' .. LDFLAGS .. ' -lGuiLua ' .. libs) 23runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libGuiLua.so -o ' .. lib_d .. '/libGuiLua.so GuiLua.o')
24runCommand('C apps', dir, 'gcc ' .. CFLAGS .. ' -Wl,-export-dynamic -o ../../skang skang.c ' .. LDFLAGS .. ' -lGuiLua -lwinFang ' .. libs)
diff --git a/src/extantz/build.lua b/src/extantz/build.lua
index 261c96f..d3c983a 100755
--- a/src/extantz/build.lua
+++ b/src/extantz/build.lua
@@ -18,12 +18,10 @@ LDFLAGS = LDFLAGS .. ' -L../../libraries/irrlicht-1.8.1/lib/Linux'
18libs = libs .. ' -lIrrlicht -lGL -lbz2' 18libs = libs .. ' -lIrrlicht -lGL -lbz2'
19 19
20removeFiles(dir, {'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'gears.o', 'ephysics_demo.o', 'Evas_3D_demo.o', '../../media/extantz.edj'}) 20removeFiles(dir, {'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'gears.o', 'ephysics_demo.o', 'Evas_3D_demo.o', '../../media/extantz.edj'})
21removeFiles(dir, {'../../extantz', 'camera.o', 'winFang.o', lib_d .. '/libwinFang.so', 'chat.o', 'files.o', 'woMan.o'}) 21removeFiles(dir, {'../../extantz', 'camera.o', 'chat.o', 'files.o', 'woMan.o'})
22 22
23runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc ../../media/extantz.edj') 23runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc ../../media/extantz.edj')
24runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS) 24runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS)
25runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS) 25runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS)
26runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS) 26runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS)
27runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -fPIC -c winFang.c')
28runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libwinFang.so -o ' .. lib_d .. '/libwinFang.so winFang.o')
29compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'camera', 'Evas_3D_demo', 'chat', 'files', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o -lwinFang') 27compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'camera', 'Evas_3D_demo', 'chat', 'files', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o -lwinFang')
diff --git a/src/libraries/build.lua b/src/libraries/build.lua
index 6566e66..4e277e1 100755
--- a/src/libraries/build.lua
+++ b/src/libraries/build.lua
@@ -15,7 +15,7 @@ end
15 15
16LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS 16LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS
17 17
18removeFiles(dir, {'LumbrJack.o', lib_d .. '/libLumbrJack.so', 'Runnr.o', lib_d .. '/libRunnr.so', 'SledjHamr.o', lib_d .. '/libSledjHamr.so'}) 18removeFiles(dir, {'LumbrJack.o', lib_d .. '/libLumbrJack.so', 'Runnr.o', lib_d .. '/libRunnr.so', 'SledjHamr.o', lib_d .. '/libSledjHamr.so', 'winFang.o', lib_d .. '/libwinFang.so'})
19 19
20runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -fPIC -c LumbrJack.c') 20runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -fPIC -c LumbrJack.c')
21runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libLumbrJack.so -o ' .. lib_d .. '/libLumbrJack.so LumbrJack.o') 21runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libLumbrJack.so -o ' .. lib_d .. '/libLumbrJack.so LumbrJack.o')
@@ -31,3 +31,6 @@ CFLAGS = CFLAGS .. ' -DPACKAGE_LOCALE_DIR=\\"' .. locale_d .. '\\"'
31 31
32runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c SledjHamr.c') 32runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c SledjHamr.c')
33runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libSledjHamr.so -o ' .. lib_d .. '/libSledjHamr.so SledjHamr.o') 33runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libSledjHamr.so -o ' .. lib_d .. '/libSledjHamr.so SledjHamr.o')
34
35runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c winFang.c')
36runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libwinFang.so -o ' .. lib_d .. '/libwinFang.so winFang.o')
diff --git a/src/extantz/winFang.c b/src/libraries/winFang.c
index a38845a..4d54627 100644
--- a/src/extantz/winFang.c
+++ b/src/libraries/winFang.c
@@ -1,4 +1,4 @@
1#include "extantz.h" 1#include "winFang.h"
2 2
3 3
4// Elm inlined image windows needs this to change focus on mouse click. 4// Elm inlined image windows needs this to change focus on mouse click.
@@ -144,7 +144,6 @@ winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h, char *title
144 } 144 }
145 else 145 else
146 { 146 {
147 elm_config_preferred_engine_set("opengl_x11");
148 result->win = elm_win_add(parent, name, ELM_WIN_BASIC); 147 result->win = elm_win_add(parent, name, ELM_WIN_BASIC);
149 evas_object_move(result->win, result->x, result->y); 148 evas_object_move(result->win, result->x, result->y);
150 evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); 149 evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL);
@@ -198,7 +197,11 @@ Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char
198 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), 197 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
199 evas_obj_visibility_set(EINA_TRUE) 198 evas_obj_visibility_set(EINA_TRUE)
200 ); 199 );
201 if (title) elm_object_text_set(result->obj, title); 200 if (title)
201 {
202 result->label = strdup(title);
203 elm_object_text_set(result->obj, result->label);
204 }
202 } 205 }
203 206
204 return result; 207 return result;
diff --git a/src/extantz/winFang.h b/src/libraries/winFang.h
index 6ae26e4..219dcf0 100644
--- a/src/extantz/winFang.h
+++ b/src/libraries/winFang.h
@@ -1,3 +1,13 @@
1#define EFL_API_OVERRIDE 1
2/* Enable access to unstable EFL API that are still in beta */
3#define EFL_BETA_API_SUPPORT 1
4/* Enable access to unstable EFL EO API. */
5#define EFL_EO_API_SUPPORT 1
6
7
8#include <Eo.h>
9#include <Eina.h>
10#include <Evas.h>
1#include <Elementary.h> 11#include <Elementary.h>
2 12
3 13