2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: vg.h /main/10 1998/09/14 18:30:15 mgreess $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
26 * (c) Copyright 1993, 1994 International Business Machines Corp. *
27 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
28 * (c) Copyright 1993, 1994 Novell, Inc. *
30 /************************************<+>*************************************
31 ****************************************************************************
35 ** Project: HP Visual User Environment (DT)
37 ** Description: Main header file for Dtgreet application.
39 ** Defines, structure definitions, and external declarations
40 ** are specified here.
43 ** (c) Copyright 1987, 1988, 1989 by Hewlett-Packard Company
47 ****************************************************************************
48 ************************************<+>*************************************/
53 #include <X11/Xosdefs.h>
59 #include <sys/errno.h>
60 #include <sys/param.h>
66 # include <sys/security.h>
70 #ifdef SIGNALRETURNSINT
77 /****************************************************************************
81 ****************************************************************************/
85 * SAIC DT copyright is in a dt directory
87 #if defined( _SUN_OS )
88 # define COPYRIGHT "/usr/lib/X11/dt/etc/copyright"
90 # if defined( __hp_osf )
91 # define COPYRIGHT "/usr/X11/copyright"
93 # define COPYRIGHT "/etc/copyright"
97 #define NO_LOGIN_FILE "/etc/nologin"
99 #define DTLITESESSION "/usr/dt/bin/dtlitesession"
101 #define LOGIN_STR_LEN 1024
104 * option menu items...
107 #define OB_RESTART_SERVER 1
108 #define OB_NO_WINDOWS 2
109 #define OB_COPYRIGHT 3
110 #define OB_FAILSAFE 4
111 #define OB_LANGUAGE 5
115 #define OB_LAST_DT 10
117 #ifndef LAST_SESSION_FILE
118 #define LAST_SESSION_FILE "/.dt/sessions/lastsession"
122 #define DEF_SESSION CDE_INSTALLATION_TOP "/bin/Xsession"
126 * default resources... (Dimensions are in units of 100TH_MILLIMETER)
128 * - width/height of main matte
129 * - percentage offsets of login matte within main matte
131 * - margin height for message box buttons
137 #define XmNPIXELS "PIXELS"
140 #ifndef XmN100TH_MILLIMETERS
141 #define XmN100TH_MILLIMETERS "100TH_MILLIMETERS"
144 #define VnNmatteUnitType "Dtlogin*matte.unitType"
145 #define VnNmatteWidth "Dtlogin*matte.width"
146 #define VnNmatteHeight "Dtlogin*matte.height"
147 #define VnCMatteUnitType "Dtlogin*Form.UnitType"
148 #define VnCMatteWidth "Dtlogin*Form.Width"
149 #define VnCMatteHeight "Dtlogin*Form.Height"
151 #define MATTE_WIDTH 18500
152 #define MATTE_HEIGHT 6746
154 #define HRES_MATTE_WIDTH "835" /* pixels */
155 #define HRES_MATTE_HEIGHT "425" /* pixels */
156 #define MRES_MATTE_WIDTH "775" /* pixels */
157 #define MRES_MATTE_HEIGHT "400" /* pixels */
158 #define LRES_MATTE_WIDTH "585" /* pixels */
159 #define LRES_MATTE_HEIGHT "300" /* pixels */
161 #define LOGIN_TOP_POSITION "31" /* percent */
162 #define LOGIN_BOTTOM_POSITION "79" /* percent */
163 #define LOGIN_LEFT_POSITION "12" /* percent */
164 #define LOGIN_RIGHT_POSITION "88" /* percent */
166 #define SHADOW_THICKNESS FromMM(100) /* general border size */
167 #define ETCH_THICKNESS FromMM(150) /* login etch thickness */
168 #define MBOX_MARGIN_WIDTH FromMM(300)
169 #define MBOX_MARGIN_HEIGHT FromMM(300)
170 #define DROP_SHADOW_THICKNESS FromMM(400) /* logo drop shadow size */
171 /*#define MIN_BUTTON_SIZE FromMM(3600) minimum button size */
172 #define MIN_BUTTON_SIZE FromMM(3100) /* minimum button size */
173 #define TEXT_MARGIN_WIDTH FromMM(200) /* text wgt margin width */
174 #define TEXT_MARGIN_HEIGHT FromMM(100) /* text wgt margin height */
177 # define LABEL_FONT "-*-swiss 742-bold-r-normal-*-140-*-p-100-*"
178 # define LABEL_FONT_HRES "-*-swiss 742-medium-r-normal-*-140-*-p-110-*"
179 # define TEXT_FONT "-*-prestige-medium-r-normal-*-128-72-*"
180 # define TEXT_FONT_LRES "-*-helvetica-bold-r-normal-*-100-*"
181 # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*"
184 # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*-*-*-*-*-ISO8859-1"
187 #define TABLE_BACKGROUND "black"
188 #define TEXT_FOREGROUND "white"
190 #define BW_BACKGROUND "white"
191 #define BW_FOREGROUND "black"
192 #define BW_TEXT_BACKGROUND "black"
194 #define BW_LOGO_BACKGROUND "#a8a8a8"
195 #define BW_LOGO_TOPSHPIXMAP "25_foreground"
196 #define BW_DROP_BACKGROUND "black"
197 #define BW_DROP_FOREGROUND "white"
198 #define BW_DROP_BACKPIXMAP "25_foreground"
201 * define colors by rgb value rather than name. On other systems the name
202 * may map to a different shade of the desired color.
206 * #a8a8a8 = lightgray
211 #define CO_BACKGROUND "#a8a8a8"
212 #define CO_FOREGROUND "black"
213 #define CO_TEXT_BACKGROUND "#7e7e7e"
214 #define CO_HIGHLIGHT "#ef506f"
215 #define CO_SELECTCOLOR "#ef506f"
217 #define CO_LOGO_BACKGROUND "#ef506f"
218 #define CO_LOGO_TOPSHPIXMAP "25_foreground"
219 #define CO_DROP_BACKGROUND "#7e7e7e"
220 #define CO_DROP_FOREGROUND "#7e7e7e"
221 #define CO_DROP_BACKPIXMAP "background"
225 * macros to use when differentiating on resolution...
228 #define HIRES (dpyinfo.width > 1200) /* SUN MED_RES = 1182 */
229 #define MEDRES (dpyinfo.width > 800 && dpyinfo.width <= 1200)
230 #define LOWRES (dpyinfo.width <= 800)
234 * macro to determine authentication mechanism name...
237 #define vg_IsVerifyName(n) \
238 ((strcmp(getenv(VERIFYNAME),(n)) == 0 ) ? TRUE : FALSE)
240 /****************************************************************************
242 * Structure definitions
244 ****************************************************************************/
246 typedef enum widgetType { CascadeBG, DrawingA, Frame, Form, MessageBox,
247 Label, LabelG, PushB, PushBG, SeparatorG,
248 ToggleB, ToggleBG, Text }
252 typedef enum dialogType { error, help, copyright, hostname, expassword,
258 Boolean workspaceCursor;/* whether to define a root window cursor */
259 XmFontList labelFont; /* font for labels and buttons */
260 XmFontList textFont; /* font for dialog text */
261 XmFontList chlistFont; /* font for chooser list and heading */
262 int optionsDelay; /* seconds to delay before building menu */
263 int altDts; /* number of alternate desktops */
264 char *languageList; /* list of languages to display in menu */
265 int unitType; /* widgets' unit type */
266 char *languageListCmd; /* command to produce language list */
267 } AppInfo, *AppInfoPtr;
271 typedef struct displayInfo {
272 Display *dpy; /* initialized with XtDisplay() */
273 char *name; /* ASCII name of the display being used */
274 int screen; /* initialized with DefaultScreen() */
275 Window root; /* initialized with RootWindow() */
276 int depth; /* initialized with DefaultDepth() */
277 int width; /* initialized with DisplayWidth() */
278 int height; /* initialized with DisplayHeight() */
279 Pixel black_pixel; /* initialized with BlackPixel() */
280 Visual *visual; /* initialized with DefaultVisual() */
286 char *bitmapFile; /* bitmap file (if any) */
287 } LogoInfo, *LogoInfoPtr;
290 int bEcho; /* True=echoOn, False=echoOff */
291 Widget text[2]; /* [0] is echoOff, [1] is echoOn */
292 String onGreeting; /* echoOn greeting */
293 char *offGreetingFormat; /* printf format for echoOff greeting */
294 char *offGreetingUname; /* insert for echoOff greeting */
295 char noechobuf[MAXPATHLEN+1]; /* alternate buffer for echoOff */
296 } LoginText, *LoginTextPtr;
299 /****************************************************************************
301 * External variable declarations
303 ****************************************************************************/
305 extern Arg argt[]; /* used for resources */
306 extern DisplayInfo dpyinfo; /* information about the display */
307 extern char *errorLogFile; /* name of error log file (if any) */
308 extern char *langenv; /* current value of LANG environment var. */
309 extern XmString xmstr; /* used for compound strings */
310 extern int showVerifyError;/* display a Verify() error dialog */
312 extern AppInfo appInfo; /* application resources */
314 extern Widget toplevel; /* top level shell widget */
315 extern Widget login_shell; /* shell for the main login widgets. */
316 extern Widget table; /* black background for everything */
317 extern Widget matte; /* main level form widget */
318 extern Widget matteFrame; /* main level form widget */
319 extern Widget matte1; /* main level form widget */
321 extern Widget greeting; /* Welcome message */
322 extern Widget dt_label; /* Desktop label set in options menu */
324 extern Widget logo1; /* frame around the Corporate logo */
325 extern Widget logo_pixmap; /* Corporate logo */
326 extern Widget logo_shadow; /* drop shadow under the Corporate logo */
328 extern Widget login_matte; /* bulletin board for login/password */
329 extern Widget login_form; /* form containing the login extern Widgets */
330 extern Widget login_label; /* label to left of login text widget */
331 extern Widget login_text; /* login text widget */
332 extern Widget passwd_form; /* form containing the password widgets */
333 extern Widget passwd_label; /* label to left of password text widget */
334 extern Widget passwd_text; /* password text widget */
336 extern Widget ok_button; /* accept name/password text button */
337 extern Widget clear_button; /* clear name/password text button */
338 extern Widget options_button; /* login options button */
339 extern Widget help_button; /* help button */
341 extern Widget copyright_msg; /* copyright notice widget */
342 extern Widget help_message; /* the help message box */
343 extern Widget error_message; /* the error message box */
344 extern Widget hostname_message; /* the invalid hostname message box */
345 extern Widget passwd_message; /* the password expired message box */
347 extern Widget options_menu; /* pop-up menu on options button */
348 extern Widget options_item[]; /* items on options pop_up menu */
349 extern Widget options_failsafe; /* failsafe pane on options pop_up menu */
350 extern Widget options_dtlite; /* dtlite pane on options pop_up menu */
351 extern Widget options_dt; /* dt pane on options pop_up menu */
352 extern Widget *alt_dts; /* alt_dts widgets on options pop_up menu */
353 extern Widget options_last_dt; /* toggle button for user's last dt */
354 extern Widget options_sp_dt; /* toggle for user's special dt */
357 extern Widget lang_menu; /* cascading menu on "Language" option */
358 extern LogoInfo logoInfo; /* logo resources */
360 /****************************************************************************
364 ****************************************************************************/
365 #define vg_TRACE_EXECUTION(str) \
366 LogError((unsigned char *)"VG_TRACE: %s\n", str)
369 /****************************************************************************
371 * External procedure declarations
373 ****************************************************************************/
375 extern void ChangeBell( char *string) ;
376 extern void CleanupAndExit( Widget w, int exit_code) ;
377 extern void ClearCB( Widget w, XtPointer client_data, XtPointer call_data) ;
378 extern void CloseCatalog();
379 extern void CopyrightCB( Widget w, XtPointer client_data, XtPointer call_data) ;
380 extern void EditPasswdCB( Widget w, XtPointer client, XtPointer call_data) ;
381 extern void FakeFocusIn( Widget focus_widget, XtPointer client_data,
383 Boolean *continue_to_dispatch) ;
384 extern int FromMM( int mm ) ;
385 extern int FromPixel( Widget w, int orientation, int pixel) ;
386 extern void GetBiggest( Widget widget, Dimension *width, Dimension *height) ;
387 extern LoginTextPtr GetLoginTextPtr( Widget w );
388 extern int InitArg( WidgetType wtype) ;
389 extern void LangItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
390 extern void LayoutCB( Widget w, XtPointer client_data, XtPointer call_data) ;
391 extern void LogError( unsigned char *fmt, ... );
392 extern void MakeDialog( DialogType dtype) ;
393 extern void MakeLangMenu( void ) ;
394 extern void MakeLogo( void ) ;
395 extern void MakeOptionsMenu( void ) ;
396 extern void MenuItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
397 extern void OpenCatalog();
398 extern void OptionsUnmapCB( Widget wd, XtPointer client_data, XtPointer call_data) ;
399 extern void PingServerCB( XtPointer call_data, XtIntervalId *id) ;
400 extern void PostMenuCB( Widget w, XtPointer client_data, XtPointer call_data);
401 extern unsigned char * ReadCatalog( int set_num, int msg_num, char *def_str) ;
402 extern XmString ReadCatalogXms( int set_num, int msg_num, char *def_str) ;
403 extern void RefreshEH( Widget w, XtPointer client_data, XEvent *event,
404 Boolean *continue_to_dispatch) ;
405 extern void RequestCB( XtPointer client_data, int *source, XtInputId *id);
406 extern void RespondExitCB( Widget w, XtPointer client, XtPointer call);
407 extern void RespondLangCB( Widget w, XtPointer client, XtPointer call);
408 extern void RespondChallengeCB(Widget w, XtPointer client, XtPointer call);
409 extern void RespondClearCB(Widget w, XtPointer client, XtPointer call);
410 extern void RespondDialogCB(Widget w, XtPointer client, XtPointer call_data);
411 extern int SecureDisplay( void ) ;
412 extern void SetResourceDatabase( void ) ;
413 extern void ShowDialogCB( Widget w, XtPointer dialog, XtPointer call_data) ;
414 extern void TextFocusCB( Widget w, XtPointer client_data, XtPointer call_data) ;
415 extern int ToPixel( Widget w, int orientation, int pixel) ;
416 extern void UnsecureDisplay( void ) ;
417 extern void SetDtLabelAndIcon( void );
418 extern void SetDefaultDt( Widget w );
420 extern int Verify( char *name, char *passwd) ;