LoginP.h revision 145b7b3c
1145b7b3cSmrg/* $XdotOrg: $ */
2145b7b3cSmrg/* $Xorg: LoginP.h,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */
3145b7b3cSmrg/*
4145b7b3cSmrg
5145b7b3cSmrgCopyright 1988, 1998  The Open Group
6145b7b3cSmrg
7145b7b3cSmrgPermission to use, copy, modify, distribute, and sell this software and its
8145b7b3cSmrgdocumentation for any purpose is hereby granted without fee, provided that
9145b7b3cSmrgthe above copyright notice appear in all copies and that both that
10145b7b3cSmrgcopyright notice and this permission notice appear in supporting
11145b7b3cSmrgdocumentation.
12145b7b3cSmrg
13145b7b3cSmrgThe above copyright notice and this permission notice shall be included
14145b7b3cSmrgin all copies or substantial portions of the Software.
15145b7b3cSmrg
16145b7b3cSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17145b7b3cSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18145b7b3cSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19145b7b3cSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20145b7b3cSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21145b7b3cSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22145b7b3cSmrgOTHER DEALINGS IN THE SOFTWARE.
23145b7b3cSmrg
24145b7b3cSmrgExcept as contained in this notice, the name of The Open Group shall
25145b7b3cSmrgnot be used in advertising or otherwise to promote the sale, use or
26145b7b3cSmrgother dealings in this Software without prior written authorization
27145b7b3cSmrgfrom The Open Group.
28145b7b3cSmrg
29145b7b3cSmrg*/
30145b7b3cSmrg/* Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
31145b7b3cSmrg *
32145b7b3cSmrg * Permission is hereby granted, free of charge, to any person obtaining a
33145b7b3cSmrg * copy of this software and associated documentation files (the
34145b7b3cSmrg * "Software"), to deal in the Software without restriction, including
35145b7b3cSmrg * without limitation the rights to use, copy, modify, merge, publish,
36145b7b3cSmrg * distribute, and/or sell copies of the Software, and to permit persons
37145b7b3cSmrg * to whom the Software is furnished to do so, provided that the above
38145b7b3cSmrg * copyright notice(s) and this permission notice appear in all copies of
39145b7b3cSmrg * the Software and that both the above copyright notice(s) and this
40145b7b3cSmrg * permission notice appear in supporting documentation.
41145b7b3cSmrg *
42145b7b3cSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
43145b7b3cSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44145b7b3cSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
45145b7b3cSmrg * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46145b7b3cSmrg * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
47145b7b3cSmrg * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
48145b7b3cSmrg * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
49145b7b3cSmrg * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
50145b7b3cSmrg * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
51145b7b3cSmrg *
52145b7b3cSmrg * Except as contained in this notice, the name of a copyright holder
53145b7b3cSmrg * shall not be used in advertising or otherwise to promote the sale, use
54145b7b3cSmrg * or other dealings in this Software without prior written authorization
55145b7b3cSmrg * of the copyright holder.
56145b7b3cSmrg */
57145b7b3cSmrg/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.8 2001/12/14 20:01:29 dawes Exp $ */
58145b7b3cSmrg
59145b7b3cSmrg/*
60145b7b3cSmrg * xdm - display manager daemon
61145b7b3cSmrg * Author:  Keith Packard, MIT X Consortium
62145b7b3cSmrg */
63145b7b3cSmrg
64145b7b3cSmrg#ifndef _LoginP_h
65145b7b3cSmrg#define _LoginP_h
66145b7b3cSmrg
67145b7b3cSmrg#include "Login.h"
68145b7b3cSmrg#include <X11/IntrinsicP.h>
69145b7b3cSmrg#include <X11/CoreP.h>
70145b7b3cSmrg#include <X11/Xlib.h>
71145b7b3cSmrg#ifdef USE_XFT
72145b7b3cSmrg# include <X11/Xft/Xft.h>
73145b7b3cSmrg#endif
74145b7b3cSmrg
75145b7b3cSmrg#define INITIALIZING	0
76145b7b3cSmrg#define PROMPTING	1
77145b7b3cSmrg#define SHOW_MESSAGE	2
78145b7b3cSmrg#define DONE		3
79145b7b3cSmrg
80145b7b3cSmrgtypedef void (*LoginFunc)(LoginWidget, LoginData *, int);
81145b7b3cSmrg
82145b7b3cSmrgtypedef struct {
83145b7b3cSmrg    	char *		promptText;	/* Prompt displayed */
84145b7b3cSmrg    	const char *	defaultPrompt;	/* Default text for prompt */
85145b7b3cSmrg    	char *		valueText;	/* Value entered for prompt */
86145b7b3cSmrg   	size_t		valueTextMax;	/* Size of valueText buffer */
87145b7b3cSmrg    	int		valueShownStart;/* Amount of string shown if too */
88145b7b3cSmrg    	int		valueShownEnd;	/*  long to fit in field */
89145b7b3cSmrg	int		cursor;		/* current cursor position */
90145b7b3cSmrg	loginPromptState state;
91145b7b3cSmrg} loginPromptData;
92145b7b3cSmrg
93145b7b3cSmrg#define NUM_PROMPTS	2	/* Currently only 2 prompt fields supported */
94145b7b3cSmrg#define LAST_PROMPT	(NUM_PROMPTS - 1)
95145b7b3cSmrg
96145b7b3cSmrg/* New fields for the login widget instance record */
97145b7b3cSmrgtypedef struct {
98145b7b3cSmrg#ifndef USE_XFT
99145b7b3cSmrg	Pixel		textpixel;	/* foreground pixel */
100145b7b3cSmrg	Pixel		promptpixel;	/* prompt pixel */
101145b7b3cSmrg	Pixel		greetpixel;	/* greeting pixel */
102145b7b3cSmrg	Pixel		failpixel;	/* failure pixel */
103145b7b3cSmrg#endif
104145b7b3cSmrg	Pixel		hipixel;	/* frame hilite pixel */
105145b7b3cSmrg	Pixel		shdpixel;	/* shadow frame pixel */
106145b7b3cSmrg	GC		textGC;		/* pointer to GraphicsContext */
107145b7b3cSmrg	GC		bgGC;		/* pointer to GraphicsContext */
108145b7b3cSmrg	GC		xorGC;		/* pointer to GraphicsContext */
109145b7b3cSmrg#ifndef USE_XFT
110145b7b3cSmrg	GC		promptGC;
111145b7b3cSmrg	GC		greetGC;
112145b7b3cSmrg	GC		failGC;
113145b7b3cSmrg#endif
114145b7b3cSmrg	GC		hiGC;		/* for hilight part of frame */
115145b7b3cSmrg	GC		shdGC;		/* for shaded part of frame */
116145b7b3cSmrg	char		*greeting;	/* greeting */
117145b7b3cSmrg	char		*unsecure_greet;/* message displayed when insecure */
118145b7b3cSmrg	char		*namePrompt;	/* name prompt */
119145b7b3cSmrg	char		*passwdPrompt;	/* password prompt */
120145b7b3cSmrg    	char		*failMsg;	/* failure message */
121145b7b3cSmrg	char		*fail;		/* current error message */
122145b7b3cSmrg    	char		*passwdChangeMsg; /* message when passwd expires */
123145b7b3cSmrg#ifndef USE_XFT
124145b7b3cSmrg	XFontStruct	*textFont;	/* font for text */
125145b7b3cSmrg	XFontStruct	*promptFont;	/* font for prompts */
126145b7b3cSmrg	XFontStruct	*greetFont;	/* font for greeting */
127145b7b3cSmrg	XFontStruct	*failFont;	/* font for failure message */
128145b7b3cSmrg#endif /* USE_XFT */
129145b7b3cSmrg	int		state;		/* state */
130145b7b3cSmrg    	int		activePrompt;	/* which prompt is active */
131145b7b3cSmrg	int		failUp;		/* failure message displayed */
132145b7b3cSmrg	LoginData	data;		/* name/passwd */
133145b7b3cSmrg	char		*sessionArg;	/* argument passed to session */
134145b7b3cSmrg	LoginFunc	notify_done;	/* proc to call when done */
135145b7b3cSmrg	int		failTimeout;	/* seconds til drop fail msg */
136145b7b3cSmrg	XtIntervalId	interval_id;	/* drop fail message note */
137145b7b3cSmrg	Boolean		secure_session;	/* session is secured */
138145b7b3cSmrg	Boolean		allow_access;	/* disable access control on login */
139145b7b3cSmrg	Boolean		allow_null_passwd; /* allow null password on login */
140145b7b3cSmrg	Boolean		allow_root_login; /* allow root login */
141145b7b3cSmrg	XIC		xic;		/* input method of input context */
142145b7b3cSmrg	loginPromptData	prompts[NUM_PROMPTS];
143145b7b3cSmrg    	time_t 		msgTimeout;
144145b7b3cSmrg
145145b7b3cSmrg#ifdef DANCING
146145b7b3cSmrg	/*caolan begin*/
147145b7b3cSmrg	int 		lastEventTime;
148145b7b3cSmrg	/*caolan end*/
149145b7b3cSmrg#endif /* DANCING */
150145b7b3cSmrg
151145b7b3cSmrg	int		outframewidth;	/* outer frame thickness */
152145b7b3cSmrg	int		inframeswidth;	/* inner frames thickness */
153145b7b3cSmrg	int		sepwidth;	/* width of separator line */
154145b7b3cSmrg
155145b7b3cSmrg#ifdef XPM
156145b7b3cSmrg        char *logoFileName;
157145b7b3cSmrg        unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth;
158145b7b3cSmrg        int logoX, logoY;
159145b7b3cSmrg        Window logoWindow;
160145b7b3cSmrg        Boolean useShape, logoValid;
161145b7b3cSmrg        Pixmap logoPixmap, logoMask;
162145b7b3cSmrg#endif /* XPM */
163145b7b3cSmrg#ifdef USE_XFT
164145b7b3cSmrg	XftDraw	       *draw;
165145b7b3cSmrg	XftFont        *textFace;	/* font for text */
166145b7b3cSmrg	XftFont        *promptFace;	/* font for prompts */
167145b7b3cSmrg	XftFont        *greetFace;	/* font for greeting */
168145b7b3cSmrg	XftFont        *failFace;  	/* font for failure message */
169145b7b3cSmrg	XftColor	textcolor;	/* foreground color */
170145b7b3cSmrg	XftColor	promptcolor;	/* prompt color */
171145b7b3cSmrg	XftColor	greetcolor;	/* greeting color */
172145b7b3cSmrg	XftColor	failcolor;	/* failure color */
173145b7b3cSmrg#endif
174145b7b3cSmrg   } LoginPart;
175145b7b3cSmrg
176145b7b3cSmrg/* Full instance record declaration */
177145b7b3cSmrgtypedef struct _LoginRec {
178145b7b3cSmrg   CorePart core;
179145b7b3cSmrg   LoginPart login;
180145b7b3cSmrg   } LoginRec;
181145b7b3cSmrg
182145b7b3cSmrg/* New fields for the Login widget class record */
183145b7b3cSmrgtypedef struct {int dummy;} LoginClassPart;
184145b7b3cSmrg
185145b7b3cSmrg/* Full class record declaration. */
186145b7b3cSmrgtypedef struct _LoginClassRec {
187145b7b3cSmrg   CoreClassPart core_class;
188145b7b3cSmrg   LoginClassPart login_class;
189145b7b3cSmrg   } LoginClassRec;
190145b7b3cSmrg
191145b7b3cSmrg/* Class pointer. */
192145b7b3cSmrgextern LoginClassRec loginClassRec;
193145b7b3cSmrg
194145b7b3cSmrg#endif /* _LoginP_h */
195