LoginP.h revision 629baa8c
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/* 29629baa8cSmrg * Copyright (c) 2006, Oracle and/or its affiliates. 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 { 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 */ 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 */ 112629baa8cSmrg char *failMsg; /* failure message */ 113145b7b3cSmrg char *fail; /* current error message */ 114629baa8cSmrg 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 */ 122629baa8cSmrg 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 */ 133629baa8cSmrg /* option to display characters such as asterisks, i.e. '**...' 134629baa8cSmrg for no-echo prompts like passwords */ 1355ffd6003Smrg Boolean echo_passwd; 136629baa8cSmrg char * echo_passwd_char; 137145b7b3cSmrg XIC xic; /* input method of input context */ 138145b7b3cSmrg loginPromptData prompts[NUM_PROMPTS]; 139629baa8cSmrg time_t msgTimeout; 140145b7b3cSmrg 141578741aaSmrg# ifdef DANCING 142145b7b3cSmrg /*caolan begin*/ 143145b7b3cSmrg int lastEventTime; 144145b7b3cSmrg /*caolan end*/ 145578741aaSmrg# endif /* DANCING */ 146578741aaSmrg 147145b7b3cSmrg int outframewidth; /* outer frame thickness */ 148145b7b3cSmrg int inframeswidth; /* inner frames thickness */ 149145b7b3cSmrg int sepwidth; /* width of separator line */ 150145b7b3cSmrg 151578741aaSmrg# ifdef XPM 152145b7b3cSmrg char *logoFileName; 153145b7b3cSmrg unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth; 154145b7b3cSmrg int logoX, logoY; 155145b7b3cSmrg Window logoWindow; 156145b7b3cSmrg Boolean useShape, logoValid; 157145b7b3cSmrg Pixmap logoPixmap, logoMask; 158578741aaSmrg# endif /* XPM */ 159578741aaSmrg# ifdef USE_XFT 160145b7b3cSmrg XftDraw *draw; 161145b7b3cSmrg XftFont *textFace; /* font for text */ 162145b7b3cSmrg XftFont *promptFace; /* font for prompts */ 163145b7b3cSmrg XftFont *greetFace; /* font for greeting */ 164578741aaSmrg XftFont *failFace; /* font for failure message */ 165145b7b3cSmrg XftColor textcolor; /* foreground color */ 166145b7b3cSmrg XftColor promptcolor; /* prompt color */ 167145b7b3cSmrg XftColor greetcolor; /* greeting color */ 168145b7b3cSmrg XftColor failcolor; /* failure color */ 169578741aaSmrg# endif 170145b7b3cSmrg } LoginPart; 171145b7b3cSmrg 172145b7b3cSmrg/* Full instance record declaration */ 173145b7b3cSmrgtypedef struct _LoginRec { 174145b7b3cSmrg CorePart core; 175145b7b3cSmrg LoginPart login; 176145b7b3cSmrg } LoginRec; 177145b7b3cSmrg 178145b7b3cSmrg/* New fields for the Login widget class record */ 179145b7b3cSmrgtypedef struct {int dummy;} LoginClassPart; 180145b7b3cSmrg 181145b7b3cSmrg/* Full class record declaration. */ 182145b7b3cSmrgtypedef struct _LoginClassRec { 183145b7b3cSmrg CoreClassPart core_class; 184145b7b3cSmrg LoginClassPart login_class; 185145b7b3cSmrg } LoginClassRec; 186145b7b3cSmrg 187145b7b3cSmrg/* Class pointer. */ 188145b7b3cSmrgextern LoginClassRec loginClassRec; 189145b7b3cSmrg 190145b7b3cSmrg#endif /* _LoginP_h */ 191