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