Add check
[kdeartwork.git] / kscreensaver / xsavers / xlockmore.h
blob496b48f2bc9372aa08e5853bb91fade84e1065d7
1 #ifndef __XLOCK_XLOCK_H__
2 #define __XLOCK_XLOCK_H__
4 /*-
5 * @(#)xlock.h 4.00 97/01/01 xlockmore
7 * xlock.h - external interfaces for new modes and SYSV OS defines.
9 * Copyright (c) 1991 by Patrick J. Naughton.
11 * See xlock.c for copying information.
13 * Revision History:
15 * Changes of David Bagley <bagleyd@bigfoot.com>
16 * 12-May-95: Added defines for SunOS's Adjunct password file
17 * Dale A. Harris <rodmur@ecst.csuchico.edu>
18 * 18-Nov-94: Modified for QNX 4.2 w/ Metrolink X server from Brian Campbell
19 * <brianc@qnx.com>.
20 * 11-Jul-94: added Bool flag: inwindow, which tells xlock to run in a
21 * window from Greg Bowering <greg@cs.adelaide.edu.au>
22 * 11-Jul-94: patch for Solaris SYR4 from Chris P. Ross <cross@eng.umd.edu>
23 * 28-Jun-94: Reorganized shadow stuff
24 * 24-Jun-94: Reorganized
25 * 22-Jun-94: Modified for VMS
26 * <Anthony.D.Clarke@Support.Hatfield.Raytheon.bae.eurokom.ie>
27 * 17-Jun-94: patched shadow passwords and bcopy and bzero for SYSV from
28 * <reggers@julian.uwo.ca>
29 * 21-Mar-94: patched the patch for AIXV3 and HP from
30 * <R.K.Lloyd@csc.liv.ac.uk>.
31 * 01-Dec-93: added patch for AIXV3 from
32 * (Tom McConnell, tmcconne@sedona.intel.com) also added a patch
33 * for HP-UX 8.0.
36 #include <X11/Xlib.h>
37 #include <X11/Xutil.h>
38 #include <X11/Xos.h>
39 #include <X11/Xresource.h>
41 #ifdef HAVE_CONFIG_H
42 #include <config.h>
43 #endif
45 /* out of main.cpp */
46 #define MODE_NONE 0
47 #define MODE_INSTALL 1
48 #define MODE_SETUP 2
49 #define MODE_PREVIEW 3
50 #define MODE_TEST 4
53 #ifndef MAXSCREENS
54 #define MAXSCREENS 3
55 #endif
56 #ifndef NUMCOLORS
57 #define NUMCOLORS 64
58 #endif
59 #ifndef MESSAGELINES
60 #define MESSAGELINES 40
61 #endif
62 #define PASSLENGTH 120
63 #define FALLBACK_FONTNAME "fixed"
64 #ifndef DEF_MFONT
65 #define DEF_MFONT "-*-times-*-*-*-*-18-*-*-*-*-*-*-*"
66 #endif
67 #ifndef DEF_PROGRAM /* Try the -o option ;) */
68 #define DEF_PROGRAM "fortune -s"
69 #endif
71 #ifndef DEF_NONE3D
72 #define DEF_NONE3D "Black"
73 #endif
74 #ifndef DEF_RIGHT3D
75 #define DEF_RIGHT3D "Red"
76 #endif
77 #ifndef DEF_LEFT3D
78 #define DEF_LEFT3D "Blue"
79 #endif
80 #ifndef DEF_BOTH3D
81 #define DEF_BOTH3D "Magenta"
82 #endif
84 #ifndef DEF_ICONW
85 #define DEF_ICONW 64 /* Age old default */
86 #endif
87 #ifndef DEF_ICONH
88 #define DEF_ICONH 64
89 #endif
91 #define MINICONW 1 /* Will not see much */
92 #define MINICONH 1
94 #ifndef MAXICONW
95 #define MAXICONW 256 /* Want users to know the screen is locked */
96 #endif
97 #ifndef MAXICONH
98 #define MAXICONH 256 /* by a particular user */
99 #endif
101 #ifndef MIN
102 #define MIN(a,b) (((a)<(b))?(a):(b))
103 #endif
105 #ifndef MAX
106 #define MAX(a,b) (((a)>(b))?(a):(b))
107 #endif
109 #ifndef ABS
110 #define ABS(a) ((a<0)?(-(a)):(a))
111 #endif
113 #include <math.h>
114 #ifndef M_E
115 #define M_E 2.7182818284590452354
116 #endif
117 #ifndef M_PI
118 #define M_PI 3.14159265358979323846
119 #endif
120 #ifndef M_PI_2
121 #define M_PI_2 1.57079632679489661923
122 #endif
123 #if VMS
124 #include <unixlib.h>
125 #endif
126 #include <sys/types.h>
127 #if 0
128 #ifndef uid_t
129 #define uid_t int
130 #endif
131 #ifndef gid_t
132 #define gid_t int
133 #endif
134 #ifndef pid_t
135 #define pid_t int
136 #endif
137 #ifndef size_t
138 #define size_t unsigned
139 #endif
140 #endif
141 #include <unistd.h>
142 #if HAVE_MEMORY_H
143 #include <memory.h>
144 #endif
145 #include <stdio.h>
146 #include <string.h>
147 #include <stdlib.h>
148 #if HAVE_DIRENT_H
149 #ifdef USE_XVMSUTILS
150 #if 0
151 #include "../xvmsutils/unix_types.h"
152 #include "../xvmsutils/dirent.h"
153 #else
154 #include <X11/unix_types.h>
155 #include <X11/dirent.h>
156 #endif
157 #else /* !USE_XVMSUTILS */
158 #include <dirent.h>
159 #endif /* !USE_XVMSUTILS */
160 #else
161 #define dirent direct
162 #define NAMELEN(dirent) (dirent)->d_namelen
163 #if HAVE_SYS_NDIR_H
164 #include <sys/ndir.h>
165 #endif
166 #if HAVE_SYS_DIR_H
167 #include <sys/dir.h>
168 #endif
169 #if HAVE_NDIR_H
170 #include <ndir.h>
171 #endif
172 #endif
173 #ifndef MAXNAMLEN
174 #define MAXNAMLEN 256 /* maximum filename length */
175 #endif
176 #ifndef DIRBUF
177 #define DIRBUF 512 /* buffer size for fs-indep. dirs */
178 #endif
180 typedef struct {
181 GC gc; /* graphics context for animation */
182 int npixels; /* number of valid entries in pixels */
183 Colormap cmap; /* current colormap */
184 unsigned long pixels[NUMCOLORS]; /* pixel values in the colormap */
185 unsigned long bgcol, fgcol; /* background and foreground pixel values */
186 unsigned long rightcol, leftcol; /* 3D color pixel values */
187 unsigned long nonecol, bothcol;
188 } perscreen;
190 #define t_String 0
191 #define t_Float 1
192 #define t_Int 2
193 #define t_Bool 3
195 typedef struct {
196 caddr_t *var;
197 char *name;
198 char *classname;
199 char *def;
200 int type;
201 } argtype;
203 typedef struct {
204 char *opt;
205 char *desc;
206 } OptionStruct;
208 typedef struct {
209 int numopts;
210 XrmOptionDescRec *opts;
211 int numvarsdesc;
212 argtype *vars;
213 OptionStruct *desc;
214 } ModeSpecOpt;
216 /* this must follow definition of ModeSpecOpt */
217 #include "mode.h"
219 #define IS_XBMDONE 1 /* Only need one mono image */
220 #define IS_XBM 2
221 #define IS_XBMFILE 3
222 #define IS_XPM 4
223 #define IS_XPMFILE 5
224 #define IS_RASTERFILE 6
226 extern void getResources(int argc, char **argv);
227 extern unsigned long allocPixel(Display * display, Colormap cmap,
228 char *name, char *def);
229 extern void setColormap(Display * display, Window window, Colormap map,
230 Bool inwindow);
231 extern void reserveColors(ModeInfo * mi, Colormap cmap,
232 unsigned long *blackpix, unsigned long *whitepix);
233 extern void fixColormap(Display * display, Window window,
234 int screen, float saturation,
235 Bool mono, Bool install, Bool inroot, Bool inwindow, Bool verbose);
236 extern int visualClassFromName(char *name);
237 extern void showVisualInfo(XVisualInfo * wantVis);
238 #ifdef USE_GL
239 extern int getVisual(ModeInfo * mi, XVisualInfo * wantVis, int mono);
240 #endif
242 extern unsigned long seconds(void);
243 extern void finish(void);
244 extern void error(char *s1,...);
245 extern void warning(char *s1,...);
247 #ifndef HAVE_STRDUP
248 extern char *strdup(char *);
249 #endif
251 #ifdef MATHF
252 #define SINF(n) sinf(n)
253 #define COSF(n) cosf(n)
254 #define FABSF(n) fabsf(n)
255 #else
256 #define SINF(n) ((float)sin((double)(n)))
257 #define COSF(n) ((float)cos((double)(n)))
258 #define FABSF(n) ((float)fabs((double)(n)))
259 #endif
261 #endif /* __XLOCK_XLOCK_H__ */