summaryrefslogtreecommitdiffstats
path: root/kscreensaver/xsavers/xlock.h
blob: 77530a9f83420ab4c8ae5481c1330989db973ffb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#ifndef __XLOCK_H__
#define __XLOCK_H__

/*-
 * @(#)xlock.h	3.3 95/09/24 xlockmore 
 *
 * xlock.h - external interfaces for new modes and SYSV OS defines.
 *
 * Copyright (c) 1991 by Patrick J. Naughton.
 *
 * See xlock.c for copying information.
 *
 * Revision History:
 *
 * Changes of David Bagley <bagleyd@source.asset.com>
 * 12-May-95: Added defines for SunOS's Adjunct password file
 *            Dale A. Harris <rodmur@ecst.csuchico.edu>
 * 18-Nov-94: Modified for TQNX 4.2 w/ Metrolink X server from Brian Campbell
 *            <brianc@qnx.com>.
 * 11-Jul-94: added Bool flag: inwindow, which tells xlock to run in a
 *            window from Greg Bowering <greg@cs.adelaide.edu.au>
 * 11-Jul-94: patch for Solaris SYR4 from Chris P. Ross <cross@eng.umd.edu>
 * 28-Jun-94: Reorganized shadow stuff
 * 24-Jun-94: Reorganized
 * 22-Jun-94: Modified for VMS
 *            <Anthony.D.Clarke@Support.Hatfield.Raytheon.bae.eurokom.ie>
 * 17-Jun-94: patched shadow passwords and bcopy and bzero for SYSV from
 *            <reggers@julian.uwo.ca>
 * 21-Mar-94: patched the patch for AIXV3 and HP from
 *            <R.K.Lloyd@csc.liv.ac.uk>.
 * 01-Dec-93: added patch for AIXV3 from
 *            (Tom McConnell, tmcconne@sedona.intel.com) also added a patch
 *            for HP-UX 8.0.
 *
 */

#include <tqapplication.h> // hack for qt-1.2
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xresource.h>

// added for kscreensave
void initXLock( GC gc );


#define MAXSCREENS        1
#define NUMCOLORS         64
#ifndef KERBEROS
#define PASSLENGTH        64
#else
#define PASSLENGTH        120
#endif
#define FALLBACK_FONTNAME "fixed"
#ifndef DEF_MFONT
#define DEF_MFONT "-*-times-*-*-*-*-18-*-*-*-*-*-*-*"
#endif
#ifndef DEF_PROGRAM  /* Try the -o option ;) */
#define DEF_PROGRAM "fortune -s"
#endif

#define ICONW             64
#define ICONH             64

#if defined VMS || defined __TQNX__
#ifdef VMS
/*#define VMS_PLAY*/
#include <unixlib.h>
#endif
#endif

#include <math.h>

#ifndef M_E
#define M_E    2.7182818284590452354
#endif
#ifndef M_PI
#define M_PI   3.14159265358979323846
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif

#if !defined (news1800) && !defined (sun386)
#include <stdlib.h>
#if !defined (apollo) && !defined (VMS)
#include <unistd.h>
#include <memory.h>
#endif
#endif
#include <stdio.h>
#include <string.h>
 
typedef struct {
  GC            gc;                /* graphics context for animation */
  int           npixels;           /* number of valid entries in pixels */
  Colormap      cmap;              /* current colormap */
  unsigned long pixels[NUMCOLORS]; /* pixel values in the colormap */
  unsigned long bgcol, fgcol;      /* background and foreground pixel values */
} perscreen;

/* This stuff moved here from resource.c for the mode-specific options. */
#define t_String        0
#define t_Float         1
#define t_Int           2
#define t_Bool          3

typedef struct {
    caddr_t    *var;
    char       *name;
    char       *arg_class;
    char       *def;
    int         type;
} argtype;

typedef struct {
    char       *opt;
    char       *desc;
} OptionStruct;

typedef struct {
    int              numopts;
    XrmOptionDescRec *opts;
    argtype          *vars;
    OptionStruct     *desc;
} ModeSpecOpt;
/* End moved from resource.c */

extern perscreen Scr[MAXSCREENS];
extern Display *dsp;
extern int  screen;

extern char  *ProgramName;
extern char  *fontname;
extern char  *background;
extern char  *foreground;
extern char  *text_name;
extern char  *text_pass;
extern char  *text_info;
extern char  *text_valid;
extern char  *text_invalid;
extern char  *geometry;
extern float saturation;
extern int   nicelevel;
extern int   delay;
extern int   batchcount;
extern int   cycles;
extern int   timeout;
extern int   lockdelay;
#if defined(HAS_RPLAY) || defined(VMS_PLAY)
extern char  *locksound;
extern char  *infosound;
extern char  *validsound;
/*extern char  *invalidsound;*/
#endif
#ifdef AUTO_LOGOUT
extern int   forceLogout;
#endif
#ifdef LOGOUT_BUTTON
extern int   enable_button;
extern char  *logoutButtonLabel;
extern char  *logoutButtonHelp;
extern char  *logoutFailedString;
#endif
extern Bool  usefirst;
extern Bool  mono;
extern Bool  nolock;
extern Bool  allowroot;
extern Bool  enablesaver;
extern Bool  allowaccess;
extern Bool  grabmouse;
extern Bool  echokeys;
extern Bool  verbose;
extern Bool  inwindow;
extern Bool  inroot;
extern Bool  timeelapsed;
extern Bool  install;
extern int   onepause;

/* For modes with text, marquee & nose */
extern char *program;
extern char *messagesfile;
extern char *messagefile;
extern char *message;
extern char *mfont;

extern void  (*callback) ();
extern void  (*init) ();

extern void GetResources();
extern void set_colormap();
extern void fix_colormap();
#ifdef __STDC__
extern void error(char *, ...);
#else
extern void error();
#endif
extern void alarm_ctl();
extern long seconds();

/* For modes with text, marquee & nose */
extern XFontStruct *get_font();
extern char *get_words();
extern void init_words();
extern int is_ribbon();

#ifdef LESS_THAN_AIX3_2
#undef NULL
#define NULL 0
#endif /* LESS_THAN_AIX3_2 */

#ifdef VMS
#define OLD_EVENT_LOOP
#endif

#if defined(__STDC__) && (defined(__hpux) && defined(_PA_RISC1_1))
#define MATHF
#endif
#ifdef MATHF
#define SINF(n) sinf(n)
#define COSF(n) cosf(n)
#define FABSF(n) fabsf(n)
#else
#define SINF(n) ((float)sin((double)(n)))
#define COSF(n) ((float)cos((double)(n)))
#define FABSF(n) ((float)fabs((double)(n)))
#endif

#endif /* __XLOCK_H__ */