X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fboxfit.c;h=1b1d0d717491a52eb8494ba77f27f4b3dc6ec39b;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=1fa42ca0e75d454d55e23bde6faf0965ec511683;hpb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;p=xscreensaver diff --git a/hacks/boxfit.c b/hacks/boxfit.c index 1fa42ca0..1b1d0d71 100644 --- a/hacks/boxfit.c +++ b/hacks/boxfit.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2005-2008 Jamie Zawinski +/* xscreensaver, Copyright (c) 2005-2014 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 @@ -17,7 +17,7 @@ #include "screenhack.h" #include -#include "xpm-pixmap.h" +#include "ximage-loader.h" #define ALIVE 1 #define CHANGED 2 @@ -39,6 +39,7 @@ typedef struct { int spacing; int inc; + int mode; Bool circles_p; Bool growing_p; Bool color_horiz_p; @@ -64,24 +65,22 @@ typedef struct { static void reset_boxes (state *st) { - int mode = -1; - st->nboxes = 0; st->growing_p = True; st->color_horiz_p = random() & 1; if (st->done_once && st->colors) - free_colors (st->dpy, st->xgwa.colormap, st->colors, st->ncolors); + free_colors (st->xgwa.screen, st->xgwa.colormap, st->colors, st->ncolors); if (!st->done_once) { char *s = get_string_resource (st->dpy, "mode", "Mode"); if (!s || !*s || !strcasecmp (s, "random")) - mode = -1; + st->mode = -1; else if (!strcasecmp (s, "squares") || !strcasecmp (s, "square")) - mode = 0; + st->mode = 0; else if (!strcasecmp (s, "circles") || !strcasecmp (s, "circle")) - mode = 1; + st->mode = 1; else { fprintf (stderr, @@ -91,10 +90,10 @@ reset_boxes (state *st) } } - if (mode == -1) + if (st->mode == -1) st->circles_p = random() & 1; else - st->circles_p = (mode == 1); + st->circles_p = (st->mode == 1); st->done_once = True; @@ -122,7 +121,7 @@ reset_boxes (state *st) { st->ncolors = get_integer_resource (st->dpy, "colors", "Colors"); /* re-get */ if (st->ncolors < 1) st->ncolors = 1; - make_smooth_colormap (st->dpy, st->xgwa.visual, st->xgwa.colormap, + make_smooth_colormap (st->xgwa.screen, st->xgwa.visual, st->xgwa.colormap, st->colors, &st->ncolors, True, 0, False); if (st->ncolors < 1) abort(); XClearWindow (st->dpy, st->window); @@ -504,10 +503,11 @@ static Bool boxfit_event (Display *dpy, Window window, void *closure, XEvent *event) { state *st = (state *) closure; - if (event->xany.type == ButtonPress) { - st->growing_p = !st->growing_p; - return True; - } + if (screenhack_event_helper (dpy, window, event)) + { + st->growing_p = !st->growing_p; + return True; + } return False; } @@ -530,8 +530,12 @@ static const char *boxfit_defaults [] = { "*borderSize: 1", "*grab: False", "*peek: False", - "*grabDesktopImages: False", /* HAVE_COCOA */ - "*chooseRandomImages: True", /* HAVE_COCOA */ + "*grabDesktopImages: False", /* HAVE_JWXYZ */ + "*chooseRandomImages: True", /* HAVE_JWXYZ */ +#ifdef HAVE_MOBILE + "*ignoreRotation: True", + "*rotateImages: True", +#endif 0 };