Back to index

kdeartwork  4.3.2
xlockmore.h
Go to the documentation of this file.
00001 #ifndef __XLOCK_XLOCK_H__
00002 #define __XLOCK_XLOCK_H__
00003 
00004 /*-
00005  * @(#)xlock.h       4.00 97/01/01 xlockmore 
00006  *
00007  * xlock.h - external interfaces for new modes and SYSV OS defines.
00008  *
00009  * Copyright (c) 1991 by Patrick J. Naughton.
00010  *
00011  * See xlock.c for copying information.
00012  *
00013  * Revision History:
00014  *
00015  * Changes of David Bagley <bagleyd@bigfoot.com>
00016  * 12-May-95: Added defines for SunOS's Adjunct password file
00017  *            Dale A. Harris <rodmur@ecst.csuchico.edu>
00018  * 18-Nov-94: Modified for QNX 4.2 w/ Metrolink X server from Brian Campbell
00019  *            <brianc@qnx.com>.
00020  * 11-Jul-94: added Bool flag: inwindow, which tells xlock to run in a
00021  *            window from Greg Bowering <greg@cs.adelaide.edu.au>
00022  * 11-Jul-94: patch for Solaris SYR4 from Chris P. Ross <cross@eng.umd.edu>
00023  * 28-Jun-94: Reorganized shadow stuff
00024  * 24-Jun-94: Reorganized
00025  * 22-Jun-94: Modified for VMS
00026  *            <Anthony.D.Clarke@Support.Hatfield.Raytheon.bae.eurokom.ie>
00027  * 17-Jun-94: patched shadow passwords and bcopy and bzero for SYSV from
00028  *            <reggers@julian.uwo.ca>
00029  * 21-Mar-94: patched the patch for AIXV3 and HP from
00030  *            <R.K.Lloyd@csc.liv.ac.uk>.
00031  * 01-Dec-93: added patch for AIXV3 from
00032  *            (Tom McConnell, tmcconne@sedona.intel.com) also added a patch
00033  *            for HP-UX 8.0.
00034  *
00035  */
00036 #include <X11/Xlib.h>
00037 #include <X11/Xutil.h>
00038 #include <X11/Xos.h>
00039 #include <X11/Xresource.h>
00040 
00041 #include <config-xsavers.h>
00042 
00043 /* out of main.cpp */
00044 #define MODE_NONE               0
00045 #define MODE_INSTALL    1
00046 #define MODE_SETUP              2
00047 #define MODE_PREVIEW    3
00048 #define MODE_TEST               4
00049 
00050 
00051 #ifndef MAXSCREENS
00052 #define MAXSCREENS        3
00053 #endif
00054 #ifndef NUMCOLORS
00055 #define NUMCOLORS         64
00056 #endif
00057 #ifndef MESSAGELINES
00058 #define MESSAGELINES      40
00059 #endif
00060 #define PASSLENGTH        120
00061 #define FALLBACK_FONTNAME "fixed"
00062 #ifndef DEF_MFONT
00063 #define DEF_MFONT "-*-times-*-*-*-*-18-*-*-*-*-*-*-*"
00064 #endif
00065 #ifndef DEF_PROGRAM         /* Try the -o option ;) */
00066 #define DEF_PROGRAM "fortune -s"
00067 #endif
00068 
00069 #ifndef DEF_NONE3D
00070 #define DEF_NONE3D "Black"
00071 #endif
00072 #ifndef DEF_RIGHT3D
00073 #define DEF_RIGHT3D "Red"
00074 #endif
00075 #ifndef DEF_LEFT3D
00076 #define DEF_LEFT3D "Blue"
00077 #endif
00078 #ifndef DEF_BOTH3D
00079 #define DEF_BOTH3D "Magenta"
00080 #endif
00081 
00082 #ifndef DEF_ICONW
00083 #define DEF_ICONW         64       /* Age old default */
00084 #endif
00085 #ifndef DEF_ICONH
00086 #define DEF_ICONH         64
00087 #endif
00088 
00089 #define MINICONW          1 /* Will not see much */
00090 #define MINICONH          1
00091 
00092 #ifndef MAXICONW
00093 #define MAXICONW          256      /* Want users to know the screen is locked */
00094 #endif
00095 #ifndef MAXICONH
00096 #define MAXICONH          256      /* by a particular user */
00097 #endif
00098 
00099 #ifndef MIN
00100 #define MIN(a,b) (((a)<(b))?(a):(b))
00101 #endif
00102 
00103 #ifndef MAX
00104 #define MAX(a,b) (((a)>(b))?(a):(b))
00105 #endif
00106 
00107 #ifndef ABS
00108 #define ABS(a)  ((a<0)?(-(a)):(a))
00109 #endif
00110 
00111 #include <math.h>
00112 #ifndef M_E
00113 #define M_E    2.7182818284590452354
00114 #endif
00115 #ifndef M_PI
00116 #define M_PI   3.14159265358979323846
00117 #endif
00118 #ifndef M_PI_2
00119 #define M_PI_2 1.57079632679489661923
00120 #endif
00121 #if VMS
00122 #include <unixlib.h>
00123 #endif
00124 #include <sys/types.h>
00125 #if 0
00126 #ifndef uid_t
00127 #define uid_t int
00128 #endif
00129 #ifndef gid_t
00130 #define gid_t int
00131 #endif
00132 #ifndef pid_t
00133 #define pid_t int
00134 #endif
00135 #ifndef size_t
00136 #define size_t unsigned
00137 #endif
00138 #endif
00139 #include <unistd.h>
00140 #if HAVE_MEMORY_H
00141 #include <memory.h>
00142 #endif
00143 #include <stdio.h>
00144 #include <string.h>
00145 #include <stdlib.h>
00146 #if HAVE_DIRENT_H
00147 #ifdef USE_XVMSUTILS
00148 #if 0
00149 #include "../xvmsutils/unix_types.h"
00150 #include "../xvmsutils/dirent.h"
00151 #else
00152 #include <X11/unix_types.h>
00153 #include <X11/dirent.h>
00154 #endif
00155 #else /* !USE_XVMSUTILS */
00156 #include <dirent.h>
00157 #endif /* !USE_XVMSUTILS */
00158 #else
00159 #define dirent direct
00160 #define NAMELEN(dirent) (dirent)->d_namelen
00161 #if HAVE_SYS_NDIR_H
00162 #include <sys/ndir.h>
00163 #endif
00164 #if HAVE_SYS_DIR_H
00165 #include <sys/dir.h>
00166 #endif
00167 #if HAVE_NDIR_H
00168 #include <ndir.h>
00169 #endif
00170 #endif
00171 #ifndef MAXNAMLEN
00172 #define MAXNAMLEN       256 /* maximum filename length */
00173 #endif
00174 #ifndef DIRBUF
00175 #define DIRBUF          512 /* buffer size for fs-indep. dirs */
00176 #endif
00177 
00178 typedef struct {
00179        GC          gc;             /* graphics context for animation */
00180        int         npixels; /* number of valid entries in pixels */
00181        Colormap    cmap;    /* current colormap */
00182        unsigned long pixels[NUMCOLORS];   /* pixel values in the colormap */
00183        unsigned long bgcol, fgcol; /* background and foreground pixel values */
00184        unsigned long rightcol, leftcol;   /* 3D color pixel values */
00185        unsigned long nonecol, bothcol;
00186 } perscreen;
00187 
00188 #define t_String        0
00189 #define t_Float         1
00190 #define t_Int           2
00191 #define t_Bool          3
00192 
00193 typedef struct {
00194        caddr_t    *var;
00195        char       *name;
00196        char       *classname;
00197        char       *def;
00198        int         type;
00199 } argtype;
00200 
00201 typedef struct {
00202        char       *opt;
00203        char       *desc;
00204 } OptionStruct;
00205 
00206 typedef struct {
00207        int         numopts;
00208        XrmOptionDescRec *opts;
00209        int         numvarsdesc;
00210        argtype    *vars;
00211        OptionStruct *desc;
00212 } ModeSpecOpt;
00213 
00214 /* this must follow definition of ModeSpecOpt */
00215 #include "mode.h"
00216 
00217 #define IS_XBMDONE 1        /* Only need one mono image */
00218 #define IS_XBM 2
00219 #define IS_XBMFILE 3
00220 #define IS_XPM 4
00221 #define IS_XPMFILE 5
00222 #define IS_RASTERFILE 6
00223 
00224 extern void getResources(int argc, char **argv);
00225 extern unsigned long allocPixel(Display * display, Colormap cmap,
00226                             char *name, char *def);
00227 extern void setColormap(Display * display, Window window, Colormap map,
00228                      Bool inwindow);
00229 extern void reserveColors(ModeInfo * mi, Colormap cmap,
00230                        unsigned long *blackpix, unsigned long *whitepix);
00231 extern void fixColormap(Display * display, Window window,
00232                      int screen, float saturation,
00233          Bool mono, Bool install, Bool inroot, Bool inwindow, Bool verbose);
00234 extern int  visualClassFromName(char *name);
00235 extern void showVisualInfo(XVisualInfo * wantVis);
00236 #ifdef USE_GL
00237 extern int getVisual(ModeInfo * mi, XVisualInfo * wantVis, int mono);
00238 #endif
00239 
00240 extern unsigned long seconds(void);
00241 extern void finish(void);
00242 extern void error(char *s1,...);
00243 extern void warning(char *s1,...);
00244 
00245 #ifndef HAVE_STRDUP 
00246 extern char *strdup(char *);
00247 #endif
00248 
00249 #ifdef MATHF
00250 #define SINF(n) sinf(n)
00251 #define COSF(n) cosf(n)
00252 #define FABSF(n) fabsf(n)
00253 #else
00254 #define SINF(n) ((float)sin((double)(n)))
00255 #define COSF(n) ((float)cos((double)(n)))
00256 #define FABSF(n) ((float)fabs((double)(n)))
00257 #endif
00258 
00259 #endif /* __XLOCK_XLOCK_H__ */