diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2012-11-30 09:55:47 +0100 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2012-11-30 09:55:47 +0100 |
commit | 75cda851a5cebbb177bc9d2e97fc3f20645c2129 (patch) | |
tree | 8b100eff3e7e28d4f260ba808eb6d40c227dd127 | |
parent | cell redraw when injecting pattern is not needed (diff) | |
download | glouglou-75cda851a5cebbb177bc9d2e97fc3f20645c2129.tar.xz glouglou-75cda851a5cebbb177bc9d2e97fc3f20645c2129.zip |
add conditionnal glouglou support :)
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/elife_evas_smart.c | 38 |
4 files changed, 65 insertions, 4 deletions
@@ -19,6 +19,16 @@ sudo make install "elife" will then appear in the "System" category of e17 wallpapers configuration panel. A binary called "elife" is also created and installed to run elife in standalone. +Glouglou support +================ + +To enable glouglou support, pass --enable-glouglou to automake scripts : +./autogen.sh --enable-glouglou +OR +./configure --enable-glouglou + +You will need libglouglou and glougloud + Elife slows down my e17 ! ========================= diff --git a/configure.ac b/configure.ac index 7c19b4b..60d1703 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,15 @@ AC_ARG_ENABLE(homedir-install, ) AC_SUBST(datadir_edj) +AC_ARG_ENABLE(glouglou, +[ --enable-glouglou Enable glouglou support], +[case "${enableval}" in + yes) glouglou=true ;; + no) glouglou=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-glouglou) ;; +esac],[glouglou=false]) +AM_CONDITIONAL(HAVE_GLOUGLOU, test x$glouglou = xtrue) + AC_OUTPUT([ Makefile data/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 7f6bd71..f8135a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,18 +12,26 @@ module_la_SOURCES = \ elife_edje_external.c module_la_LIBADD = @ELIFE_LIBS@ -module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h bin_PROGRAMS = elife - elife_SOURCES = \ elife_evas_smart.c \ elife.c elife_CPPFLAGS = \ @ELIFE_CFLAGS@ + +if HAVE_GLOUGLOU +module_la_LDFLAGS = -module -avoid-version -lglouglou -levent +module_la_CFLAGS = -DHAVE_GLOUGLOU +elife_LDADD = \ + @ELIFE_LIBS@ -lglouglou -levent +elife_CFLAGS = -DHAVE_GLOUGLOU +else +module_la_LDFLAGS = -module -avoid-version elife_LDADD = \ @ELIFE_LIBS@ +endif clean-local: rm -rf *~ diff --git a/src/elife_evas_smart.c b/src/elife_evas_smart.c index ff744f8..bde26ff 100644 --- a/src/elife_evas_smart.c +++ b/src/elife_evas_smart.c @@ -23,6 +23,10 @@ #include "elife_evas_smart.h" +#ifdef HAVE_GLOUGLOU +#include <libglouglou.h> +#endif + #define NCELL_X 100 #define NCELL_Y 100 #define INJECT_PROBA 40 @@ -82,6 +86,10 @@ struct grid { int cell_pix_w, cell_pix_h; int age; enum lifemode mode; +#ifdef HAVE_GLOUGLOU + struct gg_client *ggcli; + struct event_base *ev_base; +#endif }; static struct grid *grid_new(Evas_Object *container, @@ -112,7 +120,7 @@ static void _elife_object_color_set(Evas_Object *o, int r, int g, int b, int static void _elife_object_clip_set(Evas_Object *o, Evas_Object *clip); static void _elife_object_clip_unset(Evas_Object *o); */ -static void *xmalloc(size_t size); +void *xmalloc(size_t size); static struct { Evas_Smart_Class klass; @@ -140,6 +148,19 @@ static struct { #define _G elife_evas_smart_g }; +#ifdef HAVE_GLOUGLOU +int +gg_packet(struct gg_client *cli, struct gg_packet *pkt) +{ + struct grid *grid; + + grid = cli->usrdata; + grid_inject_pattern(grid); + + return 0; +} +#endif + static struct grid * grid_new(Evas_Object *container, int w, int h, enum lifemode mode) { @@ -179,12 +200,21 @@ grid_new(Evas_Object *container, int w, int h, enum lifemode mode) } } +#ifdef HAVE_GLOUGLOU + g->ev_base = event_base_new(); + g->ggcli = gg_client_connect(g->ev_base, "127.0.0.1", GLOUGLOU_ANALY_DEFAULT_PORT, + NULL, gg_packet, g); +#endif + return g; } static void grid_del(struct grid *grid) { +#ifdef HAVE_GLOUGLOU + gg_client_disconnect(grid->ggcli); +#endif free(grid->cells); free(grid->mem); free(grid); @@ -240,8 +270,12 @@ grid_evolution(struct grid *grid) } } +#ifdef HAVE_GLOUGLOU + event_base_loop(grid->ev_base, EVLOOP_NONBLOCK); +#else if (rand() % INJECT_PROBA == 0) grid_inject_pattern(grid); +#endif for (j=0; j<grid->h; j++) { for (i=0; i<grid->w; i++) { @@ -492,7 +526,7 @@ _elife_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h) grid_redraw(grid, w, h); } -static void * +void * xmalloc(size_t size) { void *x; |