1 /* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997, 2001, 2003, 2004, 2005
2 * Jamie Zawinski <jwz@jwz.org>
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
13 #ifndef __GRABSCREEN_H__
14 #define __GRABSCREEN_H__
16 /* This will write an image onto the given Drawable.
17 The Drawable (arg 3) may be a Window or a Pixmap.
19 The Window must be the top-level window. The image *may or may not*
20 be written to the window, though it will definitely be written to
21 the drawable. It's fine for args 2 and 3 to be the same window, or
22 for arg 2 to be a Window, and arg 3 to be a Pixmap.
24 The loaded image might be from a file, or from a screen shot of the
25 desktop, or from the system's video input, depending on user
28 If it is from a file, then it will be returned in `filename_return'.
29 filename_return may be NULL; also, NULL may be returned (e.g., if
30 it's a screenshot or video capture.) You are responsible for
33 The size and position of the image is returned in `geometry_return'.
34 The image will generally have been scaled up to fit the window, but
35 if a loaded file had a different aspect ratio than the window, it
36 will have been centered, and the returned coords will describe that.
38 Many colors may be allocated from the window's colormap.
40 extern void load_random_image (Screen *screen,
41 Window top_level_window,
42 Drawable target_window_or_pixmap,
43 char **filename_return,
44 XRectangle *geometry_return);
46 /* Like the above, but loads the image in the background and runs the
47 given callback once it has been loaded. Copy `name' if you want
50 extern void fork_load_random_image (Screen *screen, Window window,
52 void (*callback) (Screen *, Window,
60 /* Whether one should use GCSubwindowMode when drawing on this window
61 (assuming a screen image has been grabbed onto it.) Yes, this is a
63 extern Bool use_subwindow_mode_p(Screen *screen, Window window);
65 /* Whether the given window is:
66 - the real root window;
67 - the virtual root window;
68 - a direct child of the root window;
69 - a direct child of the window manager's decorations.
71 extern Bool top_level_window_p(Screen *screen, Window window);
74 /* Don't call this: this is for the "xscreensaver-getimage" program only. */
75 extern void grab_screen_image_internal (Screen *, Window);
77 /* Don't use these: this is how "xscreensaver-getimage" and "grabclient.c"
78 pass the file name around. */
79 #define XA_XSCREENSAVER_IMAGE_FILENAME "_SCREENSAVER_IMAGE_FILENAME"
80 #define XA_XSCREENSAVER_IMAGE_GEOMETRY "_SCREENSAVER_IMAGE_GEOMETRY"
82 #endif /* __GRABSCREEN_H__ */