X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fcompass.c;h=1dc1d3ea7a4ccbda961e9c9abf94dc6ca5f73bb2;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=5b9ba4990ec51febf325ae04183ec366d5bc14cf;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/compass.c b/hacks/compass.c index 5b9ba499..1dc1d3ea 100644 --- a/hacks/compass.c +++ b/hacks/compass.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1999 Jamie Zawinski +/* xscreensaver, Copyright (c) 1999-2018 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 @@ -822,14 +822,22 @@ compass_init (Display *dpy, Window window) st->delay = get_integer_resource (st->dpy, "delay", "Integer"); st->dbuf = get_boolean_resource (st->dpy, "doubleBuffer", "Boolean"); -# ifdef HAVE_COCOA /* Don't second-guess Quartz's double-buffering */ +# ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */ st->dbuf = False; # endif XGetWindowAttributes (st->dpy, st->window, &st->xgwa); st->size2 = MIN(st->xgwa.width, st->xgwa.height); - if (st->size2 > 600) st->size2 = 600; + if (st->xgwa.width > st->xgwa.height * 5 || /* goofy aspect ratio */ + st->xgwa.height > st->xgwa.width * 5) + st->size2 = MAX(st->xgwa.width, st->xgwa.height); + + { + int max = 600; + if (st->xgwa.width > 2560) max *= 2; /* Retina displays */ + if (st->size2 > max) st->size2 = max; + } st->size = (st->size2 / 2) * 0.8; @@ -933,6 +941,11 @@ static void compass_reshape (Display *dpy, Window window, void *closure, unsigned int w, unsigned int h) { + struct state *st = (struct state *) closure; + XGetWindowAttributes (st->dpy, st->window, &st->xgwa); + st->size2 = MIN(st->xgwa.width, st->xgwa.height); + st->x = st->xgwa.width/2; + st->y = st->xgwa.height/2; } static Bool