diff options
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | PKGBUILD | 6 | ||||
-rw-r--r-- | xmatrix-color.diff | 370 |
3 files changed, 176 insertions, 210 deletions
@@ -1,8 +1,6 @@ -# Generated by mksrcinfo v8 -# Thu Jul 6 13:56:52 UTC 2017 pkgbase = xscreensaver-xmatrix-color pkgdesc = Screen saver and locker for the X Window System, modified xmatrix with variable color. - pkgver = 5.37 + pkgver = 5.39 pkgrel = 1 url = http://www.jwz.org/xscreensaver/ arch = i686 @@ -20,13 +18,13 @@ pkgbase = xscreensaver-xmatrix-color provides = xscreensaver conflicts = xscreensaver backup = etc/pam.d/xscreensaver - source = http://www.jwz.org/xscreensaver/xscreensaver-5.37.tar.gz + source = http://www.jwz.org/xscreensaver/xscreensaver-5.39.tar.gz source = xscreensaver-add-electricsheep.diff source = xmatrix-color.diff source = LICENSE - sha1sums = 22e438589c25a485a12ba5ae8462e38c5f5f0e07 + sha1sums = 7166c9f4a860785e0829df046f0328f5be74c0d7 sha1sums = e8dc57b6471fb3867ee099304ac6bf628351cb98 - sha1sums = 8b63742086f2f8b3c97a3383ba370df5f5a27622 + sha1sums = faca46b814a8791dfe3619e755089ecb88ddf71c sha1sums = bf8995d86609cdab678ca277ae685407f82691db pkgname = xscreensaver-xmatrix-color @@ -1,7 +1,7 @@ # $Id$ pkgname=xscreensaver-xmatrix-color -pkgver=5.37 +pkgver=5.39 pkgrel=1 pkgdesc="Screen saver and locker for the X Window System, modified xmatrix with variable color." arch=('i686' 'x86_64') @@ -17,9 +17,9 @@ source=(http://www.jwz.org/xscreensaver/${pkgname%%-*}-${pkgver}.tar.gz xscreensaver-add-electricsheep.diff xmatrix-color.diff LICENSE) -sha1sums=('22e438589c25a485a12ba5ae8462e38c5f5f0e07' +sha1sums=('7166c9f4a860785e0829df046f0328f5be74c0d7' 'e8dc57b6471fb3867ee099304ac6bf628351cb98' - '8b63742086f2f8b3c97a3383ba370df5f5a27622' + 'faca46b814a8791dfe3619e755089ecb88ddf71c' 'bf8995d86609cdab678ca277ae685407f82691db') prepare() { diff --git a/xmatrix-color.diff b/xmatrix-color.diff index 9b628af4103f..13a74593b138 100644 --- a/xmatrix-color.diff +++ b/xmatrix-color.diff @@ -1,152 +1,60 @@ ---- hacks/xmatrix.c 2014-10-05 01:35:38.000000000 -0500 -+++ hacks/xmatrix.c.mod 2015-07-23 12:54:20.337356781 -0500 -@@ -232,8 +232,97 @@ - - +--- hacks/xmatrix.c 2018-04-06 16:44:02.000000000 -0500 ++++ hacks/xmatrix.c.mod 2018-06-17 11:54:17.229608887 -0500 +@@ -219,6 +219,8 @@ static void -+edit_image (char ** bits, int which, const char * shift_text) -+{ -+ /* Horrible kludge that will extrapolate the existing "green" -+ * color codes in the .xpm files to generate other basic -+ * RGB mixed colors with varied success. */ -+ -+ char colors_text[3]; /* Number of colors declared, must be double digit */ -+ char *hex; /* The entire hex char* array for a color */ -+ char dark_hex[3]; /* the two-digit value for a dark color */ -+ char light_hex[3]; /* the two-digit value for a light color */ -+ int colors_int; /* the integer corresponding to colors_text */ -+ int index; /* loop index */ -+ static const int sizeof_char = sizeof(char); -+ -+ /*printf("\nColor Shift: %s", shift_text);*/ -+ /*printf("\nBits: %s", bits[3]);*/ -+ colors_text[0] = bits[0][8]; -+ colors_text[1] = bits[0][9]; -+ colors_text[2] = '\0'; -+ colors_int = atoi(colors_text); -+ /*printf("\nNumber of colors: %i", colors_int);*/ -+ for (index = 3; index <= colors_int; ++index) -+ { -+ /* Remember that when your college professor -+ * says "memory is cheap" that this is the -+ * road you are led down */ -+ hex = malloc(sizeof_char * 12); /* memory is cheap */ -+ memmove(hex, bits[index], 11*sizeof_char); -+ memmove(dark_hex, hex+5,2*sizeof_char); -+ memmove(light_hex, hex+7,2*sizeof_char); -+ dark_hex[2] = '\0'; -+ light_hex[2] = '\0'; -+ hex[11] = '\0'; -+ /*printf("\nhex: %s, Dark: %s, Light: %s", bits[index], dark_hex, light_hex);*/ -+ if (!strcasecmp(shift_text, "yellow")) -+ { -+ memmove(hex+5, light_hex, 2*sizeof_char); -+ bits[index]=hex; -+ } -+ else if (!strcasecmp(shift_text, "red")) -+ { -+ memmove(hex+5, light_hex, 2*sizeof_char); -+ memmove(hex+7, dark_hex, 2*sizeof_char); -+ bits[index]=hex; -+ } -+ else if (!strcasecmp(shift_text, "blue")) -+ { -+ memmove(hex+9, light_hex, 2*sizeof_char); -+ memmove(hex+7, dark_hex, 2*sizeof_char); -+ bits[index]=hex; -+ } -+ else if (!strcasecmp(shift_text, "purple")) -+ { -+ memmove(hex+5, light_hex, 2*sizeof_char); -+ memmove(hex+7, dark_hex, 2*sizeof_char); -+ memmove(hex+9, light_hex, 2*sizeof_char); -+ bits[index]=hex; -+ } -+ else if (!strcasecmp(shift_text, "aqua")) -+ { -+ memmove(hex+9, light_hex, 2*sizeof_char); -+ bits[index]=hex; -+ } -+ else if (!strcasecmp(shift_text, "white")) -+ { -+ memmove(hex+5, light_hex, 2*sizeof_char); -+ memmove(hex+7, light_hex, 2*sizeof_char); -+ memmove(hex+9, light_hex, 2*sizeof_char); -+ bits[index]=hex; -+ } -+ else if (!strcasecmp(shift_text, "grey")) -+ { -+ memmove(hex+5, dark_hex, 2*sizeof_char); -+ memmove(hex+7, dark_hex, 2*sizeof_char); -+ memmove(hex+9, dark_hex, 2*sizeof_char); -+ } -+ else if (!strcasecmp(shift_text, "green")) -+ { -+ /* Really? */ -+ } -+ /*printf(" New Color: %s", bits[index]);*/ -+ } -+} -+ -+ -+static void load_images_1 (Display *dpy, m_state *state, int which) { + /* Get the -color-shift argument. */ + const char *shift_text = get_string_resource(dpy, "colorShift", "String"); -+ - #if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) - if (!get_boolean_resource (dpy, "mono", "Boolean") && - state->xgwa.depth > 1) -@@ -242,6 +331,12 @@ - (which == 1 ? (state->small_p ? matrix1b_xpm : matrix1_xpm) : - (state->small_p ? matrix2b_xpm : matrix2_xpm)); - -+ /* Edit 2D array of char data here */ -+ if (shift_text != NULL) -+ { -+ edit_image(bits, which, shift_text); -+ } -+ - state->images[which] = - xpm_data_to_pixmap (state->dpy, state->window, bits, - &state->image_width, &state->image_height, 0); -@@ -253,8 +348,16 @@ - unsigned long fg, bg; - state->image_width = (state->small_p ? matrix1b_width :matrix1_width); - state->image_height = (state->small_p ? matrix1b_height:matrix1_height); -- fg = get_pixel_resource(state->dpy, state->xgwa.colormap, -- "foreground", "Foreground"); -+ if (shift_text != NULL) -+ { -+ fg = get_pixel_resource(state->dpy, state->xgwa.colormap, -+ "colorShift", "Foreground"); -+ } -+ else -+ { -+ fg = get_pixel_resource(state->dpy, state->xgwa.colormap, -+ "foreground", "Foreground"); -+ } - bg = get_pixel_resource(state->dpy, state->xgwa.colormap, - "background", "Background"); - state->images[which] = -@@ -596,6 +699,40 @@ + const unsigned char *png = 0; + unsigned long size = 0; + if (which == 1) +@@ -236,8 +238,8 @@ + png = matrix2_png, size = sizeof(matrix2_png); + } + state->images[which] = +- image_data_to_pixmap (state->dpy, state->window, png, size, +- &state->image_width, &state->image_height, 0); ++ image_data_to_pixmap_shift (state->dpy, state->window, png, size, ++ &state->image_width, &state->image_height, 0, shift_text); } -+static int -+densitizer (int x) -+{ +@@ -1049,26 +1051,38 @@ + } + } + +- + static int + densitizer (m_state *state) + { +- /* Horrid kludge that converts percentages (density of screen coverage) +- to the parameter that actually controls this. I got this mapping +- empirically, on a 1024x768 screen. Sue me. */ +- if (state->density < 10) return 85; +- else if (state->density < 15) return 60; +- else if (state->density < 20) return 45; +- else if (state->density < 25) return 25; +- else if (state->density < 30) return 20; +- else if (state->density < 35) return 15; +- else if (state->density < 45) return 10; +- else if (state->density < 50) return 8; +- else if (state->density < 55) return 7; +- else if (state->density < 65) return 5; +- else if (state->density < 80) return 3; +- else if (state->density < 90) return 2; +- else return 1; + /* Best fit curve to replace old table. -+ * Now you can twiddle single % values ++ * Now you can twiddle single % values + * and its technically doing something. + * y = a * exp(b*x) + * See 'densitizer.sce' for comparison. */ -+ ++ + /* Declare variables */ + double a, b; + int y; -+ ++ int x = state->density; ++ + /* Clean input */ + if (x > 100) { + x = 100; @@ -154,87 +62,43 @@ + else if (x < 1) { + x = 1; + } -+ ++ + /* Set exp function params */ + a=211.538187957; + b=-0.0488730165089; -+ ++ + /* Calculate result, used in xmatrix_init() + * and hack_matrix() */ + y=a*exp(b*x); -+ ++ + /*printf("\nDensitizer. x=%d, y=%d", x, y);*/ + return(y); -+} -+ -+ - static void * - xmatrix_init (Display *dpy, Window window) - { -@@ -673,7 +810,7 @@ - calloc (sizeof(m_cell), state->grid_width * state->grid_height); - state->feeders = (m_feeder *) calloc (sizeof(m_feeder), state->grid_width); - -- state->density = get_integer_resource (dpy, "density", "Integer"); -+ state->density = densitizer(get_integer_resource (dpy, "density", "Integer")); - - insert = get_string_resource(dpy, "insert", "Insert"); - if (insert && !strcmp(insert, "top")) -@@ -1082,28 +1219,6 @@ } --static int --densitizer (m_state *state) --{ -- /* Horrid kludge that converts percentages (density of screen coverage) -- to the parameter that actually controls this. I got this mapping -- empirically, on a 1024x768 screen. Sue me. */ -- if (state->density < 10) return 85; -- else if (state->density < 15) return 60; -- else if (state->density < 20) return 45; -- else if (state->density < 25) return 25; -- else if (state->density < 30) return 20; -- else if (state->density < 35) return 15; -- else if (state->density < 45) return 10; -- else if (state->density < 50) return 8; -- else if (state->density < 55) return 7; -- else if (state->density < 65) return 5; -- else if (state->density < 80) return 3; -- else if (state->density < 90) return 2; -- else return 1; --} -- -- - static void - hack_text (m_state *state) - { -@@ -1503,7 +1618,7 @@ - if (f->remaining > 0) /* never change if pipe isn't empty */ - continue; - -- if ((random() % densitizer(state)) != 0) /* then change N% of the time */ -+ if ((random() % state->density) != 0) /* then change N% of the time */ - continue; +@@ -1823,6 +1837,7 @@ + "*usePty: False", + "*program: xscreensaver-text --latin1", + "*geometry: 960x720", ++ ".colorShift: green", + 0 + }; - f->remaining = 3 + (random() % state->grid_height); -@@ -1854,6 +1969,9 @@ +@@ -1850,6 +1865,7 @@ { "-pipe", ".usePipe", XrmoptionNoArg, "True" }, { "-no-pipe", ".usePipe", XrmoptionNoArg, "False" }, { "-program", ".program", XrmoptionSepArg, 0 }, -+ { "-bg", ".background", XrmoptionSepArg, 0 }, -+ { "-fg", ".foreground", XrmoptionSepArg, 0 }, + { "-color-shift", ".colorShift", XrmoptionSepArg, 0 }, { 0, 0, 0, 0 } }; ---- hacks/config/xmatrix.xml 2015-06-13 18:08:53.000000000 -0500 -+++ hacks/config/xmatrix.xml.mod 2015-07-23 12:54:20.337356781 -0500 +--- hacks/config/xmatrix.xml 2016-04-07 21:15:38.000000000 -0500 ++++ hacks/config/xmatrix.xml.mod 2018-06-17 11:54:17.229608887 -0500 @@ -25,6 +25,16 @@ <option id="top" _label="Slider algorithm" arg-set="-insert top"/> <option id="bottom" _label="Expansion algorithm" arg-set="-insert bottom"/> </select> -+ ++ + <select id="color"> + <option id="color_green" _label="Green"/> + <option id="color_blue" _label="Blue" arg-set="-color-shift blue"/> @@ -247,27 +111,22 @@ </hgroup> <hgroup> ---- hacks/xmatrix.man 2011-08-03 13:44:25.000000000 -0500 -+++ hacks/xmatrix.man.mod 2015-07-23 12:54:20.340690085 -0500 -@@ -26,6 +26,8 @@ +--- hacks/xmatrix.man 2018-04-08 12:56:39.000000000 -0500 ++++ hacks/xmatrix.man.mod 2018-06-17 11:54:17.229608887 -0500 +@@ -26,6 +26,7 @@ [\-mode \fImode\fP] [\-phone \fInumber\fP] [\-fps] -+[\-mono [\-fg #XXXXXX] [\-bg #XXXXXX]] +[\-color\-shift "color"] .SH DESCRIPTION The \fIxmatrix\fP program draws the 2D "digital rain" effect, as seen on the computer monitors in the Wachowski brothers' film, "The Matrix". -@@ -120,6 +122,16 @@ +@@ -120,6 +121,12 @@ xmatrix -ascii -program 'ps -eo comm | rev' xmatrix -program 'od -txC -w6 /dev/random' xmatrix -program 'cat /dev/random' + +.TP 8 -+.B \-mono -+Force use of XBM files, which only allows one foreground color. -+Set custom hex colors with -fg and -bg. -+.TP 8 +.B \-color-shift +Specify a simple color shift to one of: +red, blue, green, purple, yellow, aqua, white, grey @@ -275,3 +134,112 @@ .EE .SH ENVIRONMENT .PP +--- hacks/ximage-loader.c 2018-04-07 22:05:20.000000000 -0500 ++++ hacks/ximage-loader.c.mod 2018-06-17 11:54:17.229608887 -0500 +@@ -503,7 +503,8 @@ + make_pixmap (Display *dpy, Window window, + const char *filename, + const unsigned char *image_data, unsigned long data_size, +- int *width_ret, int *height_ret, Pixmap *mask_ret) ++ int *width_ret, int *height_ret, Pixmap *mask_ret, ++ const char * shift_text) + { + XWindowAttributes xgwa; + XImage *in, *out, *mask = 0; +@@ -576,6 +577,44 @@ + unsigned char b = (p >> cbpos) & 0xFF; + unsigned char g = (p >> cgpos) & 0xFF; + unsigned char r = (p >> crpos) & 0xFF; ++ ++ if (!strcasecmp(shift_text, "yellow")) ++ { ++ r = g; ++ } ++ else if (!strcasecmp(shift_text, "red")) ++ { ++ unsigned char tmp = r; ++ r = g; ++ g = tmp; ++ } ++ else if (!strcasecmp(shift_text, "blue")) ++ { ++ unsigned char tmp = b; ++ b = g; ++ g = tmp; ++ } ++ else if (!strcasecmp(shift_text, "purple")) ++ { ++ unsigned char tmp = r; ++ r = g; ++ b = g; ++ g = tmp; ++ } ++ else if (!strcasecmp(shift_text, "aqua")) ++ { ++ b = g; ++ } ++ else if (!strcasecmp(shift_text, "white")) ++ { ++ r = g; ++ b = g; ++ } ++ else if (!strcasecmp(shift_text, "grey")) ++ { ++ g = r; ++ } ++ + XPutPixel (out, x, y, ((r << srpos) | + (g << sgpos) | + (b << sbpos) | +@@ -638,13 +677,23 @@ + + + Pixmap +-image_data_to_pixmap (Display *dpy, Window window, ++image_data_to_pixmap_shift (Display *dpy, Window window, ++ const unsigned char *image_data, unsigned long data_size, ++ int *width_ret, int *height_ret, ++ Pixmap *mask_ret, const char * shift_text) ++{ ++ return make_pixmap (dpy, window, 0, image_data, data_size, ++ width_ret, height_ret, mask_ret, shift_text); ++} ++ ++Pixmap ++image_data_to_pixmap (Display *dpy, Window window, + const unsigned char *image_data, unsigned long data_size, + int *width_ret, int *height_ret, + Pixmap *mask_ret) + { + return make_pixmap (dpy, window, 0, image_data, data_size, +- width_ret, height_ret, mask_ret); ++ width_ret, height_ret, mask_ret, ""); + } + + Pixmap +@@ -653,7 +702,7 @@ + Pixmap *mask_ret) + { + return make_pixmap (dpy, window, filename, 0, 0, +- width_ret, height_ret, mask_ret); ++ width_ret, height_ret, mask_ret, ""); + } + + +--- hacks/ximage-loader.h 2018-03-19 16:54:48.000000000 -0500 ++++ hacks/ximage-loader.h.mod 2018-06-17 11:54:17.229608887 -0500 +@@ -17,7 +17,13 @@ + int *width_ret, int *height_ret, + Pixmap *mask_ret); + +-extern Pixmap image_data_to_pixmap (Display *, Window, ++extern Pixmap image_data_to_pixmap_shift (Display *, Window, ++ const unsigned char *image_data, ++ unsigned long data_size, ++ int *width_ret, int *height_ret, ++ Pixmap *mask_ret, const char * shift_text); ++ ++extern Pixmap image_data_to_pixmap (Display *, Window, + const unsigned char *image_data, + unsigned long data_size, + int *width_ret, int *height_ret, |