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.27.tar.gz
[xscreensaver]
/
hacks
/
maze.c
diff --git
a/hacks/maze.c
b/hacks/maze.c
index d963ad3e754ac48ef77664ab6eb86d409a66ac18..10704fa77f90f852440a3e3cbb6afe17b70adb51 100644
(file)
--- a/
hacks/maze.c
+++ b/
hacks/maze.c
@@
-93,10
+93,11
@@
#include <stdio.h>
/* #include <X11/bitmaps/gray1> */
#include <stdio.h>
/* #include <X11/bitmaps/gray1> */
+/*
#define gray1_width 2
#define gray1_height 2
static const char gray1_bits[] = { 0x01, 0x02 };
#define gray1_width 2
#define gray1_height 2
static const char gray1_bits[] = { 0x01, 0x02 };
-
+*/
#define MAX_MAZE_SIZE_X 1000
#define MAX_MAZE_SIZE_Y 1000
#define MAX_MAZE_SIZE_X 1000
#define MAX_MAZE_SIZE_Y 1000
@@
-210,12
+211,17
@@
set_maze_sizes (struct state *st, int width, int height)
static void
initialize_maze (struct state *st)
{
static void
initialize_maze (struct state *st)
{
+ int retry_count = 0;
int i, j, wall;
int logow = 1 + st->logo_width / st->grid_width;
int logoh = 1 + st->logo_height / st->grid_height;
AGAIN:
int i, j, wall;
int logow = 1 + st->logo_width / st->grid_width;
int logoh = 1 + st->logo_height / st->grid_height;
AGAIN:
+ /* This can happen if the window is really small. Let's not sweat it. */
+ if (++retry_count > 100) return;
+
+
/* initialize all squares */
for ( i=0; i<st->maze_size_x; i++) {
for ( j=0; j<st->maze_size_y; j++) {
/* initialize all squares */
for ( i=0; i<st->maze_size_x; i++) {
for ( j=0; j<st->maze_size_y; j++) {
@@
-1472,7
+1478,7
@@
maze_init (Display *dpy_arg, Window window_arg)
st->logo_map = xscreensaver_logo (xgwa.screen, xgwa.visual, st->window,
xgwa.colormap, bg,
&pixels, &npixels, &logo_mask,
st->logo_map = xscreensaver_logo (xgwa.screen, xgwa.visual, st->window,
xgwa.colormap, bg,
&pixels, &npixels, &logo_mask,
- xgwa.width > 800);
+ xgwa.width > 800
|| xgwa.height > 800
);
if (logo_mask) {
XSetClipMask (st->dpy, st->logo_gc, logo_mask);
XFreePixmap (st->dpy, logo_mask);
if (logo_mask) {
XSetClipMask (st->dpy, st->logo_gc, logo_mask);
XFreePixmap (st->dpy, logo_mask);
@@
-1583,6
+1589,9
@@
maze_draw (Display *dpy, Window window, void *closure)
st->stop = 0;
st->state = 1;
st->stop = 0;
st->state = 1;
+ if (st->solve_state && st->solve_state->running)
+ st->solve_state->running = 0;
+
st->sync_p = ((random() % 4) != 0);
size = get_integer_resource (st->dpy, "gridSize", "Dimension");
st->sync_p = ((random() % 4) != 0);
size = get_integer_resource (st->dpy, "gridSize", "Dimension");