projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.39.tar.gz
[xscreensaver]
/
hacks
/
barcode.c
diff --git
a/hacks/barcode.c
b/hacks/barcode.c
index 7e15d0d4b01622348a533abc5f70156a50068e47..31574bd214049472ed49177241dc2c08a33eeddb 100644
(file)
--- a/
hacks/barcode.c
+++ b/
hacks/barcode.c
@@
-14,6
+14,7
@@
*/
#include <math.h>
*/
#include <math.h>
+#include <time.h>
#include "screenhack.h"
/* non-user-modifiable immutable definitions */
#include "screenhack.h"
/* non-user-modifiable immutable definitions */
@@
-824,7
+825,7
@@
static void drawDigitChar (struct state *st, Bitmap *b, int x, int y, char c)
if ((c < '0') || (c > '9'))
c = '0';
if ((c < '0') || (c > '9'))
c = '0';
-
bitmapDrawChar5x8 (b, x, y, c);
+ bitmapDrawChar5x8 (b, x, y, c);
}
/* draw a upc/ean digit at the given coordinates */
}
/* draw a upc/ean digit at the given coordinates */
@@
-1634,6
+1635,12
@@
static void scrollModel (struct state *st)
st->barcodes[st->barcode_count - 1].mag * BARCODE_WIDTH);
barcode->x += RAND_FLOAT_01 * 100;
barcode->mag = RAND_FLOAT_01 * MAX_MAG;
st->barcodes[st->barcode_count - 1].mag * BARCODE_WIDTH);
barcode->x += RAND_FLOAT_01 * 100;
barcode->mag = RAND_FLOAT_01 * MAX_MAG;
+
+ if (st->windowWidth < 100 || st->windowHeight < 100) {
+ barcode->mag *= 0.5;
+ if (barcode->mag <= 0) barcode->mag = 1;
+ }
+
barcode->y =
RAND_FLOAT_01 * (st->windowHeight - BARCODE_HEIGHT * barcode->mag);
if (barcode->y < 0)
barcode->y =
RAND_FLOAT_01 * (st->windowHeight - BARCODE_HEIGHT * barcode->mag);
if (barcode->y < 0)
@@
-1898,6
+1905,9
@@
static void
barcode_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
barcode_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
+ struct state *st = (struct state *) closure;
+ st->windowWidth = w;
+ st->windowHeight = h;
}
static void
}
static void
@@
-1911,6
+1921,7
@@
barcode_free (Display *dpy, Window window, void *closure)
static const char *barcode_defaults [] = {
".background: black",
".foreground: green",
static const char *barcode_defaults [] = {
".background: black",
".foreground: green",
+ ".lowrez: true",
"*fpsSolid: true",
"*delay: 10000",
"*mode: scroll",
"*fpsSolid: true",
"*delay: 10000",
"*mode: scroll",