LoginP.h revision 5ffd6003
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/* 295ffd6003Smrg * Copyright © 2006 Sun Microsystems, Inc. All rights reserved. 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 { 75145b7b3cSmrg char * promptText; /* Prompt displayed */ 76145b7b3cSmrg const char * defaultPrompt; /* Default text for prompt */ 77145b7b3cSmrg char * valueText; /* Value entered for prompt */ 78145b7b3cSmrg size_t valueTextMax; /* Size of valueText buffer */ 79145b7b3cSmrg int valueShownStart;/* Amount of string shown if too */ 80145b7b3cSmrg 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 */ 98145b7b3cSmrg GC textGC; /* pointer to GraphicsContext */ 99145b7b3cSmrg GC bgGC; /* pointer to GraphicsContext */ 100145b7b3cSmrg GC xorGC; /* pointer to GraphicsContext */ 101578741aaSmrg# ifndef USE_XFT 102145b7b3cSmrg GC promptGC; 103145b7b3cSmrg GC greetGC; 104145b7b3cSmrg GC failGC; 105578741aaSmrg# endif 106145b7b3cSmrg GC hiGC; /* for hilight part of frame */ 107145b7b3cSmrg GC shdGC; /* for shaded part of frame */ 108145b7b3cSmrg char *greeting; /* greeting */ 109145b7b3cSmrg char *unsecure_greet;/* message displayed when insecure */ 110145b7b3cSmrg char *namePrompt; /* name prompt */ 111145b7b3cSmrg char *passwdPrompt; /* password prompt */ 112145b7b3cSmrg char *failMsg; /* failure message */ 113145b7b3cSmrg char *fail; /* current error message */ 114145b7b3cSmrg char *passwdChangeMsg; /* message when passwd expires */ 115578741aaSmrg# ifndef USE_XFT 116145b7b3cSmrg XFontStruct *textFont; /* font for text */ 117145b7b3cSmrg XFontStruct *promptFont; /* font for prompts */ 118145b7b3cSmrg XFontStruct *greetFont; /* font for greeting */ 119145b7b3cSmrg XFontStruct *failFont; /* font for failure message */ 120578741aaSmrg# endif /* USE_XFT */ 121145b7b3cSmrg int state; /* state */ 122145b7b3cSmrg int activePrompt; /* which prompt is active */ 123145b7b3cSmrg int failUp; /* failure message displayed */ 124145b7b3cSmrg LoginData data; /* name/passwd */ 125145b7b3cSmrg char *sessionArg; /* argument passed to session */ 126145b7b3cSmrg LoginFunc notify_done; /* proc to call when done */ 127145b7b3cSmrg int failTimeout; /* seconds til drop fail msg */ 128145b7b3cSmrg XtIntervalId interval_id; /* drop fail message note */ 129145b7b3cSmrg Boolean secure_session; /* session is secured */ 130145b7b3cSmrg Boolean allow_access; /* disable access control on login */ 131145b7b3cSmrg Boolean allow_null_passwd; /* allow null password on login */ 132145b7b3cSmrg Boolean allow_root_login; /* allow root login */ 1335ffd6003Smrg /* show password as asterisks, i.e. '**...' */ 1345ffd6003Smrg Boolean echo_passwd; 135145b7b3cSmrg XIC xic; /* input method of input context */ 136145b7b3cSmrg loginPromptData prompts[NUM_PROMPTS]; 137145b7b3cSmrg time_t msgTimeout; 138145b7b3cSmrg 139578741aaSmrg# ifdef DANCING 140145b7b3cSmrg /*caolan begin*/ 141145b7b3cSmrg int lastEventTime; 142145b7b3cSmrg /*caolan end*/ 143578741aaSmrg# endif /* DANCING */ 144578741aaSmrg 145145b7b3cSmrg int outframewidth; /* outer frame thickness */ 146145b7b3cSmrg int inframeswidth; /* inner frames thickness */ 147145b7b3cSmrg int sepwidth; /* width of separator line */ 148145b7b3cSmrg 149578741aaSmrg# ifdef XPM 150145b7b3cSmrg char *logoFileName; 151145b7b3cSmrg unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth; 152145b7b3cSmrg int logoX, logoY; 153145b7b3cSmrg Window logoWindow; 154145b7b3cSmrg Boolean useShape, logoValid; 155145b7b3cSmrg Pixmap logoPixmap, logoMask; 156578741aaSmrg# endif /* XPM */ 157578741aaSmrg# ifdef USE_XFT 158145b7b3cSmrg XftDraw *draw; 159145b7b3cSmrg XftFont *textFace; /* font for text */ 160145b7b3cSmrg XftFont *promptFace; /* font for prompts */ 161145b7b3cSmrg XftFont *greetFace; /* font for greeting */ 162578741aaSmrg XftFont *failFace; /* font for failure message */ 163145b7b3cSmrg XftColor textcolor; /* foreground color */ 164145b7b3cSmrg XftColor promptcolor; /* prompt color */ 165145b7b3cSmrg XftColor greetcolor; /* greeting color */ 166145b7b3cSmrg XftColor failcolor; /* failure color */ 167578741aaSmrg# endif 168145b7b3cSmrg } LoginPart; 169145b7b3cSmrg 170145b7b3cSmrg/* Full instance record declaration */ 171145b7b3cSmrgtypedef struct _LoginRec { 172145b7b3cSmrg CorePart core; 173145b7b3cSmrg LoginPart login; 174145b7b3cSmrg } LoginRec; 175145b7b3cSmrg 176145b7b3cSmrg/* New fields for the Login widget class record */ 177145b7b3cSmrgtypedef struct {int dummy;} LoginClassPart; 178145b7b3cSmrg 179145b7b3cSmrg/* Full class record declaration. */ 180145b7b3cSmrgtypedef struct _LoginClassRec { 181145b7b3cSmrg CoreClassPart core_class; 182145b7b3cSmrg LoginClassPart login_class; 183145b7b3cSmrg } LoginClassRec; 184145b7b3cSmrg 185145b7b3cSmrg/* Class pointer. */ 186145b7b3cSmrgextern LoginClassRec loginClassRec; 187145b7b3cSmrg 188145b7b3cSmrg#endif /* _LoginP_h */ 189