X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fspotlight.c;h=a47e55c746fc1c410f1dfc24488fd7ff343a39ec;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hp=aade77df66dfa1eb3b0e4505147838ecc601a646;hpb=50be9bb40dc60130c99ffa568e6677779904ff70;p=xscreensaver diff --git a/hacks/spotlight.c b/hacks/spotlight.c index aade77df..a47e55c7 100644 --- a/hacks/spotlight.c +++ b/hacks/spotlight.c @@ -38,7 +38,7 @@ struct state { int delay; int duration; time_t start_time; - + int first_time; GC window_gc; #ifdef DEBUG GC white_gc; @@ -138,6 +138,8 @@ spotlight_init (Display *dpy, Window window) st->pm = XCreatePixmap(st->dpy, st->window, st->sizex, st->sizey, xgwa.depth); XClearWindow(st->dpy, st->window); + st->first_time = 1; + /* create buffer to reduce flicker */ #ifdef HAVE_COCOA /* Don't second-guess Quartz's double-buffering */ st->buffer = 0; @@ -149,10 +151,6 @@ spotlight_init (Display *dpy, Window window) if (st->buffer) XFillRectangle(st->dpy, st->buffer, st->buffer_gc, 0, 0, st->sizex, st->sizey); - /* blank out screen */ - XFillRectangle(st->dpy, st->window, st->window_gc, 0, 0, st->sizex, st->sizey); - XSetWindowBackground (st->dpy, st->window, bg); - /* create clip mask (so it's a circle, not a square) */ clip_pm = XCreatePixmap(st->dpy, st->window, st->radius*4, st->radius*4, 1); st->img_loader = load_image_async_simple (0, xgwa.screen, st->window, st->pm, @@ -184,6 +182,10 @@ spotlight_init (Display *dpy, Window window) gcv.foreground = fg; st->white_gc = XCreateGC(st->dpy, st->window, gcflags, &gcv); #endif + + /* blank out screen */ + XFillRectangle(st->dpy, st->window, st->window_gc, 0, 0, st->sizex, st->sizey); + return st; } @@ -252,6 +254,12 @@ onestep (struct state *st, Bool first_p) XSetClipOrigin(st->dpy, st->buffer_gc, st->x,st->y); XCopyArea(st->dpy, st->pm, st->buffer, st->buffer_gc, st->x, st->y, st->s, st->s, st->x, st->y); + if (st->first_time) { + /* blank out screen */ + XFillRectangle(st->dpy, st->window, st->window_gc, 0, 0, st->sizex, st->sizey); + st->first_time = 0; + } + /* copy buffer to screen (window) */ XCopyArea(st->dpy, st->buffer, st->window, st->window_gc, st->x , st->y, st->s, st->s, st->x, st->y); } @@ -282,6 +290,12 @@ spotlight_reshape (Display *dpy, Window window, void *closure, static Bool spotlight_event (Display *dpy, Window window, void *closure, XEvent *event) { + struct state *st = (struct state *) closure; + if (screenhack_event_helper (dpy, window, event)) + { + st->start_time = 0; + return True; + } return False; } @@ -312,6 +326,10 @@ static const char *spotlight_defaults [] = { "*delay: 10000", "*duration: 120", "*radius: 125", +#ifdef USE_IPHONE + "*ignoreRotation: True", + "*rotateImages: True", +#endif 0 };