X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fdistort.c;h=ffaaa53e6b186539bfac5a44d77f4a5c8f76bda1;hb=8eb2873d7054e705c4e83f22d18c40946a9e2529;hp=4218418f201628b8b54c2969a506736196883d0e;hpb=5832fe184606766fef23369159306c0a5799aeb0;p=xscreensaver diff --git a/hacks/distort.c b/hacks/distort.c index 4218418f..ffaaa53e 100644 --- a/hacks/distort.c +++ b/hacks/distort.c @@ -113,6 +113,8 @@ static void init_distort(Display *dpy, Window window) if (get_boolean_resource("bounce", "Boolean")) effect = &move_lense; + XGetWindowAttributes (dpy, window, &xgwa); + if (effect == NULL && radius == 0 && speed == 0 && number == 0 && !blackhole && !vortex && !magnify && !reflect) { /* if no cmdline options are given, randomly choose one of: @@ -201,6 +203,9 @@ static void init_distort(Display *dpy, Window window) abort(); break; } + /* but if the window is small, reduce default radius */ + if (xgwa.width < radius * 8) + radius = xgwa.width/8; } if (delay < 0) @@ -222,7 +227,6 @@ static void init_distort(Display *dpy, Window window) if (draw == NULL) draw = &plain_draw; - XGetWindowAttributes (dpy, window, &xgwa); black_pixel = BlackPixelOfScreen( xgwa.screen ); gcv.function = GXcopy; @@ -533,9 +537,9 @@ static void plain_draw(int k) XShmPutImage(g_dpy, g_window, gc, buffer_map, 0, 0, xy_coo[k].x, xy_coo[k].y, 2*radius+speed+2, 2*radius+speed+2, False); else -# endif if (!use_shm) +# endif XPutImage(g_dpy, g_window, gc, buffer_map, 0, 0, xy_coo[k].x, xy_coo[k].y, 2*radius+speed+2, 2*radius+speed+2);