1 /* xscreensaver, Copyright (c) 1993-2008 Jamie Zawinski <jwz@jwz.org>
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
12 #ifndef __XSCREENSAVER_H__
13 #define __XSCREENSAVER_H__
24 # include <signal.h> /* for sigset_t */
29 extern char *progname;
30 extern char *progclass;
33 #define countof(x) (sizeof((x))/sizeof((*x)))
37 /* =======================================================================
38 server extensions and virtual roots
39 ======================================================================= */
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 *);
45 #ifdef HAVE_PROC_INTERRUPTS
46 extern Bool query_proc_interrupts_available (saver_info *, const char **why);
49 /* Display Power Management System (DPMS) interface. */
50 extern Bool monitor_powered_on_p (saver_info *si);
51 extern void monitor_power_on (saver_info *si);
54 /* =======================================================================
56 ======================================================================= */
58 extern Bool update_screen_layout (saver_info *si);
59 extern void initialize_screensaver_window (saver_info *si);
60 extern void initialize_screen_root_widget (saver_screen_info *ssi);
62 extern void raise_window (saver_info *si,
63 Bool inhibit_fade, Bool between_hacks_p,
65 extern Bool blank_screen (saver_info *si);
66 extern void unblank_screen (saver_info *si);
67 extern void resize_screensaver_window (saver_info *si);
69 extern void get_screen_viewport (saver_screen_info *ssi,
70 int *x_ret, int *y_ret,
71 int *w_ret, int *h_ret,
72 int target_x, int target_y,
76 /* =======================================================================
78 ======================================================================= */
81 extern Bool unlock_p (saver_info *si);
82 extern Bool lock_priv_init (int argc, char **argv, Bool verbose_p);
83 extern Bool lock_init (int argc, char **argv, Bool verbose_p);
84 extern Bool passwd_valid_p (const char *typed_passwd, Bool verbose_p);
85 #endif /* NO_LOCKING */
87 extern void set_locked_p (saver_info *si, Bool locked_p);
88 extern int move_mouse_grab (saver_info *si, Window to, Cursor cursor,
90 extern int mouse_screen (saver_info *si);
93 /* =======================================================================
95 ======================================================================= */
97 extern void hack_uid (saver_info *si);
98 extern void describe_uids (saver_info *si, FILE *out);
100 /* =======================================================================
102 ======================================================================= */
104 extern void draw_shaded_rectangle (Display *dpy, Window window,
106 int width, int height,
108 unsigned long top_color,
109 unsigned long bottom_color);
110 extern int string_width (XFontStruct *font, char *s);
112 extern void make_splash_dialog (saver_info *si);
113 extern void handle_splash_event (saver_info *si, XEvent *e);
116 /* =======================================================================
118 ======================================================================= */
120 extern void start_notice_events_timer (saver_info *, Window, Bool verbose_p);
121 extern void cycle_timer (XtPointer si, XtIntervalId *id);
122 extern void activate_lock_timer (XtPointer si, XtIntervalId *id);
123 extern void reset_watchdog_timer (saver_info *si, Bool on_p);
124 extern void idle_timer (XtPointer si, XtIntervalId *id);
125 extern void de_race_timer (XtPointer si, XtIntervalId *id);
126 extern void sleep_until_idle (saver_info *si, Bool until_idle_p);
127 extern void reset_timers (saver_info *si);
128 extern void schedule_wakeup_event (saver_info *si, Time when, Bool verbose_p);
131 /* =======================================================================
133 ======================================================================= */
135 extern Bool handle_clientmessage (saver_info *, XEvent *, Bool);
136 extern void maybe_reload_init_file (saver_info *);
138 /* =======================================================================
140 ======================================================================= */
142 extern void handle_signals (saver_info *si);
143 #ifdef HAVE_SIGACTION
144 extern sigset_t block_sigchld (void);
145 #else /* !HAVE_SIGACTION */
146 extern int block_sigchld (void);
147 #endif /* !HAVE_SIGACTION */
148 extern void unblock_sigchld (void);
149 extern void hack_environment (saver_info *si);
150 extern void hack_subproc_environment (Screen *, Window saver_window);
151 extern void init_sigchld (void);
152 extern void spawn_screenhack (saver_screen_info *ssi);
153 extern pid_t fork_and_exec (saver_screen_info *ssi, const char *command);
154 extern void kill_screenhack (saver_screen_info *ssi);
155 extern void suspend_screenhack (saver_screen_info *ssi, Bool suspend_p);
156 extern Bool screenhack_running_p (saver_info *si);
157 extern void emergency_kill_subproc (saver_info *si);
158 extern Bool select_visual (saver_screen_info *ssi, const char *visual_name);
159 extern void store_saver_status (saver_info *si);
160 extern const char *signal_name (int signal);
162 /* =======================================================================
164 ======================================================================= */
166 extern FILE *real_stderr;
167 extern FILE *real_stdout;
168 extern void stderr_log_file (saver_info *si);
169 extern void initialize_stderr (saver_info *si);
170 extern void reset_stderr (saver_screen_info *ssi);
171 extern void clear_stderr (saver_screen_info *ssi);
172 extern void shutdown_stderr (saver_info *si);
175 /* =======================================================================
177 ======================================================================= */
179 extern const char *blurb (void);
180 extern void save_argv (int argc, char **argv);
181 extern void saver_exit (saver_info *si, int status, const char *core_reason);
182 extern void restart_process (saver_info *si);
184 extern int saver_ehandler (Display *dpy, XErrorEvent *error);
185 extern int BadWindow_ehandler (Display *dpy, XErrorEvent *error);
186 extern Bool window_exists_p (Display *dpy, Window window);
187 extern char *timestring (void);
188 extern Bool display_is_on_console_p (saver_info *si);
189 extern Visual *get_best_gl_visual (saver_info *si, Screen *screen);
190 extern void check_for_leaks (const char *where);
191 extern void describe_monitor_layout (saver_info *si);
193 #ifdef HAVE_XF86VMODE
194 Bool safe_XF86VidModeGetViewPort (Display *, int, int *, int *);
195 #endif /* HAVE_XF86VMODE */
197 extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
198 extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
199 extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
200 extern Atom XA_DEMO, XA_PREFS;
202 #endif /* __XSCREENSAVER_H__ */