LoginP.h revision 578741aa
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*/ 28145b7b3cSmrg/* Copyright 2006 Sun Microsystems, Inc. All rights reserved. 29145b7b3cSmrg * 30145b7b3cSmrg * Permission is hereby granted, free of charge, to any person obtaining a 31145b7b3cSmrg * copy of this software and associated documentation files (the 32145b7b3cSmrg * "Software"), to deal in the Software without restriction, including 33145b7b3cSmrg * without limitation the rights to use, copy, modify, merge, publish, 34145b7b3cSmrg * distribute, and/or sell copies of the Software, and to permit persons 35145b7b3cSmrg * to whom the Software is furnished to do so, provided that the above 36145b7b3cSmrg * copyright notice(s) and this permission notice appear in all copies of 37145b7b3cSmrg * the Software and that both the above copyright notice(s) and this 38145b7b3cSmrg * permission notice appear in supporting documentation. 39145b7b3cSmrg * 40145b7b3cSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 41145b7b3cSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 42145b7b3cSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 43145b7b3cSmrg * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 44145b7b3cSmrg * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL 45145b7b3cSmrg * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING 46145b7b3cSmrg * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 47145b7b3cSmrg * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 48145b7b3cSmrg * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 49145b7b3cSmrg * 50145b7b3cSmrg * Except as contained in this notice, the name of a copyright holder 51145b7b3cSmrg * shall not be used in advertising or otherwise to promote the sale, use 52145b7b3cSmrg * or other dealings in this Software without prior written authorization 53145b7b3cSmrg * of the copyright holder. 54145b7b3cSmrg */ 55145b7b3cSmrg 56145b7b3cSmrg/* 57145b7b3cSmrg * xdm - display manager daemon 58145b7b3cSmrg * Author: Keith Packard, MIT X Consortium 59145b7b3cSmrg */ 60145b7b3cSmrg 61145b7b3cSmrg#ifndef _LoginP_h 62578741aaSmrg# define _LoginP_h 63145b7b3cSmrg 64578741aaSmrg# include "Login.h" 65578741aaSmrg# include <X11/IntrinsicP.h> 66578741aaSmrg# include <X11/CoreP.h> 67578741aaSmrg# include <X11/Xlib.h> 68578741aaSmrg# ifdef USE_XFT 69578741aaSmrg# include <X11/Xft/Xft.h> 70578741aaSmrg# endif 71145b7b3cSmrg 72578741aaSmrg# define INITIALIZING 0 73578741aaSmrg# define PROMPTING 1 74578741aaSmrg# define SHOW_MESSAGE 2 75578741aaSmrg# define DONE 3 76145b7b3cSmrg 77145b7b3cSmrgtypedef void (*LoginFunc)(LoginWidget, LoginData *, int); 78145b7b3cSmrg 79145b7b3cSmrgtypedef struct { 80145b7b3cSmrg char * promptText; /* Prompt displayed */ 81145b7b3cSmrg const char * defaultPrompt; /* Default text for prompt */ 82145b7b3cSmrg char * valueText; /* Value entered for prompt */ 83145b7b3cSmrg size_t valueTextMax; /* Size of valueText buffer */ 84145b7b3cSmrg int valueShownStart;/* Amount of string shown if too */ 85145b7b3cSmrg int valueShownEnd; /* long to fit in field */ 86578741aaSmrg int cursor; /* current cursor position */ 87145b7b3cSmrg loginPromptState state; 88145b7b3cSmrg} loginPromptData; 89145b7b3cSmrg 90578741aaSmrg# define NUM_PROMPTS 2 /* Currently only 2 prompt fields supported */ 91578741aaSmrg# define LAST_PROMPT (NUM_PROMPTS - 1) 92145b7b3cSmrg 93145b7b3cSmrg/* New fields for the login widget instance record */ 94145b7b3cSmrgtypedef struct { 95578741aaSmrg# ifndef USE_XFT 96145b7b3cSmrg Pixel textpixel; /* foreground pixel */ 97145b7b3cSmrg Pixel promptpixel; /* prompt pixel */ 98145b7b3cSmrg Pixel greetpixel; /* greeting pixel */ 99145b7b3cSmrg Pixel failpixel; /* failure pixel */ 100578741aaSmrg# endif 101145b7b3cSmrg Pixel hipixel; /* frame hilite pixel */ 102145b7b3cSmrg Pixel shdpixel; /* shadow frame pixel */ 103145b7b3cSmrg GC textGC; /* pointer to GraphicsContext */ 104145b7b3cSmrg GC bgGC; /* pointer to GraphicsContext */ 105145b7b3cSmrg GC xorGC; /* pointer to GraphicsContext */ 106578741aaSmrg# ifndef USE_XFT 107145b7b3cSmrg GC promptGC; 108145b7b3cSmrg GC greetGC; 109145b7b3cSmrg GC failGC; 110578741aaSmrg# endif 111145b7b3cSmrg GC hiGC; /* for hilight part of frame */ 112145b7b3cSmrg GC shdGC; /* for shaded part of frame */ 113145b7b3cSmrg char *greeting; /* greeting */ 114145b7b3cSmrg char *unsecure_greet;/* message displayed when insecure */ 115145b7b3cSmrg char *namePrompt; /* name prompt */ 116145b7b3cSmrg char *passwdPrompt; /* password prompt */ 117145b7b3cSmrg char *failMsg; /* failure message */ 118145b7b3cSmrg char *fail; /* current error message */ 119145b7b3cSmrg char *passwdChangeMsg; /* message when passwd expires */ 120578741aaSmrg# ifndef USE_XFT 121145b7b3cSmrg XFontStruct *textFont; /* font for text */ 122145b7b3cSmrg XFontStruct *promptFont; /* font for prompts */ 123145b7b3cSmrg XFontStruct *greetFont; /* font for greeting */ 124145b7b3cSmrg XFontStruct *failFont; /* font for failure message */ 125578741aaSmrg# endif /* USE_XFT */ 126145b7b3cSmrg int state; /* state */ 127145b7b3cSmrg int activePrompt; /* which prompt is active */ 128145b7b3cSmrg int failUp; /* failure message displayed */ 129145b7b3cSmrg LoginData data; /* name/passwd */ 130145b7b3cSmrg char *sessionArg; /* argument passed to session */ 131145b7b3cSmrg LoginFunc notify_done; /* proc to call when done */ 132145b7b3cSmrg int failTimeout; /* seconds til drop fail msg */ 133145b7b3cSmrg XtIntervalId interval_id; /* drop fail message note */ 134145b7b3cSmrg Boolean secure_session; /* session is secured */ 135145b7b3cSmrg Boolean allow_access; /* disable access control on login */ 136145b7b3cSmrg Boolean allow_null_passwd; /* allow null password on login */ 137145b7b3cSmrg Boolean allow_root_login; /* allow root login */ 138145b7b3cSmrg XIC xic; /* input method of input context */ 139145b7b3cSmrg loginPromptData prompts[NUM_PROMPTS]; 140145b7b3cSmrg time_t msgTimeout; 141145b7b3cSmrg 142578741aaSmrg# ifdef DANCING 143145b7b3cSmrg /*caolan begin*/ 144145b7b3cSmrg int lastEventTime; 145145b7b3cSmrg /*caolan end*/ 146578741aaSmrg# endif /* DANCING */ 147578741aaSmrg 148145b7b3cSmrg int outframewidth; /* outer frame thickness */ 149145b7b3cSmrg int inframeswidth; /* inner frames thickness */ 150145b7b3cSmrg int sepwidth; /* width of separator line */ 151145b7b3cSmrg 152578741aaSmrg# ifdef XPM 153145b7b3cSmrg char *logoFileName; 154145b7b3cSmrg unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth; 155145b7b3cSmrg int logoX, logoY; 156145b7b3cSmrg Window logoWindow; 157145b7b3cSmrg Boolean useShape, logoValid; 158145b7b3cSmrg Pixmap logoPixmap, logoMask; 159578741aaSmrg# endif /* XPM */ 160578741aaSmrg# ifdef USE_XFT 161145b7b3cSmrg XftDraw *draw; 162145b7b3cSmrg XftFont *textFace; /* font for text */ 163145b7b3cSmrg XftFont *promptFace; /* font for prompts */ 164145b7b3cSmrg XftFont *greetFace; /* font for greeting */ 165578741aaSmrg XftFont *failFace; /* font for failure message */ 166145b7b3cSmrg XftColor textcolor; /* foreground color */ 167145b7b3cSmrg XftColor promptcolor; /* prompt color */ 168145b7b3cSmrg XftColor greetcolor; /* greeting color */ 169145b7b3cSmrg XftColor failcolor; /* failure color */ 170578741aaSmrg# endif 171145b7b3cSmrg } LoginPart; 172145b7b3cSmrg 173145b7b3cSmrg/* Full instance record declaration */ 174145b7b3cSmrgtypedef struct _LoginRec { 175145b7b3cSmrg CorePart core; 176145b7b3cSmrg LoginPart login; 177145b7b3cSmrg } LoginRec; 178145b7b3cSmrg 179145b7b3cSmrg/* New fields for the Login widget class record */ 180145b7b3cSmrgtypedef struct {int dummy;} LoginClassPart; 181145b7b3cSmrg 182145b7b3cSmrg/* Full class record declaration. */ 183145b7b3cSmrgtypedef struct _LoginClassRec { 184145b7b3cSmrg CoreClassPart core_class; 185145b7b3cSmrg LoginClassPart login_class; 186145b7b3cSmrg } LoginClassRec; 187145b7b3cSmrg 188145b7b3cSmrg/* Class pointer. */ 189145b7b3cSmrgextern LoginClassRec loginClassRec; 190145b7b3cSmrg 191145b7b3cSmrg#endif /* _LoginP_h */ 192