LoginP.h revision 145b7b3c
1/* $XdotOrg: $ */
2/* $Xorg: LoginP.h,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */
3/*
4
5Copyright 1988, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included
14in all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23
24Except as contained in this notice, the name of The Open Group shall
25not be used in advertising or otherwise to promote the sale, use or
26other dealings in this Software without prior written authorization
27from The Open Group.
28
29*/
30/* Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
31 *
32 * Permission is hereby granted, free of charge, to any person obtaining a
33 * copy of this software and associated documentation files (the
34 * "Software"), to deal in the Software without restriction, including
35 * without limitation the rights to use, copy, modify, merge, publish,
36 * distribute, and/or sell copies of the Software, and to permit persons
37 * to whom the Software is furnished to do so, provided that the above
38 * copyright notice(s) and this permission notice appear in all copies of
39 * the Software and that both the above copyright notice(s) and this
40 * permission notice appear in supporting documentation.
41 *
42 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
43 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
45 * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46 * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
47 * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
48 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
49 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
50 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
51 *
52 * Except as contained in this notice, the name of a copyright holder
53 * shall not be used in advertising or otherwise to promote the sale, use
54 * or other dealings in this Software without prior written authorization
55 * of the copyright holder.
56 */
57/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.8 2001/12/14 20:01:29 dawes Exp $ */
58
59/*
60 * xdm - display manager daemon
61 * Author:  Keith Packard, MIT X Consortium
62 */
63
64#ifndef _LoginP_h
65#define _LoginP_h
66
67#include "Login.h"
68#include <X11/IntrinsicP.h>
69#include <X11/CoreP.h>
70#include <X11/Xlib.h>
71#ifdef USE_XFT
72# include <X11/Xft/Xft.h>
73#endif
74
75#define INITIALIZING	0
76#define PROMPTING	1
77#define SHOW_MESSAGE	2
78#define DONE		3
79
80typedef void (*LoginFunc)(LoginWidget, LoginData *, int);
81
82typedef struct {
83    	char *		promptText;	/* Prompt displayed */
84    	const char *	defaultPrompt;	/* Default text for prompt */
85    	char *		valueText;	/* Value entered for prompt */
86   	size_t		valueTextMax;	/* Size of valueText buffer */
87    	int		valueShownStart;/* Amount of string shown if too */
88    	int		valueShownEnd;	/*  long to fit in field */
89	int		cursor;		/* current cursor position */
90	loginPromptState state;
91} loginPromptData;
92
93#define NUM_PROMPTS	2	/* Currently only 2 prompt fields supported */
94#define LAST_PROMPT	(NUM_PROMPTS - 1)
95
96/* New fields for the login widget instance record */
97typedef struct {
98#ifndef USE_XFT
99	Pixel		textpixel;	/* foreground pixel */
100	Pixel		promptpixel;	/* prompt pixel */
101	Pixel		greetpixel;	/* greeting pixel */
102	Pixel		failpixel;	/* failure pixel */
103#endif
104	Pixel		hipixel;	/* frame hilite pixel */
105	Pixel		shdpixel;	/* shadow frame pixel */
106	GC		textGC;		/* pointer to GraphicsContext */
107	GC		bgGC;		/* pointer to GraphicsContext */
108	GC		xorGC;		/* pointer to GraphicsContext */
109#ifndef USE_XFT
110	GC		promptGC;
111	GC		greetGC;
112	GC		failGC;
113#endif
114	GC		hiGC;		/* for hilight part of frame */
115	GC		shdGC;		/* for shaded part of frame */
116	char		*greeting;	/* greeting */
117	char		*unsecure_greet;/* message displayed when insecure */
118	char		*namePrompt;	/* name prompt */
119	char		*passwdPrompt;	/* password prompt */
120    	char		*failMsg;	/* failure message */
121	char		*fail;		/* current error message */
122    	char		*passwdChangeMsg; /* message when passwd expires */
123#ifndef USE_XFT
124	XFontStruct	*textFont;	/* font for text */
125	XFontStruct	*promptFont;	/* font for prompts */
126	XFontStruct	*greetFont;	/* font for greeting */
127	XFontStruct	*failFont;	/* font for failure message */
128#endif /* USE_XFT */
129	int		state;		/* state */
130    	int		activePrompt;	/* which prompt is active */
131	int		failUp;		/* failure message displayed */
132	LoginData	data;		/* name/passwd */
133	char		*sessionArg;	/* argument passed to session */
134	LoginFunc	notify_done;	/* proc to call when done */
135	int		failTimeout;	/* seconds til drop fail msg */
136	XtIntervalId	interval_id;	/* drop fail message note */
137	Boolean		secure_session;	/* session is secured */
138	Boolean		allow_access;	/* disable access control on login */
139	Boolean		allow_null_passwd; /* allow null password on login */
140	Boolean		allow_root_login; /* allow root login */
141	XIC		xic;		/* input method of input context */
142	loginPromptData	prompts[NUM_PROMPTS];
143    	time_t 		msgTimeout;
144
145#ifdef DANCING
146	/*caolan begin*/
147	int 		lastEventTime;
148	/*caolan end*/
149#endif /* DANCING */
150
151	int		outframewidth;	/* outer frame thickness */
152	int		inframeswidth;	/* inner frames thickness */
153	int		sepwidth;	/* width of separator line */
154
155#ifdef XPM
156        char *logoFileName;
157        unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth;
158        int logoX, logoY;
159        Window logoWindow;
160        Boolean useShape, logoValid;
161        Pixmap logoPixmap, logoMask;
162#endif /* XPM */
163#ifdef USE_XFT
164	XftDraw	       *draw;
165	XftFont        *textFace;	/* font for text */
166	XftFont        *promptFace;	/* font for prompts */
167	XftFont        *greetFace;	/* font for greeting */
168	XftFont        *failFace;  	/* font for failure message */
169	XftColor	textcolor;	/* foreground color */
170	XftColor	promptcolor;	/* prompt color */
171	XftColor	greetcolor;	/* greeting color */
172	XftColor	failcolor;	/* failure color */
173#endif
174   } LoginPart;
175
176/* Full instance record declaration */
177typedef struct _LoginRec {
178   CorePart core;
179   LoginPart login;
180   } LoginRec;
181
182/* New fields for the Login widget class record */
183typedef struct {int dummy;} LoginClassPart;
184
185/* Full class record declaration. */
186typedef struct _LoginClassRec {
187   CoreClassPart core_class;
188   LoginClassPart login_class;
189   } LoginClassRec;
190
191/* Class pointer. */
192extern LoginClassRec loginClassRec;
193
194#endif /* _LoginP_h */
195