+#endif /* HAVE_ANDROID */
+
+
+
+/* Writes the string "Loading..." in the middle of the screen.
+ This will presumably get blown away when the image finally loads,
+ minutes or hours later...
+
+ This is called by load_image_async_simple() but not by load_image_async(),
+ since it is assumed that hacks that are loading more than one image
+ *at one time* will be doing something more clever than just blocking
+ with a blank screen.
+ */
+static void
+print_loading_msg (Screen *screen, Window window)
+{
+ Display *dpy = DisplayOfScreen (screen);
+ XWindowAttributes xgwa;
+ XGCValues gcv;
+ XFontStruct *f = 0;
+ GC gc;
+ char *fn = get_string_resource (dpy, "labelFont", "Font");
+ const char *text = "Loading...";
+ int w;
+
+ if (!fn) fn = get_string_resource (dpy, "titleFont", "Font");
+ if (!fn) fn = get_string_resource (dpy, "font", "Font");
+ if (!fn) fn = strdup ("-*-times-bold-r-normal-*-180-*");
+ f = XLoadQueryFont (dpy, fn);
+ if (!f) f = XLoadQueryFont (dpy, "fixed");
+ if (!f) abort();
+ free (fn);
+ fn = 0;
+
+ XGetWindowAttributes (dpy, window, &xgwa);
+ w = XTextWidth (f, text, (int) strlen(text));
+
+ gcv.foreground = get_pixel_resource (dpy, xgwa.colormap,
+ "foreground", "Foreground");
+ gcv.background = get_pixel_resource (dpy, xgwa.colormap,
+ "background", "Background");
+ gcv.font = f->fid;
+ gc = XCreateGC (dpy, window, GCFont | GCForeground | GCBackground, &gcv);
+ XDrawImageString (dpy, window, gc,
+ (xgwa.width - w) / 2,
+ (xgwa.height - (f->ascent + f->descent)) / 2 + f->ascent,
+ text, (int) strlen(text));
+ XFreeFont (dpy, f);
+ XFreeGC (dpy, gc);
+ XSync (dpy, False);
+}
+
+
+/* Loads an image into the Drawable in the background;
+ when the image is fully loaded, runs the callback.
+ When grabbing desktop images, the Window will be unmapped first.
+ */