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