X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fmemscroller.c;h=52119122900164221bdf49143f1062420a2b95d9;hb=88cfe534a698a0562e81345957a50714af1453bc;hp=d82d16f55f2cad0ef55057e02771fcf8bd9309c8;hpb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;p=xscreensaver diff --git a/hacks/memscroller.c b/hacks/memscroller.c index d82d16f5..52119122 100644 --- a/hacks/memscroller.c +++ b/hacks/memscroller.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2002-2012 Jamie Zawinski +/* xscreensaver, Copyright (c) 2002-2015 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,6 +21,10 @@ #undef countof #define countof(x) (sizeof(x)/sizeof(*(x))) +#ifndef USE_IPHONE +# define READ_FILES +#endif + typedef struct { int which; XRectangle rect; @@ -82,7 +86,7 @@ memscroller_init (Display *dpy, Window window) { int ncolors = 255; XColor colors[256]; - make_random_colormap (st->dpy, st->xgwa.visual, st->xgwa.colormap, + make_random_colormap (st->xgwa.screen, st->xgwa.visual, st->xgwa.colormap, colors, &ncolors, True, True, 0, False); } @@ -163,7 +167,9 @@ memscroller_init (Display *dpy, Window window) s = 0; +# ifdef READ_FILES st->filename = get_string_resource (dpy, "filename", "Filename"); +# endif if (!st->filename || !*st->filename || @@ -171,12 +177,16 @@ memscroller_init (Display *dpy, Window window) !strcasecmp (st->filename, "(mem)") || !strcasecmp (st->filename, "(memory)")) st->seed_mode = SEED_RAM; +# ifdef READ_FILES else if (st->filename && (!strcasecmp (st->filename, "(rand)") || !strcasecmp (st->filename, "(random)"))) st->seed_mode = SEED_RANDOM; else st->seed_mode = SEED_FILE; +# else + st->seed_mode = SEED_RANDOM; +# endif st->nscrollers = 3; st->scrollers = (scroller *) calloc (st->nscrollers, sizeof(scroller)); @@ -270,6 +280,7 @@ reshape_memscroller (state *st) +# ifdef READ_FILES static void open_file (state *st) { @@ -288,6 +299,19 @@ open_file (state *st) exit (1); } } +#endif + + +/* "The brk and sbrk functions are historical curiosities left over + from earlier days before the advent of virtual memory management." + -- sbrk(2) man page on BSD systems, as of 1995 or so. + */ +#ifdef HAVE_SBRK +# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) /* gcc >= 4.2 */ + /* Don't print "warning: 'sbrk' is deprecated". */ +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +# endif +#endif static unsigned int @@ -333,10 +357,6 @@ more_bits (state *st, scroller *sc) sc->data = lomem; # ifdef HAVE_SBRK /* re-get it each time through */ - /* "The brk and sbrk functions are historical curiosities left over - from earlier days before the advent of virtual memory management." - -- sbrk(2) man page on MacOS - */ himem = ((unsigned char *) sbrk(0)) - (2 * sizeof(void *)); # endif @@ -416,6 +436,7 @@ more_bits (state *st, scroller *sc) pv = PACK(); break; +# ifdef READ_FILES case SEED_FILE: { int i; @@ -460,6 +481,7 @@ more_bits (state *st, scroller *sc) pv = PACK(); } break; +# endif /* READ_FILES */ default: abort(); @@ -604,13 +626,13 @@ static const char *memscroller_defaults [] = { ".foreground: #00FF00", "*borderSize: 2", -#if defined(HAVE_COCOA) && !defined(USE_IPHONE) - ".font1: OCR A Std 192, Lucida Console 192", - ".font2: OCR A Std 144, Lucida Console 144", - ".font3: OCR A Std 128, Lucida Console 128", - ".font4: OCR A Std 96, Lucida Console 96", - ".font5: OCR A Std 48, Lucida Console 48", - ".font6: OCR A Std 24, Lucida Console 24", +#if defined(HAVE_COCOA) + ".font1: OCR A Std 192, Lucida Console 192, Monaco 192", + ".font2: OCR A Std 144, Lucida Console 144, Monaco 144", + ".font3: OCR A Std 128, Lucida Console 128, Monaco 128", + ".font4: OCR A Std 96, Lucida Console 96, Monaco 96", + ".font5: OCR A Std 48, Lucida Console 48, Monaco 48", + ".font6: OCR A Std 24, Lucida Console 24, Monaco 24", #else /* !HAVE_COCOA */ ".font1: -*-courier-bold-r-*-*-*-1440-*-*-m-*-*-*", ".font2: -*-courier-bold-r-*-*-*-960-*-*-m-*-*-*",