summaryrefslogtreecommitdiff
path: root/app/xlockmore/modes/life.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-26 17:13:24 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-26 17:13:24 +0000
commit848535c62a7213ef065583f0a95895147fbae1f4 (patch)
tree0743361888643cddc0c3a3949ac2b4cbc89d3af7 /app/xlockmore/modes/life.c
parentd86b26dc74df28560bc19fa9dae8ca5dffb85bd8 (diff)
OpenBSD customizations/adaptations:
- icons - blank mode by default - BSD auth
Diffstat (limited to 'app/xlockmore/modes/life.c')
-rw-r--r--app/xlockmore/modes/life.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/app/xlockmore/modes/life.c b/app/xlockmore/modes/life.c
index 51c061340..33d962745 100644
--- a/app/xlockmore/modes/life.c
+++ b/app/xlockmore/modes/life.c
@@ -273,11 +273,13 @@ ModStruct life_description =
#endif
/* aliases for vars defined in the bitmap file */
+/*
#define CELL_WIDTH image_width
#define CELL_HEIGHT image_height
#define CELL_BITS image_bits
#include "life.xbm"
+*/
#ifdef XBM_GRELB
#include "life2.xbm"
#define CELL2_WIDTH image2_width
@@ -290,15 +292,16 @@ static XImage bimage =
#endif
#ifdef HAVE_XPM
-#define CELL_NAME image_name
-#if 1
-static char *image_name[] =
-{(char *) ""};
-#else
-/* Kind of boring... */
#include "life.xpm"
-#endif
-#define DEFAULT_XPM 0
+#define CELL_NAME life_xpm
+#define TRUE_CELL_WIDTH 26
+#define TRUE_CELL_HEIGHT 23
+#define DEFAULT_XPM 1
+#define XPATTERNS 4
+#define YPATTERNS 4
+#define CELL_BITS ""
+#define CELL_WIDTH TRUE_CELL_WIDTH * XPATTERNS
+#define CELL_HEIGHT TRUE_CELL_HEIGHT * YPATTERNS
#endif
#define REDRAWSTEP 2000 /* How many cells to draw per cycle */
@@ -1118,8 +1121,10 @@ draw_cell(ModeInfo * mi, cellstruct info)
#endif
{
(void) XPutImage(display, MI_WINDOW(mi), gc, lp->logo,
- 0, 0, lp->xb + lp->xs * col, lp->yb + lp->ys * row,
- lp->logo->width, lp->logo->height);
+ info.age%XPATTERNS * TRUE_CELL_WIDTH,
+ (info.age/XPATTERNS) * TRUE_CELL_HEIGHT,
+ lp->xb + lp->xs * col, lp->yb + lp->ys * row,
+ lp->logo->width/XPATTERNS, lp->logo->height/YPATTERNS);
}
}
} else { /* TRI */
@@ -1249,6 +1254,10 @@ setcellfromtoggle(ModeInfo * mi, int col, int row)
if ((MI_NPIXELS(mi) > 2) &&
(info.age < (unsigned short) (MI_NPIXELS(mi) * 0.7))) {
++(info.age);
+#ifdef XPATTERNS
+ if (info.age >= XPATTERNS * YPATTERNS)
+ info.age = XPATTERNS * YPATTERNS;
+#endif
/* cc: error 1405: "/opt/ansic/lbin/ccom"
terminated abnormally with signal 11.
*** Error exit code 9 */
@@ -2275,11 +2284,11 @@ init_life(ModeInfo * mi)
#else
if (size == 0 ||
MINGRIDSIZE * size > lp->width || MINGRIDSIZE * size > lp->height) {
- if (lp->width > MINGRIDSIZE * lp->logo->width &&
- lp->height > MINGRIDSIZE * lp->logo->height) {
+ if (lp->width > MINGRIDSIZE * lp->logo->width/XPATTERNS &&
+ lp->height > MINGRIDSIZE * lp->logo->height/YPATTERNS) {
lp->pixelmode = False;
- lp->xs = lp->logo->width;
- lp->ys = lp->logo->height;
+ lp->xs = lp->logo->width/XPATTERNS;
+ lp->ys = lp->logo->height/YPATTERNS;
} else
{
int min = MIN(lp->width, lp->height) / (8 * MINGRIDSIZE);