-/* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997, 1998, 2003, 2004
- * Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1992-2016 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
the difference between drawing on the actual root window, and on the fake
root window used by the screensaver, since at this level the illusion
breaks down...
+
+ The hacks themselves use utils/grabclient.c to invoke the
+ "xscreensaver-getimage" program as a sub-process.
+
+ On "real" X11 systems:
+
+ "driver/xscreensaver-getimage" runs the code in this file to grab
+ the X11 root window image as a Pixmap.
+
+ On MacOS systems running X11, which nobody does any more:
+
+ "driver/xscreensaver-getimage" runs the Perl script
+ "driver/xscreensaver-getimage-desktop", which in turn runs the MacOS
+ program "/usr/sbin/screencapture" to get the Mac desktop image as a
+ PNG file.
+
+ On MacOS systems running the native Cocoa build, or on iOS or Android
+ systems:
+
+ "driver/xscreensaver-getimage" is not used. Instead, each saver's
+ "utils/grabclient.c" links against "OSX/grabclient-osx.m",
+ "OSX/grabclient-ios.m" or "jwxyz/jwxyz-android.c" to grab
+ screenshots directly without invoking a sub-process to do it.
+
+ See the comment at the top of utils/grabclient.c for a more detailed
+ explanation.
*/
#include "utils.h"
double unmap = 0;
if (saver_p)
{
- unmap = get_float_resource("grabRootDelay", "Seconds");
+ unmap = get_float_resource(dpy, "grabRootDelay", "Seconds");
if (unmap <= 0.00001 || unmap > 20) unmap = 2.5;
}
else
{
- unmap = get_float_resource("grabWindowDelay", "Seconds");
+ unmap = get_float_resource(dpy, "grabWindowDelay", "Seconds");
if (unmap <= 0.00001 || unmap > 20) unmap = 0.66;
}
unmap_time = unmap * 100000;
XQueryColors (dpy, from_cmap, old_colors, max_cells);
got_cells = max_cells;
- allocate_writable_colors (dpy, to_cmap, pixels, &got_cells);
+ allocate_writable_colors (screen, to_cmap, pixels, &got_cells);
if (grab_verbose_p && got_cells != max_cells)
fprintf(stderr, "%s: got only %d of %d cells\n", progname,
/* Makes and installs a colormap that makes a PseudoColor or DirectColor
visual behave like a TrueColor visual of the same depth.
+
+ #### Duplicated in driver/xscreensaver-getimage.c
*/
static void
allocate_cubic_colormap (Screen *screen, Window window, Visual *visual)
XGetWindowAttributes (dpy, window, &xgwa);
cmap = xgwa.colormap;
- depth = visual_depth(screen, visual);
+ depth = visual_depth (screen, visual);
switch (depth)
{
}
}
+/* Find the pixel index that is closest to the given color
+ (using linear distance in RGB space -- which is far from the best way.)
+
+ #### Duplicated in driver/xscreensaver-getimage.c
+ */
static unsigned long
find_closest_pixel (XColor *colors, int ncolors,
unsigned long r, unsigned long g, unsigned long b)
}
+/* Given an XImage with 8-bit or 12-bit RGB data, convert it to be
+ displayable with the given X colormap. The farther from a perfect
+ color cube the contents of the colormap are, the lossier the
+ transformation will be. No dithering is done.
+
+ #### Duplicated in driver/xscreensaver-getimage.c
+ */
void
remap_image (Screen *screen, Window window, Colormap cmap, XImage *image)
{