+/* 2017 MacOS 10.12 interminable software update, by jwz.
+ */
+static struct bsod_state *
+macx_install (Display *dpy, Window window)
+{
+ struct bsod_state *bst = make_bsod_state (dpy, window, "macinstall", "MacX");
+
+ Pixmap pixmap = 0;
+ int pix_w = apple_width;
+ int pix_h = apple_height;
+ int x, y;
+ int bw1, bh1;
+ int bw2, bh2;
+
+ unsigned long fg = get_pixel_resource (dpy, bst->xgwa.colormap,
+ "macinstall.foreground",
+ "Mac.Foreground");
+ unsigned long bg = get_pixel_resource (dpy, bst->xgwa.colormap,
+ "macinstall.background",
+ "Mac.Background");
+ unsigned long fg2 = get_pixel_resource (dpy, bst->xgwa.colormap,
+ "macinstall.barForeground",
+ "Mac.Foreground");
+ unsigned long bg2 = get_pixel_resource (dpy, bst->xgwa.colormap,
+ "macinstall.barBackground",
+ "Mac.Background");
+ char buf[1024];
+ int lh = bst->font->ascent + bst->font->descent;
+ int i, min;
+ double pct;
+
+ pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) apple_bits,
+ apple_width, apple_height,
+ fg, bg, bst->xgwa.depth);
+ bst->pixmap = pixmap;
+
+ x = (bst->xgwa.width - pix_w) / 2;
+ y = (bst->xgwa.height) / 2 - pix_h;
+ if (y < 0) y = 0;
+
+ XSetLineAttributes (dpy, bst->gc, 1, LineSolid, CapRound, JoinMiter);
+
+ BSOD_COLOR(bst, bg, bg);
+ BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
+ BSOD_COLOR(bst, fg, bg);
+ BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, x, y);
+ y += pix_h * 2 - lh;
+
+ /* progress bar */
+ bw1 = pix_w * 2.5;
+ bh1 = lh * 0.66;
+ if (bh1 < 8) bh1 = 8;
+
+ x = (bst->xgwa.width - bw1) / 2;
+ BSOD_COLOR(bst, fg2, bg);
+ BSOD_LINE (bst, x, y, x + bw1, y, bh1);
+
+ bw2 = bw1 - 1;
+ bh2 = bh1 - 4;
+ BSOD_COLOR(bst, bg2, bg);
+ BSOD_LINE (bst, x+1, y, x + bw2, y, bh2);
+
+ BSOD_COLOR(bst, fg, bg);
+ BSOD_LINE (bst, x, y, x + 1, y, bh1);
+
+ pct = 5 + (random() % 40);
+ min = 5 + (random() % 40);
+
+ for (i = 0; i < 100; i++) {
+ pct += frand(0.3);
+ min += (random() % 3) - 1; /* sometimes down, mostly up */
+
+ if (pct > 90) pct = 90;
+ BSOD_RECT (bst, True, x, y - bh1/2, bw1 * pct / 100, bh1);
+
+ sprintf (buf, " Installing Software Update: about %d minutes. ", min);
+ bst->y = y + lh * 3;
+ BSOD_TEXT (bst, CENTER, buf);
+ BSOD_PAUSE (bst, 1000000);
+ }
+
+ return bst;
+}
+