http://ftp.nluug.nl/pub/os/Linux/distr/pardusrepo/sources/xscreensaver-5.02.tar.gz
[xscreensaver] / driver / xscreensaver.h
1 /* xscreensaver, Copyright (c) 1993-2006 Jamie Zawinski <jwz@jwz.org>
2  *
3  * Permission to use, copy, modify, distribute, and sell this software and its
4  * documentation for any purpose is hereby granted without fee, provided that
5  * the above copyright notice appear in all copies and that both that
6  * copyright notice and this permission notice appear in supporting
7  * documentation.  No representations are made about the suitability of this
8  * software for any purpose.  It is provided "as is" without express or 
9  * implied warranty.
10  */
11
12 #ifndef __XSCREENSAVER_H__
13 #define __XSCREENSAVER_H__
14
15 #include <stdlib.h>
16 #ifdef HAVE_UNISTD_H
17 # include <unistd.h>
18 #endif
19
20 #include <string.h>
21 #include <stdio.h>
22
23 #ifdef HAVE_SIGACTION
24 # include <signal.h>    /* for sigset_t */
25 #endif
26
27 #include "prefs.h"
28
29 extern char *progname;
30 extern char *progclass;
31
32 #undef countof
33 #define countof(x) (sizeof((x))/sizeof((*x)))
34
35 \f
36
37 /* =======================================================================
38    server extensions and virtual roots
39    ======================================================================= */
40
41 extern Bool restore_real_vroot (saver_info *si);
42 extern void disable_builtin_screensaver (saver_info *, Bool unblank_screen_p);
43 extern Bool ensure_no_screensaver_running (Display *, Screen *);
44
45 #ifdef HAVE_MIT_SAVER_EXTENSION
46 extern Bool query_mit_saver_extension (saver_info *);
47 #endif
48 #ifdef HAVE_SGI_SAVER_EXTENSION
49 extern Bool query_sgi_saver_extension (saver_info *);
50 #endif
51 #ifdef HAVE_XIDLE_EXTENSION
52 extern Bool query_xidle_extension (saver_info *);
53 #endif
54 #ifdef HAVE_RANDR
55 extern Bool query_randr_extension (saver_info *);
56 #endif
57 #ifdef HAVE_PROC_INTERRUPTS
58 extern Bool query_proc_interrupts_available (saver_info *, const char **why);
59 #endif
60
61 /* Display Power Management System (DPMS) interface. */
62 extern Bool monitor_powered_on_p (saver_info *si);
63 extern void monitor_power_on (saver_info *si);
64
65
66 /* =======================================================================
67    blanking
68    ======================================================================= */
69
70 extern void initialize_screensaver_window (saver_info *si);
71 extern void raise_window (saver_info *si,
72                             Bool inhibit_fade, Bool between_hacks_p,
73                             Bool dont_clear);
74 extern Bool blank_screen (saver_info *si);
75 extern void unblank_screen (saver_info *si);
76 extern void resize_screensaver_window (saver_info *si);
77
78 extern void get_screen_viewport (saver_screen_info *ssi,
79                                  int *x_ret, int *y_ret,
80                                  int *w_ret, int *h_ret,
81                                  int target_x, int target_y,
82                                  Bool verbose_p);
83
84
85 /* =======================================================================
86    locking
87    ======================================================================= */
88
89 #ifndef NO_LOCKING
90 extern Bool unlock_p (saver_info *si);
91 extern Bool lock_priv_init (int argc, char **argv, Bool verbose_p);
92 extern Bool lock_init (int argc, char **argv, Bool verbose_p);
93 extern Bool passwd_valid_p (const char *typed_passwd, Bool verbose_p);
94 #endif /* NO_LOCKING */
95
96 extern void set_locked_p (saver_info *si, Bool locked_p);
97 extern int move_mouse_grab (saver_info *si, Window to, Cursor cursor,
98                             int to_screen_no);
99 extern int mouse_screen (saver_info *si);
100
101
102 /* =======================================================================
103    runtime privileges
104    ======================================================================= */
105
106 extern void hack_uid (saver_info *si);
107 extern void describe_uids (saver_info *si, FILE *out);
108
109 /* =======================================================================
110    demoing
111    ======================================================================= */
112
113 extern void draw_shaded_rectangle (Display *dpy, Window window,
114                                    int x, int y,
115                                    int width, int height,
116                                    int thickness,
117                                    unsigned long top_color,
118                                    unsigned long bottom_color);
119 extern int string_width (XFontStruct *font, char *s);
120
121 extern void make_splash_dialog (saver_info *si);
122 extern void handle_splash_event (saver_info *si, XEvent *e);
123
124
125 /* =======================================================================
126    timers
127    ======================================================================= */
128
129 extern void start_notice_events_timer (saver_info *, Window, Bool verbose_p);
130 extern void cycle_timer (XtPointer si, XtIntervalId *id);
131 extern void activate_lock_timer (XtPointer si, XtIntervalId *id);
132 extern void reset_watchdog_timer (saver_info *si, Bool on_p);
133 extern void idle_timer (XtPointer si, XtIntervalId *id);
134 extern void de_race_timer (XtPointer si, XtIntervalId *id);
135 extern void sleep_until_idle (saver_info *si, Bool until_idle_p);
136 extern void reset_timers (saver_info *si);
137 extern void schedule_wakeup_event (saver_info *si, Time when, Bool verbose_p);
138
139
140 /* =======================================================================
141    remote control
142    ======================================================================= */
143
144 extern Bool handle_clientmessage (saver_info *, XEvent *, Bool);
145 extern void maybe_reload_init_file (saver_info *);
146
147 /* =======================================================================
148    subprocs
149    ======================================================================= */
150
151 extern void handle_signals (saver_info *si);
152 #ifdef HAVE_SIGACTION
153  extern sigset_t block_sigchld (void);
154 #else  /* !HAVE_SIGACTION */
155  extern int block_sigchld (void);
156 #endif /* !HAVE_SIGACTION */
157 extern void unblock_sigchld (void);
158 extern void hack_environment (saver_info *si);
159 extern void hack_subproc_environment (saver_screen_info *ssi);
160 extern void init_sigchld (void);
161 extern void spawn_screenhack (saver_info *si, Bool first_time_p);
162 extern pid_t fork_and_exec (saver_screen_info *ssi, const char *command);
163 extern void kill_screenhack (saver_info *si);
164 extern void suspend_screenhack (saver_info *si, Bool suspend_p);
165 extern Bool screenhack_running_p (saver_info *si);
166 extern void emergency_kill_subproc (saver_info *si);
167 extern Bool select_visual (saver_screen_info *ssi, const char *visual_name);
168 extern void store_saver_status (saver_info *si);
169 extern const char *signal_name (int signal);
170
171 /* =======================================================================
172    subprocs diagnostics
173    ======================================================================= */
174
175 extern FILE *real_stderr;
176 extern FILE *real_stdout;
177 extern void initialize_stderr (saver_info *si);
178 extern void reset_stderr (saver_screen_info *ssi);
179 extern void clear_stderr (saver_screen_info *ssi);
180 extern void shutdown_stderr (saver_info *si);
181
182
183 /* =======================================================================
184    misc
185    ======================================================================= */
186
187 extern const char *blurb (void);
188 extern void save_argv (int argc, char **argv);
189 extern void saver_exit (saver_info *si, int status, const char *core_reason);
190 extern void restart_process (saver_info *si);
191
192 extern int saver_ehandler (Display *dpy, XErrorEvent *error);
193 extern int BadWindow_ehandler (Display *dpy, XErrorEvent *error);
194 extern Bool window_exists_p (Display *dpy, Window window);
195 extern char *timestring (void);
196 extern Bool display_is_on_console_p (saver_info *si);
197 extern Visual *get_best_gl_visual (saver_screen_info *ssi);
198 extern void check_for_leaks (const char *where);
199
200 extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
201 extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
202 extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
203 extern Atom XA_DEMO, XA_PREFS;
204
205 #endif /* __XSCREENSAVER_H__ */