3d9b16eb9e2cf92ed86e5c6ff3dddc2ae39a5b6e
[xscreensaver] / utils / grabscreen.h
1 /* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997, 2001, 2003
2  *  Jamie Zawinski <jwz@jwz.org>
3  *
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 
10  * implied warranty.
11  */
12
13 #ifndef __GRABSCREEN_H__
14 #define __GRABSCREEN_H__
15
16 /* This will write an image onto the given Drawable.
17    The Drawable (arg 3) may be a Window or a Pixmap.
18
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.
23
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
26    preferences.
27
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.)
31
32    Many colors may be allocated from the window's colormap.
33  */
34 extern void load_random_image (Screen *screen,
35                                Window top_level_window,
36                                Drawable target_window_or_pixmap, 
37                                char **filename_return);
38
39 /* Whether one should use GCSubwindowMode when drawing on this window
40    (assuming a screen image has been grabbed onto it.)  Yes, this is a
41    total kludge. */
42 extern Bool use_subwindow_mode_p(Screen *screen, Window window);
43
44 /* Whether the given window is:
45    - the real root window;
46    - the virtual root window;
47    - a direct child of the root window;
48    - a direct child of the window manager's decorations.
49  */
50 extern Bool top_level_window_p(Screen *screen, Window window);
51
52
53 /* Don't call this: this is for the "xscreensaver-getimage" program only. */
54 extern void grab_screen_image_internal (Screen *, Window);
55
56 /* Don't use this: this is how "xscreensaver-getimage" and "grabclient.c"
57    pass the file name around. */
58 #define XA_XSCREENSAVER_IMAGE_FILENAME "_SCREENSAVER_IMAGE_FILENAME"
59
60 #endif /* __GRABSCREEN_H__ */