diff options
author | David Walter Seikel | 2014-04-16 20:57:20 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-16 20:57:20 +1000 |
commit | ff7a21e30c8483f5614dc793e3caecb5e3b89d02 (patch) | |
tree | bbb2f17ce12565e37b2206f5cf0a9938f399fd0f | |
parent | Minor clean ups. (diff) | |
download | SledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.zip SledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.tar.gz SledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.tar.bz2 SledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.tar.xz |
Convert GuiLua and skang to Elementary.
-rw-r--r-- | ClientHamr/GuiLua/GuiLua.c | 86 | ||||
-rw-r--r-- | ClientHamr/GuiLua/GuiLua.h | 12 | ||||
-rwxr-xr-x | ClientHamr/GuiLua/build.sh | 42 | ||||
-rw-r--r-- | ClientHamr/GuiLua/skang.c | 11 |
4 files changed, 39 insertions, 112 deletions
diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c index 47f63d5..985d0c6 100644 --- a/ClientHamr/GuiLua/GuiLua.c +++ b/ClientHamr/GuiLua/GuiLua.c | |||
@@ -204,18 +204,6 @@ void loggingStartup(globals *ourGlobals) | |||
204 | eina_log_level_set(EINA_LOG_LEVEL_DBG); | 204 | eina_log_level_set(EINA_LOG_LEVEL_DBG); |
205 | eina_log_domain_level_set("GuiLua", EINA_LOG_LEVEL_DBG); | 205 | eina_log_domain_level_set("GuiLua", EINA_LOG_LEVEL_DBG); |
206 | eina_log_print_cb_set(_ggg_log_print_cb, stderr); | 206 | eina_log_print_cb_set(_ggg_log_print_cb, stderr); |
207 | |||
208 | // Shut up the excess debugging shit from EFL. | ||
209 | eina_log_domain_level_set("eo", EINA_LOG_LEVEL_WARN); | ||
210 | eina_log_domain_level_set("eet", EINA_LOG_LEVEL_WARN); | ||
211 | eina_log_domain_level_set("ecore", EINA_LOG_LEVEL_WARN); | ||
212 | eina_log_domain_level_set("ecore_audio", EINA_LOG_LEVEL_WARN); | ||
213 | eina_log_domain_level_set("ecore_evas", EINA_LOG_LEVEL_WARN); | ||
214 | eina_log_domain_level_set("ecore_input_evas", EINA_LOG_LEVEL_WARN); | ||
215 | eina_log_domain_level_set("ecore_system_upower", EINA_LOG_LEVEL_WARN); | ||
216 | eina_log_domain_level_set("ecore_x", EINA_LOG_LEVEL_WARN); | ||
217 | eina_log_domain_level_set("evas_main", EINA_LOG_LEVEL_WARN); | ||
218 | eina_log_domain_level_set("eldbus", EINA_LOG_LEVEL_WARN); | ||
219 | } | 207 | } |
220 | 208 | ||
221 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) | 209 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) |
@@ -242,9 +230,11 @@ char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) | |||
242 | } | 230 | } |
243 | 231 | ||
244 | 232 | ||
245 | static void _on_delete(Ecore_Evas *ee /*__UNUSED__*/) | 233 | static void _on_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
246 | { | 234 | { |
247 | ecore_main_loop_quit(); | 235 | // globals *ourGlobals = data; |
236 | |||
237 | elm_exit(); | ||
248 | } | 238 | } |
249 | 239 | ||
250 | static int openWindow(lua_State *L) | 240 | static int openWindow(lua_State *L) |
@@ -255,36 +245,16 @@ static int openWindow(lua_State *L) | |||
255 | ourGlobals = lua_touserdata(L, -1); | 245 | ourGlobals = lua_touserdata(L, -1); |
256 | lua_pop(L, 1); | 246 | lua_pop(L, 1); |
257 | 247 | ||
258 | if ((ourGlobals->eina = eina_init())) | 248 | loggingStartup(ourGlobals); |
259 | { | 249 | PI("GuiLua running as an application.\n"); |
260 | loggingStartup(ourGlobals); | ||
261 | |||
262 | PI("GuiLua running as an application.\n"); | ||
263 | 250 | ||
264 | if ((ourGlobals->ecore_evas = ecore_evas_init())) | 251 | if ((ourGlobals->win = elm_win_util_standard_add("GuiLua", "GuiLua test harness"))) |
265 | { | 252 | { |
266 | if ((ourGlobals->edje = edje_init())) | 253 | evas_object_smart_callback_add(ourGlobals->win, "delete,request", _on_done, ourGlobals); |
267 | { | 254 | evas_object_resize(ourGlobals->win, WIDTH, HEIGHT); |
268 | /* this will give you a window with an Evas canvas under the first engine available */ | 255 | evas_object_move(ourGlobals->win, 0, 0); |
269 | ourGlobals->ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); | 256 | evas_object_show(ourGlobals->win); |
270 | if (ourGlobals->ee) | ||
271 | { | ||
272 | ourGlobals->canvas = ecore_evas_get(ourGlobals->ee); | ||
273 | ecore_evas_title_set(ourGlobals->ee, "GuiLua test harness"); | ||
274 | ecore_evas_show(ourGlobals->ee); | ||
275 | ecore_evas_callback_delete_request_set(ourGlobals->ee, _on_delete); | ||
276 | } | ||
277 | else | ||
278 | PC("You got to have at least one evas engine built and linked up to ecore-evas for this to run properly."); | ||
279 | } | ||
280 | else | ||
281 | PC("Failed to init edje!"); | ||
282 | } | ||
283 | else | ||
284 | PC("Failed to init ecore_evas!"); | ||
285 | } | 257 | } |
286 | else | ||
287 | fprintf(stderr, "Failed to init eina!\n"); | ||
288 | 258 | ||
289 | return 0; | 259 | return 0; |
290 | } | 260 | } |
@@ -297,8 +267,8 @@ static int loopWindow(lua_State *L) | |||
297 | ourGlobals = lua_touserdata(L, -1); | 267 | ourGlobals = lua_touserdata(L, -1); |
298 | lua_pop(L, 1); | 268 | lua_pop(L, 1); |
299 | 269 | ||
300 | if (ourGlobals->canvas) | 270 | if (ourGlobals->win) |
301 | ecore_main_loop_begin(); | 271 | elm_run(); |
302 | 272 | ||
303 | return 0; | 273 | return 0; |
304 | } | 274 | } |
@@ -311,29 +281,17 @@ static int closeWindow(lua_State *L) | |||
311 | ourGlobals = lua_touserdata(L, -1); | 281 | ourGlobals = lua_touserdata(L, -1); |
312 | lua_pop(L, 1); | 282 | lua_pop(L, 1); |
313 | 283 | ||
314 | if (ourGlobals->eina) | 284 | if (ourGlobals->win) |
285 | evas_object_del(ourGlobals->win); | ||
286 | |||
287 | if (ourGlobals->logDom >= 0) | ||
315 | { | 288 | { |
316 | if (ourGlobals->ecore_evas) | 289 | eina_log_domain_unregister(ourGlobals->logDom); |
317 | { | 290 | ourGlobals->logDom = -1; |
318 | if (ourGlobals->edje) | ||
319 | { | ||
320 | if (ourGlobals->ee) | ||
321 | { | ||
322 | ecore_evas_free(ourGlobals->ee); | ||
323 | ourGlobals->ee = NULL; | ||
324 | } | ||
325 | ourGlobals->edje = edje_shutdown(); | ||
326 | } | ||
327 | ourGlobals->ecore_evas = ecore_evas_shutdown(); | ||
328 | } | ||
329 | if (ourGlobals->logDom >= 0) | ||
330 | { | ||
331 | eina_log_domain_unregister(ourGlobals->logDom); | ||
332 | ourGlobals->logDom = -1; | ||
333 | } | ||
334 | ourGlobals->eina = eina_shutdown(); | ||
335 | } | 291 | } |
336 | 292 | ||
293 | elm_shutdown(); | ||
294 | |||
337 | return 0; | 295 | return 0; |
338 | } | 296 | } |
339 | 297 | ||
diff --git a/ClientHamr/GuiLua/GuiLua.h b/ClientHamr/GuiLua/GuiLua.h index 127841f..6debac5 100644 --- a/ClientHamr/GuiLua/GuiLua.h +++ b/ClientHamr/GuiLua/GuiLua.h | |||
@@ -1,11 +1,9 @@ | |||
1 | 1 | ||
2 | #include <Eet.h> | ||
3 | #include <Ecore.h> | ||
4 | #include <Ecore_Evas.h> | ||
5 | #include <Edje.h> | ||
6 | #include <stdio.h> | 2 | #include <stdio.h> |
7 | #include <ctype.h> | 3 | #include <ctype.h> |
8 | 4 | ||
5 | #include <Elementary.h> | ||
6 | |||
9 | #include <lua.h> | 7 | #include <lua.h> |
10 | #include <luajit.h> | 8 | #include <luajit.h> |
11 | #include <lualib.h> | 9 | #include <lualib.h> |
@@ -47,11 +45,9 @@ typedef enum | |||
47 | 45 | ||
48 | struct _globals | 46 | struct _globals |
49 | { | 47 | { |
50 | Ecore_Evas *ee; // Our window. | 48 | Evas_Object *win; // Our Elm window. |
51 | Evas *canvas; // The canvas for drawing directly onto. | ||
52 | Evas_Object *bg; // Our background edje. | ||
53 | lua_State *L; // Our Lua state. | 49 | lua_State *L; // Our Lua state. |
54 | int eina, logDom, ecore_evas, edje; | 50 | int logDom; // Our logging domain. |
55 | }; | 51 | }; |
56 | 52 | ||
57 | 53 | ||
diff --git a/ClientHamr/GuiLua/build.sh b/ClientHamr/GuiLua/build.sh index 0ef46b9..076c106 100755 --- a/ClientHamr/GuiLua/build.sh +++ b/ClientHamr/GuiLua/build.sh | |||
@@ -4,49 +4,17 @@ export LOCALDIR=`pwd` | |||
4 | 4 | ||
5 | # No need for a make file, or dependencies, the entire thing takes only a few seconds to build. | 5 | # No need for a make file, or dependencies, the entire thing takes only a few seconds to build. |
6 | 6 | ||
7 | # This assumes you have EFL installed in one of two standard places. | ||
8 | if [ -d "/opt/EFL" ] | ||
9 | then | ||
10 | export E17DIR="/opt/EFL" | ||
11 | else | ||
12 | export E17DIR="/usr" | ||
13 | fi | ||
14 | 7 | ||
15 | CFLAGS="-g -Wall -I include -I $LOCALDIR" | 8 | CFLAGS="-g -Wall -I include -I $LOCALDIR" |
16 | CFLAGS="$CFLAGS -I ../../libraries" | 9 | CFLAGS="$CFLAGS -I ../../libraries" |
17 | #CFLAGS="$CFLAGS -I ../../libraries/LuaJIT-2.0.2/src" | ||
18 | CFLAGS="$CFLAGS $(pkg-config --cflags luajit)" | 10 | CFLAGS="$CFLAGS $(pkg-config --cflags luajit)" |
19 | #CFLAGS="$CFLAGS -I /usr/include/lua5.1" | 11 | CFLAGS="$CFLAGS $(pkg-config --cflags elementary)" |
20 | CFLAGS="$CFLAGS -I $E17DIR/include/eo-1" | 12 | CFLAGS="$CFLAGS -DPACKAGE_BIN_DIR=\"$LOCALDIR\"" |
21 | CFLAGS="$CFLAGS -I $E17DIR/include/eina-1" | 13 | CFLAGS="$CFLAGS -DPACKAGE_LIB_DIR=\"$LOCALDIR\"" |
22 | CFLAGS="$CFLAGS -I $E17DIR/include/eina-1/eina" | ||
23 | CFLAGS="$CFLAGS -I $E17DIR/include/eet-1" | ||
24 | CFLAGS="$CFLAGS -I $E17DIR/include/embryo-1" | ||
25 | CFLAGS="$CFLAGS -I $E17DIR/include/edje-1" | ||
26 | CFLAGS="$CFLAGS -I $E17DIR/include/evas-1" | ||
27 | CFLAGS="$CFLAGS -I $E17DIR/include/ecore-1" | ||
28 | CFLAGS="$CFLAGS -I $E17DIR/include/efl-1" | ||
29 | CFLAGS="$CFLAGS -I $E17DIR/include/ecore-con-1" | ||
30 | CFLAGS="$CFLAGS -I $E17DIR/include/ecore-evas-1" | ||
31 | CFLAGS="$CFLAGS -I $E17DIR/include/ecore-file-1" | ||
32 | CFLAGS="$CFLAGS -I $E17DIR/include" | ||
33 | CFLAGS="$CFLAGS -DPACKAGE_DATA_DIR=\"$LOCALDIR\" $CFLAGOPTS" | 14 | CFLAGS="$CFLAGS -DPACKAGE_DATA_DIR=\"$LOCALDIR\" $CFLAGOPTS" |
34 | 15 | ||
35 | #LDFLAGS="-L ../../libraries/LuaJIT-2.0.2/src -L lib -L /usr/lib -L /lib -L $E17DIR/lib" | 16 | LDFLAGS="-L $LOCALDIR $(pkg-config --libs-only-L luajit) -L lib -L /usr/lib -L /lib" |
36 | #libs="-leo -lecore -levas -ledje -lembryo -leet -leina -lluajit -lpthread -lm" | 17 | libs="$(pkg-config --cflags --libs elementary) $(pkg-config --libs luajit) -lpthread -lm -ldl" |
37 | LDFLAGS="-L $LOCALDIR $(pkg-config --libs-only-L luajit) -L lib -L /usr/lib -L /lib -L $E17DIR/lib" | ||
38 | libs="-leo -lecore -levas -ledje -lembryo -leet -leina $(pkg-config --libs luajit) -lpthread -lm -ldl" | ||
39 | #LDFLAGS="-L /usr/lib/lua/5.1 -L lib -L /usr/lib -L /lib -L $E17DIR/lib" | ||
40 | #libs="-lecore -levas -ledje -lembryo -leet -leina -llua5.1 -lpthread -lm" | ||
41 | # These need to be added to libs if linking staticaly, though some parts of EFL don't like that. | ||
42 | #-lecore_evas \ | ||
43 | #-lecore_file \ | ||
44 | #-ldl \ | ||
45 | #-lfontconfig \ | ||
46 | #-lfreetype \ | ||
47 | #-lexpat \ | ||
48 | #-lrt \ | ||
49 | #-lz | ||
50 | 18 | ||
51 | echo "clean" | 19 | echo "clean" |
52 | rm -f test_c.so GuiLua.o libGuiLua.so skang | 20 | rm -f test_c.so GuiLua.o libGuiLua.so skang |
diff --git a/ClientHamr/GuiLua/skang.c b/ClientHamr/GuiLua/skang.c index ed92ff9..facc239 100644 --- a/ClientHamr/GuiLua/skang.c +++ b/ClientHamr/GuiLua/skang.c | |||
@@ -1,11 +1,16 @@ | |||
1 | #include "GuiLua.h" | 1 | #include "GuiLua.h" |
2 | 2 | ||
3 | 3 | ||
4 | int main(int argc, char **argv) | 4 | EAPI_MAIN int elm_main(int argc, char **argv) |
5 | { | 5 | { |
6 | int result = EXIT_FAILURE; | 6 | elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); |
7 | elm_app_compile_data_dir_set(PACKAGE_DATA_DIR); | ||
8 | elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR); | ||
9 | elm_app_info_set(elm_main, "GuiLua", "skang.lua"); | ||
7 | 10 | ||
8 | GuiLuaDo(argc, argv); | 11 | GuiLuaDo(argc, argv); |
9 | 12 | ||
10 | return result; | 13 | return 0; |
11 | } | 14 | } |
15 | |||
16 | ELM_MAIN() | ||