1 /* xscreensaver, Copyright (c) 1993-2016 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);
50 extern Bool query_xinput_extension (saver_info *);
51 extern void init_xinput_extension (saver_info *si);
54 /* Display Power Management System (DPMS) interface. */
55 extern Bool monitor_powered_on_p (saver_info *si);
56 extern void monitor_power_on (saver_info *si, Bool on_p);
59 /* =======================================================================
61 ======================================================================= */
63 extern Bool update_screen_layout (saver_info *si);
64 extern void initialize_screensaver_window (saver_info *si);
65 extern void initialize_screen_root_widget (saver_screen_info *ssi);
67 extern void raise_window (saver_info *si,
68 Bool inhibit_fade, Bool between_hacks_p,
70 extern Bool blank_screen (saver_info *si);
71 extern void unblank_screen (saver_info *si);
72 extern void resize_screensaver_window (saver_info *si);
74 extern void get_screen_viewport (saver_screen_info *ssi,
75 int *x_ret, int *y_ret,
76 int *w_ret, int *h_ret,
77 int target_x, int target_y,
81 /* =======================================================================
83 ======================================================================= */
86 extern Bool unlock_p (saver_info *si);
87 extern Bool lock_priv_init (int argc, char **argv, Bool verbose_p);
88 extern Bool lock_init (int argc, char **argv, Bool verbose_p);
89 extern Bool passwd_valid_p (const char *typed_passwd, Bool verbose_p);
90 #endif /* NO_LOCKING */
92 extern void set_locked_p (saver_info *si, Bool locked_p);
93 extern int move_mouse_grab (saver_info *si, Window to, Cursor cursor,
95 extern int mouse_screen (saver_info *si);
98 /* =======================================================================
100 ======================================================================= */
102 extern void hack_uid (saver_info *si);
103 extern void describe_uids (saver_info *si, FILE *out);
105 /* =======================================================================
107 ======================================================================= */
109 extern void draw_shaded_rectangle (Display *dpy, Window window,
111 int width, int height,
113 unsigned long top_color,
114 unsigned long bottom_color);
115 extern int string_width (XFontStruct *font, char *s);
117 extern void make_splash_dialog (saver_info *si);
118 extern void handle_splash_event (saver_info *si, XEvent *e);
121 /* =======================================================================
123 ======================================================================= */
125 extern void start_notice_events_timer (saver_info *, Window, Bool verbose_p);
126 extern void cycle_timer (XtPointer si, XtIntervalId *id);
127 extern void activate_lock_timer (XtPointer si, XtIntervalId *id);
128 extern void reset_watchdog_timer (saver_info *si, Bool on_p);
129 extern void idle_timer (XtPointer si, XtIntervalId *id);
130 extern void de_race_timer (XtPointer si, XtIntervalId *id);
131 extern void sleep_until_idle (saver_info *si, Bool until_idle_p);
132 extern void reset_timers (saver_info *si);
133 extern void schedule_wakeup_event (saver_info *si, Time when, Bool verbose_p);
136 /* =======================================================================
138 ======================================================================= */
140 extern Bool handle_clientmessage (saver_info *, XEvent *, Bool);
141 extern void maybe_reload_init_file (saver_info *);
143 /* =======================================================================
145 ======================================================================= */
147 extern void handle_signals (saver_info *si);
148 #ifdef HAVE_SIGACTION
149 extern sigset_t block_sigchld (void);
150 #else /* !HAVE_SIGACTION */
151 extern int block_sigchld (void);
152 #endif /* !HAVE_SIGACTION */
153 extern void unblock_sigchld (void);
154 extern void hack_environment (saver_info *si);
155 extern void hack_subproc_environment (Screen *, Window saver_window);
156 extern void init_sigchld (void);
157 extern void spawn_screenhack (saver_screen_info *ssi);
158 extern pid_t fork_and_exec (saver_screen_info *ssi, const char *command);
159 extern void kill_screenhack (saver_screen_info *ssi);
160 extern void suspend_screenhack (saver_screen_info *ssi, Bool suspend_p);
161 extern Bool screenhack_running_p (saver_info *si);
162 extern void emergency_kill_subproc (saver_info *si);
163 extern Bool select_visual (saver_screen_info *ssi, const char *visual_name);
164 extern void store_saver_status (saver_info *si);
165 extern const char *signal_name (int signal);
167 /* =======================================================================
169 ======================================================================= */
171 extern FILE *real_stderr;
172 extern FILE *real_stdout;
173 extern void stderr_log_file (saver_info *si);
174 extern void initialize_stderr (saver_info *si);
175 extern void reset_stderr (saver_screen_info *ssi);
176 extern void clear_stderr (saver_screen_info *ssi);
177 extern void shutdown_stderr (saver_info *si);
180 /* =======================================================================
182 ======================================================================= */
184 extern const char *blurb (void);
185 extern void save_argv (int argc, char **argv);
186 extern void saver_exit (saver_info *si, int status, const char *core_reason);
187 extern void restart_process (saver_info *si);
189 extern int saver_ehandler (Display *dpy, XErrorEvent *error);
190 extern int BadWindow_ehandler (Display *dpy, XErrorEvent *error);
191 extern Bool window_exists_p (Display *dpy, Window window);
192 extern Bool in_signal_handler_p;
193 extern char *timestring (time_t);
194 extern Bool display_is_on_console_p (saver_info *si);
195 extern Visual *get_best_gl_visual (saver_info *si, Screen *screen);
196 extern void check_for_leaks (const char *where);
197 extern void describe_monitor_layout (saver_info *si);
199 #ifdef HAVE_XF86VMODE
200 Bool safe_XF86VidModeGetViewPort (Display *, int, int *, int *);
201 #endif /* HAVE_XF86VMODE */
203 extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
204 extern Atom XA_NET_WM_USER_TIME;
205 extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
206 extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
207 extern Atom XA_DEMO, XA_PREFS;
209 #endif /* __XSCREENSAVER_H__ */