ftp://ftp.linux.ncsu.edu/mirror/ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os...
[xscreensaver] / utils / grabscreen.h
1 /* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997, 2001, 2003, 2004
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 /* Like the above, but loads the image in the background and runs the
40    given callback once it has been loaded.
41  */
42 extern void fork_load_random_image (Screen *screen, Window window,
43                                     Drawable drawable,
44                                     void (*callback) (Screen *, Window,
45                                                       Drawable,
46                                                       const char *name,
47                                                       void *closure),
48                                     void *closure);
49
50
51 /* Whether one should use GCSubwindowMode when drawing on this window
52    (assuming a screen image has been grabbed onto it.)  Yes, this is a
53    total kludge. */
54 extern Bool use_subwindow_mode_p(Screen *screen, Window window);
55
56 /* Whether the given window is:
57    - the real root window;
58    - the virtual root window;
59    - a direct child of the root window;
60    - a direct child of the window manager's decorations.
61  */
62 extern Bool top_level_window_p(Screen *screen, Window window);
63
64
65 /* Don't call this: this is for the "xscreensaver-getimage" program only. */
66 extern void grab_screen_image_internal (Screen *, Window);
67
68 /* Don't use this: this is how "xscreensaver-getimage" and "grabclient.c"
69    pass the file name around. */
70 #define XA_XSCREENSAVER_IMAGE_FILENAME "_SCREENSAVER_IMAGE_FILENAME"
71
72 #endif /* __GRABSCREEN_H__ */