http://slackware.bholcomb.com/slackware/slackware-11.0/source/xap/xscreensaver/xscree...
[xscreensaver] / driver / prefs.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_PREFS_H__
13 #define __XSCREENSAVER_PREFS_H__
14
15 typedef struct screenhack screenhack;
16 struct screenhack {
17   Bool enabled_p;
18   char *visual;
19   char *name;
20   char *command;
21 };
22
23 typedef enum {
24   RANDOM_HACKS, ONE_HACK, BLANK_ONLY, DONT_BLANK, RANDOM_HACKS_SAME
25 } saver_mode;
26
27 typedef enum {
28   TEXT_DATE, TEXT_LITERAL, TEXT_FILE, TEXT_PROGRAM, TEXT_URL
29 } text_mode;
30
31 typedef struct saver_preferences saver_preferences;
32
33
34 /* This structure holds all the user-specified parameters, read from the
35    command line, the resource database, or entered through a dialog box.
36  */
37 struct saver_preferences {
38
39   XrmDatabase db;               /* The resource database into which the
40                                    init file is merged, and out of which the
41                                    preferences are parsed. */
42
43   time_t init_file_date;        /* The date (from stat()) of the .xscreensaver
44                                    file the last time this process read or
45                                    wrote it. */
46
47   Bool verbose_p;               /* whether to print out lots of status info */
48   Bool timestamp_p;             /* whether to mark messages with a timestamp */
49   Bool capture_stderr_p;        /* whether to redirect stdout/stderr  */
50   Bool ignore_uninstalled_p;    /* whether to avoid displaying or complaining
51                                    about hacks that are not on $PATH */
52   Bool debug_p;                 /* pay no mind to the man behind the curtain */
53   Bool xsync_p;                 /* whether XSynchronize has been called */
54
55   Bool lock_p;                  /* whether to lock as well as save */
56
57   Bool fade_p;                  /* whether to fade to black, if possible */
58   Bool unfade_p;                /* whether to fade from black, if possible */
59   Time fade_seconds;            /* how long that should take */
60   int fade_ticks;               /* how many ticks should be used */
61   Bool splash_p;                /* whether to do a splash screen at startup */
62
63   Bool install_cmap_p;          /* whether we should use our own colormap
64                                    when using the screen's default visual. */
65
66 # ifdef QUAD_MODE
67   Bool quad_p;                  /* whether to run four savers per monitor */
68 # endif /* QUAD_MODE */
69
70   screenhack **screenhacks;     /* the programs to run */
71   int screenhacks_count;
72
73   saver_mode mode;              /* hack-selection mode */
74   int selected_hack;            /* in one_hack mode, this is the one */
75
76   int nice_inferior;            /* nice value for subprocs */
77   int inferior_memory_limit;    /* setrlimit(LIMIT_AS) value for subprocs */
78
79   Time initial_delay;           /* how long to sleep after launch */
80   Time splash_duration;         /* how long the splash screen stays up */
81   Time timeout;                 /* how much idle time before activation */
82   Time lock_timeout;            /* how long after activation locking starts */
83   Time cycle;                   /* how long each hack should run */
84   Time passwd_timeout;          /* how much time before pw dialog goes down */
85   Time pointer_timeout;         /* how often to check mouse position */
86   Time notice_events_timeout;   /* how long after window creation to select */
87   Time watchdog_timeout;        /* how often to re-raise and re-blank screen */
88   int pointer_hysteresis;       /* mouse motions less than N/sec are ignored */
89
90   Bool dpms_enabled_p;          /* Whether to power down the monitor */
91   Time dpms_standby;            /* how long until monitor goes black */
92   Time dpms_suspend;            /* how long until monitor power-saves */
93   Time dpms_off;                /* how long until monitor powers down */
94
95   Bool grab_desktop_p;          /* These are not used by "xscreensaver" */
96   Bool grab_video_p;            /*  itself: they are used by the external */
97   Bool random_image_p;          /*  "xscreensaver-getimage" program, and set */
98   char *image_directory;        /*  by the "xscreensaver-demo" configurator. */
99
100   text_mode tmode;              /* How we generate text to display. */
101   char *text_literal;           /* used when tmode is TEXT_LITERAL. */
102   char *text_file;              /* used when tmode is TEXT_FILE.    */
103   char *text_program;           /* used when tmode is TEXT_PROGRAM. */
104   char *text_url;               /* used when tmode is TEXT_URL.     */
105
106   Bool use_xidle_extension;     /* which extension to use, if possible */
107   Bool use_mit_saver_extension;
108   Bool use_sgi_saver_extension;
109   Bool use_proc_interrupts;
110
111   Bool getviewport_full_of_lies_p; /* XFree86 bug #421 */
112
113   char *shell;                  /* where to find /bin/sh */
114
115   char *demo_command;           /* How to enter demo mode. */
116   char *prefs_command;          /* How to edit preferences. */
117   char *help_url;               /* Where the help document resides. */
118   char *load_url_command;       /* How one loads URLs. */
119   char *new_login_command;      /* Command for the "New Login" button. */
120 };
121
122
123 extern void load_init_file (Display *, saver_preferences *);
124 extern Bool init_file_changed_p (saver_preferences *);
125 extern int write_init_file (Display *,
126                             saver_preferences *, const char *version_string,
127                             Bool verbose_p);
128 const char *init_file_name (void);
129
130 extern screenhack *parse_screenhack (const char *line);
131 extern void free_screenhack (screenhack *);
132 extern char *format_hack (Display *, screenhack *, Bool wrap_p);
133 char *make_hack_name (Display *, const char *shell_command);
134
135 /* From dpms.c */
136 extern void sync_server_dpms_settings (Display *, Bool enabled_p,
137                                        int standby_secs, int suspend_secs,
138                                        int off_secs,
139                                        Bool verbose_p);
140
141 #endif /* __XSCREENSAVER_PREFS_H__ */