summaryrefslogtreecommitdiffstats
path: root/patches/DirectFB-examples-1.2.0/selectable_default_penguin_population.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/DirectFB-examples-1.2.0/selectable_default_penguin_population.diff')
-rw-r--r--patches/DirectFB-examples-1.2.0/selectable_default_penguin_population.diff45
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/DirectFB-examples-1.2.0/selectable_default_penguin_population.diff b/patches/DirectFB-examples-1.2.0/selectable_default_penguin_population.diff
new file mode 100644
index 000000000..87b3bc7dd
--- /dev/null
+++ b/patches/DirectFB-examples-1.2.0/selectable_default_penguin_population.diff
@@ -0,0 +1,45 @@
+Subject: selectable default penguin population
+From: Luotao Fu <l.fu@pengutronix.de>
+
+ This one makes the default penguin population selectable though environment
+ variable "PENGUIN". This way we can start the control this on boards without
+ a keyboard.
+
+Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
+
+---
+ src/df_andi.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+Index: src/df_andi.c
+===================================================================
+--- src/df_andi.c.orig
++++ src/df_andi.c
+@@ -566,6 +566,7 @@ int main( int argc, char *argv[] )
+ FPSData fps;
+ int quit = 0;
+ int clipping = 0;
++ unsigned long int default_population = 200;
+
+ init_resources( argc, argv );
+
+@@ -573,7 +574,18 @@ int main( int argc, char *argv[] )
+
+ initialize_animation();
+
+- spawn_penguins( 200 );
++ if (getenv("PENGUINS"))
++ default_population = strtoul(getenv("PENGUINS"), NULL, 10);
++
++ if (default_population > 2000) {
++ fprintf(stderr, "ERR: %ld are more penguins than we can afford,",
++ default_population);
++ default_population = 200;
++ fprintf(stderr, " setting default population back to %ld\n",
++ default_population);
++ }
++
++ spawn_penguins( default_population );
+
+ primary->SetDrawingFlags( primary, DSDRAW_BLEND );
+