Home | History | Annotate | Line # | Download | only in greeter
      1 /*
      2 
      3 Copyright 1988, 1998  The Open Group
      4 
      5 Permission to use, copy, modify, distribute, and sell this software and its
      6 documentation for any purpose is hereby granted without fee, provided that
      7 the above copyright notice appear in all copies and that both that
      8 copyright notice and this permission notice appear in supporting
      9 documentation.
     10 
     11 The above copyright notice and this permission notice shall be included
     12 in all copies or substantial portions of the Software.
     13 
     14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
     18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     20 OTHER DEALINGS IN THE SOFTWARE.
     21 
     22 Except as contained in this notice, the name of The Open Group shall
     23 not be used in advertising or otherwise to promote the sale, use or
     24 other dealings in this Software without prior written authorization
     25 from The Open Group.
     26 
     27 */
     28 /*
     29  * Copyright (c) 2006, Oracle and/or its affiliates.
     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 
     72 typedef void (*LoginFunc)(LoginWidget, LoginData *, int);
     73 
     74 typedef 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 */
     89 typedef 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 	Pixel		inppixel;	/* input field bg pixel */
     99 	GC		textGC;		/* pointer to GraphicsContext */
    100 	GC		bgGC;		/* pointer to GraphicsContext */
    101 	GC		xorGC;		/* pointer to GraphicsContext */
    102 # ifndef USE_XFT
    103 	GC		promptGC;
    104 	GC		greetGC;
    105 	GC		failGC;
    106 # endif
    107 	GC		hiGC;		/* for hilight part of frame */
    108 	GC		shdGC;		/* for shaded part of frame */
    109 	GC		inpGC;		/* for input field of frame */
    110 	char		*greeting;	/* greeting */
    111 	char		*unsecure_greet;/* message displayed when insecure */
    112 	char		*namePrompt;	/* name prompt */
    113 	char		*passwdPrompt;	/* password prompt */
    114 	char		*failMsg;	/* failure message */
    115 	char		*fail;		/* current error message */
    116 	char		*passwdChangeMsg; /* message when passwd expires */
    117 # ifndef USE_XFT
    118 	XFontStruct	*textFont;	/* font for text */
    119 	XFontStruct	*promptFont;	/* font for prompts */
    120 	XFontStruct	*greetFont;	/* font for greeting */
    121 	XFontStruct	*failFont;	/* font for failure message */
    122 # endif /* USE_XFT */
    123 	int		state;		/* state */
    124 	int		activePrompt;	/* which prompt is active */
    125 	int		failUp;		/* failure message displayed */
    126 	LoginData	data;		/* name/passwd */
    127 	char		*sessionArg;	/* argument passed to session */
    128 	LoginFunc	notify_done;	/* proc to call when done */
    129 	int		failTimeout;	/* seconds til drop fail msg */
    130 	XtIntervalId	interval_id;	/* drop fail message note */
    131 	Boolean		secure_session;	/* session is secured */
    132 	Boolean		allow_access;	/* disable access control on login */
    133 	Boolean		allow_null_passwd; /* allow null password on login */
    134 	Boolean		allow_root_login; /* allow root login */
    135 	/* option to display characters such as asterisks, i.e. '**...'
    136 	   for no-echo prompts like passwords */
    137 	Boolean		echo_passwd;
    138 	char *		echo_passwd_char;
    139 	XIC		xic;		/* input method of input context */
    140 	loginPromptData	prompts[NUM_PROMPTS];
    141 	time_t 		msgTimeout;
    142 
    143 # ifdef DANCING
    144 	/*caolan begin*/
    145 	int 		lastEventTime;
    146 	/*caolan end*/
    147 # endif /* DANCING */
    148 
    149 	int		outframewidth;	/* outer frame thickness */
    150 	int		inframeswidth;	/* inner frames thickness */
    151 	int		sepwidth;	/* width of separator line */
    152 
    153 # ifdef XPM
    154         char *logoFileName;
    155         unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth;
    156         int logoX, logoY;
    157         Window logoWindow;
    158         Boolean useShape, logoValid;
    159         Pixmap logoPixmap, logoMask;
    160 # endif /* XPM */
    161 # ifdef USE_XFT
    162 	XftDraw	       *draw;
    163 	XftFont        *textFace;	/* font for text */
    164 	XftFont        *promptFace;	/* font for prompts */
    165 	XftFont        *greetFace;	/* font for greeting */
    166 	XftFont        *failFace;  	/* font for failure message */
    167 	XftColor	textcolor;	/* foreground color */
    168 	XftColor	promptcolor;	/* prompt color */
    169 	XftColor	greetcolor;	/* greeting color */
    170 	XftColor	failcolor;	/* failure color */
    171 # endif
    172    } LoginPart;
    173 
    174 /* Full instance record declaration */
    175 typedef struct _LoginRec {
    176    CorePart core;
    177    LoginPart login;
    178    } LoginRec;
    179 
    180 /* New fields for the Login widget class record */
    181 typedef struct {int dummy;} LoginClassPart;
    182 
    183 /* Full class record declaration. */
    184 typedef struct _LoginClassRec {
    185    CoreClassPart core_class;
    186    LoginClassPart login_class;
    187    } LoginClassRec;
    188 
    189 /* Class pointer. */
    190 extern LoginClassRec loginClassRec;
    191 
    192 #endif /* _LoginP_h */
    193