1 /* $TOG: vg.h /main/10 1998/09/14 18:30:15 mgreess $ */
3 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
4 * (c) Copyright 1993, 1994 International Business Machines Corp. *
5 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
6 * (c) Copyright 1993, 1994 Novell, Inc. *
8 /************************************<+>*************************************
9 ****************************************************************************
13 ** Project: HP Visual User Environment (DT)
15 ** Description: Main header file for Dtgreet application.
17 ** Defines, structure definitions, and external declarations
18 ** are specified here.
21 ** (c) Copyright 1987, 1988, 1989 by Hewlett-Packard Company
25 ****************************************************************************
26 ************************************<+>*************************************/
31 #include <X11/Xosdefs.h>
37 #include <sys/errno.h>
38 #include <sys/param.h>
44 # include <sys/security.h>
48 #ifdef SIGNALRETURNSINT
55 /****************************************************************************
59 ****************************************************************************/
63 * SAIC DT copyright is in a dt directory
65 #if defined( _SUN_OS )
66 # define COPYRIGHT "/usr/lib/X11/dt/etc/copyright"
68 # if defined( __hp_osf )
69 # define COPYRIGHT "/usr/X11/copyright"
71 # define COPYRIGHT "/etc/copyright"
75 #define NO_LOGIN_FILE "/etc/nologin"
77 #define DTLITESESSION "/usr/dt/bin/dtlitesession"
79 #define LOGIN_STR_LEN 1024
82 * option menu items...
85 #define OB_RESTART_SERVER 1
86 #define OB_NO_WINDOWS 2
87 #define OB_COPYRIGHT 3
95 #ifndef LAST_SESSION_FILE
96 #define LAST_SESSION_FILE "/.dt/sessions/lastsession"
100 #define DEF_SESSION CDE_INSTALLATION_TOP "/bin/Xsession"
104 * default resources... (Dimensions are in units of 100TH_MILLIMETER)
106 * - width/height of main matte
107 * - percentage offsets of login matte within main matte
109 * - margin height for message box buttons
115 #define XmNPIXELS "PIXELS"
118 #ifndef XmN100TH_MILLIMETERS
119 #define XmN100TH_MILLIMETERS "100TH_MILLIMETERS"
122 #define VnNmatteUnitType "Dtlogin*matte.unitType"
123 #define VnNmatteWidth "Dtlogin*matte.width"
124 #define VnNmatteHeight "Dtlogin*matte.height"
125 #define VnCMatteUnitType "Dtlogin*Form.UnitType"
126 #define VnCMatteWidth "Dtlogin*Form.Width"
127 #define VnCMatteHeight "Dtlogin*Form.Height"
129 #define MATTE_WIDTH 18500
130 #define MATTE_HEIGHT 6746
132 #define HRES_MATTE_WIDTH "835" /* pixels */
133 #define HRES_MATTE_HEIGHT "425" /* pixels */
134 #define MRES_MATTE_WIDTH "775" /* pixels */
135 #define MRES_MATTE_HEIGHT "400" /* pixels */
136 #define LRES_MATTE_WIDTH "585" /* pixels */
137 #define LRES_MATTE_HEIGHT "300" /* pixels */
139 #define LOGIN_TOP_POSITION "31" /* percent */
140 #define LOGIN_BOTTOM_POSITION "79" /* percent */
141 #define LOGIN_LEFT_POSITION "12" /* percent */
142 #define LOGIN_RIGHT_POSITION "88" /* percent */
144 #define SHADOW_THICKNESS FromMM(100) /* general border size */
145 #define ETCH_THICKNESS FromMM(150) /* login etch thickness */
146 #define MBOX_MARGIN_WIDTH FromMM(300)
147 #define MBOX_MARGIN_HEIGHT FromMM(300)
148 #define DROP_SHADOW_THICKNESS FromMM(400) /* logo drop shadow size */
149 /*#define MIN_BUTTON_SIZE FromMM(3600) minimum button size */
150 #define MIN_BUTTON_SIZE FromMM(3100) /* minimum button size */
151 #define TEXT_MARGIN_WIDTH FromMM(200) /* text wgt margin width */
152 #define TEXT_MARGIN_HEIGHT FromMM(100) /* text wgt margin height */
155 # define LABEL_FONT "-*-swiss 742-bold-r-normal-*-140-*-p-100-*"
156 # define LABEL_FONT_HRES "-*-swiss 742-medium-r-normal-*-140-*-p-110-*"
157 # define TEXT_FONT "-*-prestige-medium-r-normal-*-128-72-*"
158 # define TEXT_FONT_LRES "-*-helvetica-bold-r-normal-*-100-*"
159 # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*"
162 # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*-*-*-*-*-ISO8859-1"
165 #define TABLE_BACKGROUND "black"
166 #define TEXT_FOREGROUND "white"
168 #define BW_BACKGROUND "white"
169 #define BW_FOREGROUND "black"
170 #define BW_TEXT_BACKGROUND "black"
172 #define BW_LOGO_BACKGROUND "#a8a8a8"
173 #define BW_LOGO_TOPSHPIXMAP "25_foreground"
174 #define BW_DROP_BACKGROUND "black"
175 #define BW_DROP_FOREGROUND "white"
176 #define BW_DROP_BACKPIXMAP "25_foreground"
179 * define colors by rgb value rather than name. On other systems the name
180 * may map to a different shade of the desired color.
184 * #a8a8a8 = lightgray
189 #define CO_BACKGROUND "#a8a8a8"
190 #define CO_FOREGROUND "black"
191 #define CO_TEXT_BACKGROUND "#7e7e7e"
192 #define CO_HIGHLIGHT "#ef506f"
193 #define CO_SELECTCOLOR "#ef506f"
195 #define CO_LOGO_BACKGROUND "#ef506f"
196 #define CO_LOGO_TOPSHPIXMAP "25_foreground"
197 #define CO_DROP_BACKGROUND "#7e7e7e"
198 #define CO_DROP_FOREGROUND "#7e7e7e"
199 #define CO_DROP_BACKPIXMAP "background"
203 * macros to use when differentiating on resolution...
206 #define HIRES (dpyinfo.width > 1200) /* SUN MED_RES = 1182 */
207 #define MEDRES (dpyinfo.width > 800 && dpyinfo.width <= 1200)
208 #define LOWRES (dpyinfo.width <= 800)
212 * macro to determine authentication mechanism name...
215 #define vg_IsVerifyName(n) \
216 ((strcmp(getenv(VERIFYNAME),(n)) == 0 ) ? TRUE : FALSE)
218 /****************************************************************************
220 * Structure definitions
222 ****************************************************************************/
224 typedef enum widgetType { CascadeBG, DrawingA, Frame, Form, MessageBox,
225 Label, LabelG, PushB, PushBG, SeparatorG,
226 ToggleB, ToggleBG, Text }
230 typedef enum dialogType { error, help, copyright, hostname, expassword,
236 Boolean workspaceCursor;/* whether to define a root window cursor */
237 XmFontList labelFont; /* font for labels and buttons */
238 XmFontList textFont; /* font for dialog text */
239 XmFontList chlistFont; /* font for chooser list and heading */
240 int optionsDelay; /* seconds to delay before building menu */
241 int altDts; /* number of alternate desktops */
242 char *languageList; /* list of languages to display in menu */
243 int unitType; /* widgets' unit type */
244 char *languageListCmd; /* command to produce language list */
245 } AppInfo, *AppInfoPtr;
249 typedef struct displayInfo {
250 Display *dpy; /* initialized with XtDisplay() */
251 char *name; /* ASCII name of the display being used */
252 int screen; /* initialized with DefaultScreen() */
253 Window root; /* initialized with RootWindow() */
254 int depth; /* initialized with DefaultDepth() */
255 int width; /* initialized with DisplayWidth() */
256 int height; /* initialized with DisplayHeight() */
257 Pixel black_pixel; /* initialized with BlackPixel() */
258 Visual *visual; /* initialized with DefaultVisual() */
264 char *bitmapFile; /* bitmap file (if any) */
265 } LogoInfo, *LogoInfoPtr;
268 int bEcho; /* True=echoOn, False=echoOff */
269 Widget text[2]; /* [0] is echoOff, [1] is echoOn */
270 String onGreeting; /* echoOn greeting */
271 char *offGreetingFormat; /* printf format for echoOff greeting */
272 char *offGreetingUname; /* insert for echoOff greeting */
273 char noechobuf[MAXPATHLEN+1]; /* alternate buffer for echoOff */
274 } LoginText, *LoginTextPtr;
277 /****************************************************************************
279 * External variable declarations
281 ****************************************************************************/
283 extern Arg argt[]; /* used for resources */
284 extern DisplayInfo dpyinfo; /* information about the display */
285 extern char *errorLogFile; /* name of error log file (if any) */
286 extern char *langenv; /* current value of LANG environment var. */
287 extern XmString xmstr; /* used for compound strings */
288 extern int showVerifyError;/* display a Verify() error dialog */
290 extern AppInfo appInfo; /* application resources */
292 extern Widget toplevel; /* top level shell widget */
293 extern Widget login_shell; /* shell for the main login widgets. */
294 extern Widget table; /* black background for everything */
295 extern Widget matte; /* main level form widget */
296 extern Widget matteFrame; /* main level form widget */
297 extern Widget matte1; /* main level form widget */
299 extern Widget greeting; /* Welcome message */
300 extern Widget dt_label; /* Desktop label set in options menu */
302 extern Widget logo1; /* frame around the Corporate logo */
303 extern Widget logo_pixmap; /* Corporate logo */
304 extern Widget logo_shadow; /* drop shadow under the Corporate logo */
306 extern Widget login_matte; /* bulletin board for login/password */
307 extern Widget login_form; /* form containing the login extern Widgets */
308 extern Widget login_label; /* label to left of login text widget */
309 extern Widget login_text; /* login text widget */
310 extern Widget passwd_form; /* form containing the password widgets */
311 extern Widget passwd_label; /* label to left of password text widget */
312 extern Widget passwd_text; /* password text widget */
314 extern Widget ok_button; /* accept name/password text button */
315 extern Widget clear_button; /* clear name/password text button */
316 extern Widget options_button; /* login options button */
317 extern Widget help_button; /* help button */
319 extern Widget copyright_msg; /* copyright notice widget */
320 extern Widget help_message; /* the help message box */
321 extern Widget error_message; /* the error message box */
322 extern Widget hostname_message; /* the invalid hostname message box */
323 extern Widget passwd_message; /* the password expired message box */
325 extern Widget options_menu; /* pop-up menu on options button */
326 extern Widget options_item[]; /* items on options pop_up menu */
327 extern Widget options_failsafe; /* failsafe pane on options pop_up menu */
328 extern Widget options_dtlite; /* dtlite pane on options pop_up menu */
329 extern Widget options_dt; /* dt pane on options pop_up menu */
330 extern Widget *alt_dts; /* alt_dts widgets on options pop_up menu */
331 extern Widget options_last_dt; /* toggle button for user's last dt */
332 extern Widget options_sp_dt; /* toggle for user's special dt */
335 extern Widget lang_menu; /* cascading menu on "Language" option */
336 extern LogoInfo logoInfo; /* logo resources */
338 /****************************************************************************
342 ****************************************************************************/
343 #define vg_TRACE_EXECUTION(str) \
344 LogError((unsigned char *)"VG_TRACE: %s\n", str)
347 /****************************************************************************
349 * External procedure declarations
351 ****************************************************************************/
353 extern void ChangeBell( char *string) ;
354 extern void CleanupAndExit( Widget w, int exit_code) ;
355 extern void ClearCB( Widget w, XtPointer client_data, XtPointer call_data) ;
356 extern void CloseCatalog();
357 extern void CopyrightCB( Widget w, XtPointer client_data, XtPointer call_data) ;
358 extern void EditPasswdCB( Widget w, XtPointer client, XtPointer call_data) ;
359 extern void FakeFocusIn( Widget focus_widget, XtPointer client_data,
361 Boolean *continue_to_dispatch) ;
362 extern int FromMM( int mm ) ;
363 extern int FromPixel( Widget w, int orientation, int pixel) ;
364 extern void GetBiggest( Widget widget, Dimension *width, Dimension *height) ;
365 extern LoginTextPtr GetLoginTextPtr( Widget w );
366 extern int InitArg( WidgetType wtype) ;
367 extern void LangItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
368 extern void LayoutCB( Widget w, XtPointer client_data, XtPointer call_data) ;
369 extern void LogError( unsigned char *fmt, ... );
370 extern void MakeDialog( DialogType dtype) ;
371 extern void MakeLangMenu( void ) ;
372 extern void MakeLogo( void ) ;
373 extern void MakeOptionsMenu( void ) ;
374 extern void MenuItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
375 extern void OpenCatalog();
376 extern void OptionsUnmapCB( Widget wd, XtPointer client_data, XtPointer call_data) ;
377 extern void PingServerCB( XtPointer call_data, XtIntervalId *id) ;
378 extern void PostMenuCB( Widget w, XtPointer client_data, XtPointer call_data);
379 extern unsigned char * ReadCatalog( int set_num, int msg_num, char *def_str) ;
380 extern XmString ReadCatalogXms( int set_num, int msg_num, char *def_str) ;
381 extern void RefreshEH( Widget w, XtPointer client_data, XEvent *event,
382 Boolean *continue_to_dispatch) ;
383 extern void RequestCB( XtPointer client_data, int *source, XtInputId *id);
384 extern void RespondExitCB( Widget w, XtPointer client, XtPointer call);
385 extern void RespondLangCB( Widget w, XtPointer client, XtPointer call);
386 extern void RespondChallengeCB(Widget w, XtPointer client, XtPointer call);
387 extern void RespondClearCB(Widget w, XtPointer client, XtPointer call);
388 extern void RespondDialogCB(Widget w, XtPointer client, XtPointer call_data);
389 extern int SecureDisplay( void ) ;
390 extern void SetResourceDatabase( void ) ;
391 extern void ShowDialogCB( Widget w, XtPointer dialog, XtPointer call_data) ;
392 extern void TextFocusCB( Widget w, XtPointer client_data, XtPointer call_data) ;
393 extern int ToPixel( Widget w, int orientation, int pixel) ;
394 extern void UnsecureDisplay( void ) ;
395 extern void SetDtLabelAndIcon( void );
396 extern void SetDefaultDt( Widget w );
398 extern int Verify( char *name, char *passwd) ;