X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utils%2Fgrabclient.c;h=abe069b3dd1a0b3d1dcb1d7322c198061f30e951;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=6eec38430d320b26e5b6ea7618d4beed788de9b5;hpb=aa75c7476aeaa84cf3abc192b376a8b03c325213;p=xscreensaver diff --git a/utils/grabclient.c b/utils/grabclient.c index 6eec3843..abe069b3 100644 --- a/utils/grabclient.c +++ b/utils/grabclient.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1992-2016 Jamie Zawinski +/* xscreensaver, Copyright (c) 1992-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 @@ -44,7 +44,7 @@ load_image_async CB load_random_image_cocoa - osx_grab_desktop_image (osxgrabscreen.m, MacOS version) + osx_grab_desktop_image (grabclient-osx.m, MacOS version) copy_framebuffer_to_ximage XPutImage draw_colorbars @@ -62,7 +62,7 @@ load_image_async CB load_random_image_cocoa - osx_grab_desktop_image (osxgrabscreen.m, iOS version) + osx_grab_desktop_image (grabclient-osx.m, iOS version) CGWindowListCreateImage jwxyz_draw_NSImage_or_CGImage draw_colorbars @@ -72,7 +72,7 @@ CB name, geom, closure - Andrid execution path: + Android execution path: load_image_async CB load_random_image_android @@ -671,7 +671,7 @@ xscreensaver_getimage_file_cb (XtPointer closure, int *source, XtInputId *id) XGetGeometry (dpy, clo2->drawable, &r, &x, &y, &w, &h, &bbw, &d); draw_colorbars (clo2->screen, xgwa.visual, clo2->drawable, xgwa.colormap, - 0, 0, w, h); + 0, 0, w, h, 0, 0); /* #### logo missing */ geom.x = geom.y = 0; geom.width = w; geom.height = h; @@ -702,7 +702,7 @@ xscreensaver_getimage_file_cb (XtPointer closure, int *source, XtInputId *id) # else /* HAVE_COCOA && USE_IPHONE -- iOS */ /* Callback for ios_load_random_image(), called after we have loaded an - image from the iOS device's Photo Library. See iosgrabimage.m. + image from the iOS device's Photo Library. See grabclient-ios.m. */ static void ios_load_random_image_cb (void *uiimage, const char *filename, @@ -740,7 +740,7 @@ ios_load_random_image_cb (void *uiimage, const char *filename, else /* Probably means no images in the gallery. */ { draw_colorbars (clo2->screen, xgwa.visual, clo2->drawable, xgwa.colormap, - 0, 0, w, h); + 0, 0, w, h, 0, 0); /* #### logo missing */ geom.x = geom.y = 0; geom.width = w; geom.height = h; @@ -783,7 +783,12 @@ osx_load_image_file_async (Screen *screen, Window xwindow, Drawable drawable, (XtPointer) (XtInputReadMask | XtInputExceptMask), xscreensaver_getimage_file_cb, (XtPointer) clo2); # else /* USE_IPHONE */ - ios_load_random_image (ios_load_random_image_cb, clo2); + { + XWindowAttributes xgwa; + XGetWindowAttributes (DisplayOfScreen (screen), xwindow, &xgwa); + ios_load_random_image (ios_load_random_image_cb, clo2, + xgwa.width, xgwa.height); + } # endif /* USE_IPHONE */ } @@ -850,8 +855,8 @@ load_random_image_cocoa (Screen *screen, Window window, Drawable drawable, } if (! done) - draw_colorbars (screen, xgwa.visual, drawable, xgwa.colormap, - 0, 0, xgwa.width, xgwa.height); + draw_colorbars (screen, xgwa.visual, drawable, xgwa.colormap, 0, 0, + xgwa.width, xgwa.height, 0, 0); /* #### logo missing */ /* If we got here, we loaded synchronously, so we're done. */ callback (screen, window, drawable, name, &geom, closure); @@ -873,10 +878,6 @@ load_random_image_android (Screen *screen, Window window, Drawable drawable, Display *dpy = DisplayOfScreen (screen); XWindowAttributes xgwa; XRectangle geom; - char *name = 0; - char *data = 0; - int width = 0; - int height = 0; if (!drawable) abort(); @@ -895,26 +896,16 @@ load_random_image_android (Screen *screen, Window window, Drawable drawable, geom.width = xgwa.width; geom.height = xgwa.height; - data = jwxyz_load_random_image (dpy, &width, &height, &name); - if (! data) - draw_colorbars (screen, xgwa.visual, drawable, xgwa.colormap, - 0, 0, xgwa.width, xgwa.height); - else - { - XImage *img = XCreateImage (dpy, xgwa.visual, 32, - ZPixmap, 0, data, width, height, 0, 0); - XGCValues gcv; - GC gc; - gcv.foreground = BlackPixelOfScreen (screen); - gc = XCreateGC (dpy, drawable, GCForeground, &gcv); - XFillRectangle (dpy, drawable, gc, 0, 0, xgwa.width, xgwa.height); - XPutImage (dpy, drawable, gc, img, 0, 0, - (xgwa.width - width) / 2, - (xgwa.height - height) / 2, - width, height); - XDestroyImage (img); - XFreeGC (dpy, gc); - } + XGCValues gcv; + gcv.foreground = BlackPixelOfScreen (screen); + GC gc = XCreateGC (dpy, drawable, GCForeground, &gcv); + XFillRectangle (dpy, drawable, gc, 0, 0, xgwa.width, xgwa.height); + char *name = jwxyz_draw_random_image (dpy, drawable, gc); + if (! name) { + draw_colorbars (screen, xgwa.visual, drawable, xgwa.colormap, 0, 0, + xgwa.width, xgwa.height, 0, 0); /* #### logo missing */ + } + XFreeGC (dpy, gc); callback (screen, window, drawable, name, &geom, closure); if (name) free (name);