- midx = xlim/2;
- midy = ylim/2;
- r = get_integer_resource ("radius", "Integer");
- if (r <= 0 || r > min (xlim/2, ylim/2))
- r = min (xlim/2, ylim/2) - 50;
- vx = get_integer_resource ("vx", "Integer");
- vy = get_integer_resource ("vy", "Integer");
- npoints = get_integer_resource ("points", "Integer");
- if (npoints < 1)
- npoints = 3 + (random () % 5);
- balls = (struct ball *) malloc (npoints * sizeof (struct ball));
- segments = get_integer_resource ("segments", "Integer");
- if (segments < 0) segments = 1;
- threshold = get_integer_resource ("threshold", "Integer");
- if (threshold < 0) threshold = 0;
- delay = get_integer_resource ("delay", "Integer");
- if (delay < 0) delay = 0;
- global_size = get_integer_resource ("size", "Integer");
- if (global_size < 0) global_size = 0;
- glow_p = get_boolean_resource ("glow", "Boolean");
- orbit_p = get_boolean_resource ("orbit", "Boolean");
- color_shift = get_integer_resource ("colorShift", "Integer");
- if (color_shift <= 0) color_shift = 5;
-
- /*flip mods for mouse interaction*/
- mouse_p = get_boolean_resource ("mouse", "Boolean");
- mouse_mass = get_integer_resource ("mouseSize", "Integer");
- mouse_mass = mouse_mass * mouse_mass *10;
-
- viscosity = get_float_resource ("viscosity", "Float");
-
- mode_str = get_string_resource ("mode", "Mode");
- if (! mode_str) mode = ball_mode;
- else if (!strcmp (mode_str, "balls")) mode = ball_mode;
- else if (!strcmp (mode_str, "lines")) mode = line_mode;
- else if (!strcmp (mode_str, "polygons")) mode = polygon_mode;
- else if (!strcmp (mode_str, "tails")) mode = tail_mode;
- else if (!strcmp (mode_str, "splines")) mode = spline_mode;
- else if (!strcmp (mode_str, "filled-splines")) mode = spline_filled_mode;
+ midx = st->xlim/2;
+ midy = st->ylim/2;
+ st->walls_p = get_boolean_resource (dpy, "walls", "Boolean");
+
+ /* if there aren't walls, don't set a limit on the radius */
+ r = get_integer_resource (dpy, "radius", "Integer");
+ if (r <= 0 || (r > min (st->xlim/2, st->ylim/2) && st->walls_p) )
+ r = min (st->xlim/2, st->ylim/2) - 50;
+
+ vx = get_integer_resource (dpy, "vx", "Integer");
+ vy = get_integer_resource (dpy, "vy", "Integer");
+
+ st->npoints = get_integer_resource (dpy, "points", "Integer");
+ if (st->npoints < 1)
+ st->npoints = 3 + (random () % 5);
+ st->balls = (struct ball *) malloc (st->npoints * sizeof (struct ball));
+
+ st->no_erase_yet = 1; /* for tail mode fix */
+
+ st->segments = get_integer_resource (dpy, "segments", "Integer");
+ if (st->segments < 0) st->segments = 1;
+
+ st->threshold = get_integer_resource (dpy, "threshold", "Integer");
+ if (st->threshold < 0) st->threshold = 0;
+
+ st->delay = get_integer_resource (dpy, "delay", "Integer");
+ if (st->delay < 0) st->delay = 0;
+
+ st->global_size = get_integer_resource (dpy, "size", "Integer");
+ if (st->global_size < 0) st->global_size = 0;
+
+ st->glow_p = get_boolean_resource (dpy, "glow", "Boolean");
+
+ st->orbit_p = get_boolean_resource (dpy, "orbit", "Boolean");
+
+ st->maxspeed_p = get_boolean_resource (dpy, "maxspeed", "Boolean");
+
+ st->cbounce_p = get_boolean_resource (dpy, "cbounce", "Boolean");
+
+ st->color_shift = get_integer_resource (dpy, "colorShift", "Integer");
+ if (st->color_shift <= 0) st->color_shift = 5;
+
+ st->viscosity = get_float_resource (dpy, "viscosity", "Float");
+
+ mode_str = get_string_resource (dpy, "mode", "Mode");
+ if (! mode_str) st->mode = ball_mode;
+ else if (!strcmp (mode_str, "balls")) st->mode = ball_mode;
+ else if (!strcmp (mode_str, "lines")) st->mode = line_mode;
+ else if (!strcmp (mode_str, "polygons")) st->mode = polygon_mode;
+ else if (!strcmp (mode_str, "tails")) st->mode = tail_mode;
+ else if (!strcmp (mode_str, "splines")) st->mode = spline_mode;
+ else if (!strcmp (mode_str, "filled-splines"))st->mode = spline_filled_mode;