1145b7b3cSmrg/*
2145b7b3cSmrg
3145b7b3cSmrgCopyright 1988, 1998  The Open Group
4145b7b3cSmrg
5145b7b3cSmrgPermission to use, copy, modify, distribute, and sell this software and its
6145b7b3cSmrgdocumentation for any purpose is hereby granted without fee, provided that
7145b7b3cSmrgthe above copyright notice appear in all copies and that both that
8145b7b3cSmrgcopyright notice and this permission notice appear in supporting
9145b7b3cSmrgdocumentation.
10145b7b3cSmrg
11145b7b3cSmrgThe above copyright notice and this permission notice shall be included
12145b7b3cSmrgin all copies or substantial portions of the Software.
13145b7b3cSmrg
14145b7b3cSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15145b7b3cSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16145b7b3cSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17145b7b3cSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18145b7b3cSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19145b7b3cSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20145b7b3cSmrgOTHER DEALINGS IN THE SOFTWARE.
21145b7b3cSmrg
22145b7b3cSmrgExcept as contained in this notice, the name of The Open Group shall
23145b7b3cSmrgnot be used in advertising or otherwise to promote the sale, use or
24145b7b3cSmrgother dealings in this Software without prior written authorization
25145b7b3cSmrgfrom The Open Group.
26145b7b3cSmrg
27145b7b3cSmrg*/
285ffd6003Smrg/*
294901b09eSmrg * Copyright (c) 2006, Oracle and/or its affiliates.
30145b7b3cSmrg *
31145b7b3cSmrg * Permission is hereby granted, free of charge, to any person obtaining a
325ffd6003Smrg * copy of this software and associated documentation files (the "Software"),
335ffd6003Smrg * to deal in the Software without restriction, including without limitation
345ffd6003Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
355ffd6003Smrg * and/or sell copies of the Software, and to permit persons to whom the
365ffd6003Smrg * Software is furnished to do so, subject to the following conditions:
37145b7b3cSmrg *
385ffd6003Smrg * The above copyright notice and this permission notice (including the next
395ffd6003Smrg * paragraph) shall be included in all copies or substantial portions of the
405ffd6003Smrg * Software.
41145b7b3cSmrg *
425ffd6003Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
435ffd6003Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
445ffd6003Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
455ffd6003Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
465ffd6003Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
475ffd6003Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
485ffd6003Smrg * DEALINGS IN THE SOFTWARE.
49145b7b3cSmrg */
50145b7b3cSmrg
51145b7b3cSmrg/*
52145b7b3cSmrg * xdm - display manager daemon
53145b7b3cSmrg * Author:  Keith Packard, MIT X Consortium
54145b7b3cSmrg */
55145b7b3cSmrg
56145b7b3cSmrg#ifndef _LoginP_h
57578741aaSmrg# define _LoginP_h
58145b7b3cSmrg
59578741aaSmrg# include "Login.h"
60578741aaSmrg# include <X11/IntrinsicP.h>
61578741aaSmrg# include <X11/CoreP.h>
62578741aaSmrg# include <X11/Xlib.h>
63578741aaSmrg# ifdef USE_XFT
64578741aaSmrg#  include <X11/Xft/Xft.h>
65578741aaSmrg# endif
66145b7b3cSmrg
67578741aaSmrg# define INITIALIZING	0
68578741aaSmrg# define PROMPTING	1
69578741aaSmrg# define SHOW_MESSAGE	2
70578741aaSmrg# define DONE		3
71145b7b3cSmrg
72145b7b3cSmrgtypedef void (*LoginFunc)(LoginWidget, LoginData *, int);
73145b7b3cSmrg
74145b7b3cSmrgtypedef struct {
75629baa8cSmrg	char *		promptText;	/* Prompt displayed */
76629baa8cSmrg	const char *	defaultPrompt;	/* Default text for prompt */
77629baa8cSmrg	char *		valueText;	/* Value entered for prompt */
78629baa8cSmrg	size_t		valueTextMax;	/* Size of valueText buffer */
79629baa8cSmrg	int		valueShownStart;/* Amount of string shown if too */
80629baa8cSmrg	int		valueShownEnd;	/*  long to fit in field */
81578741aaSmrg	int		cursor;		/* current cursor position */
82145b7b3cSmrg	loginPromptState state;
83145b7b3cSmrg} loginPromptData;
84145b7b3cSmrg
85578741aaSmrg# define NUM_PROMPTS	2	/* Currently only 2 prompt fields supported */
86578741aaSmrg# define LAST_PROMPT	(NUM_PROMPTS - 1)
87145b7b3cSmrg
88145b7b3cSmrg/* New fields for the login widget instance record */
89145b7b3cSmrgtypedef struct {
90578741aaSmrg# ifndef USE_XFT
91145b7b3cSmrg	Pixel		textpixel;	/* foreground pixel */
92145b7b3cSmrg	Pixel		promptpixel;	/* prompt pixel */
93145b7b3cSmrg	Pixel		greetpixel;	/* greeting pixel */
94145b7b3cSmrg	Pixel		failpixel;	/* failure pixel */
95578741aaSmrg# endif
96145b7b3cSmrg	Pixel		hipixel;	/* frame hilite pixel */
97145b7b3cSmrg	Pixel		shdpixel;	/* shadow frame pixel */
98b7d26471Smrg	Pixel		inppixel;	/* input field bg pixel */
99145b7b3cSmrg	GC		textGC;		/* pointer to GraphicsContext */
100145b7b3cSmrg	GC		bgGC;		/* pointer to GraphicsContext */
101145b7b3cSmrg	GC		xorGC;		/* pointer to GraphicsContext */
102578741aaSmrg# ifndef USE_XFT
103145b7b3cSmrg	GC		promptGC;
104145b7b3cSmrg	GC		greetGC;
105145b7b3cSmrg	GC		failGC;
106578741aaSmrg# endif
107145b7b3cSmrg	GC		hiGC;		/* for hilight part of frame */
108145b7b3cSmrg	GC		shdGC;		/* for shaded part of frame */
109b7d26471Smrg	GC		inpGC;		/* for input field of frame */
110145b7b3cSmrg	char		*greeting;	/* greeting */
111145b7b3cSmrg	char		*unsecure_greet;/* message displayed when insecure */
112145b7b3cSmrg	char		*namePrompt;	/* name prompt */
113145b7b3cSmrg	char		*passwdPrompt;	/* password prompt */
114629baa8cSmrg	char		*failMsg;	/* failure message */
115145b7b3cSmrg	char		*fail;		/* current error message */
116629baa8cSmrg	char		*passwdChangeMsg; /* message when passwd expires */
117578741aaSmrg# ifndef USE_XFT
118145b7b3cSmrg	XFontStruct	*textFont;	/* font for text */
119145b7b3cSmrg	XFontStruct	*promptFont;	/* font for prompts */
120145b7b3cSmrg	XFontStruct	*greetFont;	/* font for greeting */
121145b7b3cSmrg	XFontStruct	*failFont;	/* font for failure message */
122578741aaSmrg# endif /* USE_XFT */
123145b7b3cSmrg	int		state;		/* state */
124629baa8cSmrg	int		activePrompt;	/* which prompt is active */
125145b7b3cSmrg	int		failUp;		/* failure message displayed */
126145b7b3cSmrg	LoginData	data;		/* name/passwd */
127145b7b3cSmrg	char		*sessionArg;	/* argument passed to session */
128145b7b3cSmrg	LoginFunc	notify_done;	/* proc to call when done */
129145b7b3cSmrg	int		failTimeout;	/* seconds til drop fail msg */
130145b7b3cSmrg	XtIntervalId	interval_id;	/* drop fail message note */
131145b7b3cSmrg	Boolean		secure_session;	/* session is secured */
132145b7b3cSmrg	Boolean		allow_access;	/* disable access control on login */
133145b7b3cSmrg	Boolean		allow_null_passwd; /* allow null password on login */
134145b7b3cSmrg	Boolean		allow_root_login; /* allow root login */
135629baa8cSmrg	/* option to display characters such as asterisks, i.e. '**...'
136629baa8cSmrg	   for no-echo prompts like passwords */
1375ffd6003Smrg	Boolean		echo_passwd;
138629baa8cSmrg	char *		echo_passwd_char;
139145b7b3cSmrg	XIC		xic;		/* input method of input context */
140145b7b3cSmrg	loginPromptData	prompts[NUM_PROMPTS];
141629baa8cSmrg	time_t 		msgTimeout;
142145b7b3cSmrg
143578741aaSmrg# ifdef DANCING
144145b7b3cSmrg	/*caolan begin*/
145145b7b3cSmrg	int 		lastEventTime;
146145b7b3cSmrg	/*caolan end*/
147578741aaSmrg# endif /* DANCING */
148578741aaSmrg
149145b7b3cSmrg	int		outframewidth;	/* outer frame thickness */
150145b7b3cSmrg	int		inframeswidth;	/* inner frames thickness */
151145b7b3cSmrg	int		sepwidth;	/* width of separator line */
152145b7b3cSmrg
153578741aaSmrg# ifdef XPM
154145b7b3cSmrg        char *logoFileName;
155145b7b3cSmrg        unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth;
156145b7b3cSmrg        int logoX, logoY;
157145b7b3cSmrg        Window logoWindow;
158145b7b3cSmrg        Boolean useShape, logoValid;
159145b7b3cSmrg        Pixmap logoPixmap, logoMask;
160578741aaSmrg# endif /* XPM */
161578741aaSmrg# ifdef USE_XFT
162145b7b3cSmrg	XftDraw	       *draw;
163145b7b3cSmrg	XftFont        *textFace;	/* font for text */
164145b7b3cSmrg	XftFont        *promptFace;	/* font for prompts */
165145b7b3cSmrg	XftFont        *greetFace;	/* font for greeting */
166578741aaSmrg	XftFont        *failFace;  	/* font for failure message */
167145b7b3cSmrg	XftColor	textcolor;	/* foreground color */
168145b7b3cSmrg	XftColor	promptcolor;	/* prompt color */
169145b7b3cSmrg	XftColor	greetcolor;	/* greeting color */
170145b7b3cSmrg	XftColor	failcolor;	/* failure color */
171578741aaSmrg# endif
172145b7b3cSmrg   } LoginPart;
173145b7b3cSmrg
174145b7b3cSmrg/* Full instance record declaration */
175145b7b3cSmrgtypedef struct _LoginRec {
176145b7b3cSmrg   CorePart core;
177145b7b3cSmrg   LoginPart login;
178145b7b3cSmrg   } LoginRec;
179145b7b3cSmrg
180145b7b3cSmrg/* New fields for the Login widget class record */
181145b7b3cSmrgtypedef struct {int dummy;} LoginClassPart;
182145b7b3cSmrg
183145b7b3cSmrg/* Full class record declaration. */
184145b7b3cSmrgtypedef struct _LoginClassRec {
185145b7b3cSmrg   CoreClassPart core_class;
186145b7b3cSmrg   LoginClassPart login_class;
187145b7b3cSmrg   } LoginClassRec;
188145b7b3cSmrg
189145b7b3cSmrg/* Class pointer. */
190145b7b3cSmrgextern LoginClassRec loginClassRec;
191145b7b3cSmrg
192145b7b3cSmrg#endif /* _LoginP_h */
193