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 libraries 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 # include <DtXinerama.h>
73 #ifdef SIGNALRETURNSINT
80 /****************************************************************************
84 ****************************************************************************/
88 * SAIC DT copyright is in a dt directory
90 #if defined( _SUN_OS )
91 # define COPYRIGHT "/usr/lib/X11/dt/etc/copyright"
93 # define COPYRIGHT "/etc/copyright"
96 #define NO_LOGIN_FILE "/etc/nologin"
98 #define DTLITESESSION "/usr/dt/bin/dtlitesession"
100 #define LOGIN_STR_LEN 1024
103 * option menu items...
106 #define OB_RESTART_SERVER 1
107 #define OB_NO_WINDOWS 2
108 #define OB_COPYRIGHT 3
109 #define OB_FAILSAFE 4
110 #define OB_LANGUAGE 5
114 #define OB_LAST_DT 10
116 #ifndef LAST_SESSION_FILE
117 #define LAST_SESSION_FILE "/.dt/sessions/lastsession"
121 #define DEF_SESSION CDE_INSTALLATION_TOP "/bin/Xsession"
125 * default resources... (Dimensions are in units of 100TH_MILLIMETER)
127 * - width/height of main matte
128 * - percentage offsets of login matte within main matte
130 * - margin height for message box buttons
136 #define XmNPIXELS "PIXELS"
139 #ifndef XmN100TH_MILLIMETERS
140 #define XmN100TH_MILLIMETERS "100TH_MILLIMETERS"
143 #define VnNmatteUnitType "Dtlogin*matte.unitType"
144 #define VnNmatteWidth "Dtlogin*matte.width"
145 #define VnNmatteHeight "Dtlogin*matte.height"
146 #define VnCMatteUnitType "Dtlogin*Form.UnitType"
147 #define VnCMatteWidth "Dtlogin*Form.Width"
148 #define VnCMatteHeight "Dtlogin*Form.Height"
150 #define MATTE_WIDTH 18500
151 #define MATTE_HEIGHT 6746
153 #define HRES_MATTE_WIDTH "835" /* pixels */
154 #define HRES_MATTE_HEIGHT "425" /* pixels */
155 #define MRES_MATTE_WIDTH "775" /* pixels */
156 #define MRES_MATTE_HEIGHT "400" /* pixels */
157 #define LRES_MATTE_WIDTH "585" /* pixels */
158 #define LRES_MATTE_HEIGHT "300" /* pixels */
160 #define LOGIN_TOP_POSITION "31" /* percent */
161 #define LOGIN_BOTTOM_POSITION "79" /* percent */
162 #define LOGIN_LEFT_POSITION "12" /* percent */
163 #define LOGIN_RIGHT_POSITION "88" /* percent */
165 #define SHADOW_THICKNESS FromMM(100) /* general border size */
166 #define ETCH_THICKNESS FromMM(150) /* login etch thickness */
167 #define MBOX_MARGIN_WIDTH FromMM(300)
168 #define MBOX_MARGIN_HEIGHT FromMM(300)
169 #define DROP_SHADOW_THICKNESS FromMM(400) /* logo drop shadow size */
170 /*#define MIN_BUTTON_SIZE FromMM(3600) minimum button size */
171 #define MIN_BUTTON_SIZE FromMM(3100) /* minimum button size */
172 #define TEXT_MARGIN_WIDTH FromMM(200) /* text wgt margin width */
173 #define TEXT_MARGIN_HEIGHT FromMM(100) /* text wgt margin height */
176 # define LABEL_FONT "-*-swiss 742-bold-r-normal-*-140-*-p-100-*"
177 # define LABEL_FONT_HRES "-*-swiss 742-medium-r-normal-*-140-*-p-110-*"
178 # define TEXT_FONT "-*-prestige-medium-r-normal-*-128-72-*"
179 # define TEXT_FONT_LRES "-*-helvetica-bold-r-normal-*-100-*"
180 # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*"
183 # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*-*-*-*-*-ISO8859-1"
186 #define TABLE_BACKGROUND "black"
187 #define TEXT_FOREGROUND "white"
189 #define BW_BACKGROUND "white"
190 #define BW_FOREGROUND "black"
191 #define BW_TEXT_BACKGROUND "black"
193 #define BW_LOGO_BACKGROUND "#a8a8a8"
194 #define BW_LOGO_TOPSHPIXMAP "25_foreground"
195 #define BW_DROP_BACKGROUND "black"
196 #define BW_DROP_FOREGROUND "white"
197 #define BW_DROP_BACKPIXMAP "25_foreground"
200 * define colors by rgb value rather than name. On other systems the name
201 * may map to a different shade of the desired color.
205 * #a8a8a8 = lightgray
210 #define CO_BACKGROUND "#a8a8a8"
211 #define CO_FOREGROUND "black"
212 #define CO_TEXT_BACKGROUND "#7e7e7e"
213 #define CO_HIGHLIGHT "#ef506f"
214 #define CO_SELECTCOLOR "#ef506f"
216 #define CO_LOGO_BACKGROUND "#ef506f"
217 #define CO_LOGO_TOPSHPIXMAP "25_foreground"
218 #define CO_DROP_BACKGROUND "#7e7e7e"
219 #define CO_DROP_FOREGROUND "#7e7e7e"
220 #define CO_DROP_BACKPIXMAP "background"
224 * macros to use when differentiating on resolution...
227 #define HIRES (dpyinfo.width > 1200) /* SUN MED_RES = 1182 */
228 #define MEDRES (dpyinfo.width > 800 && dpyinfo.width <= 1200)
229 #define LOWRES (dpyinfo.width <= 800)
233 * macro to determine authentication mechanism name...
236 #define vg_IsVerifyName(n) \
237 ((strcmp(getenv(VERIFYNAME),(n)) == 0 ) ? TRUE : FALSE)
239 /****************************************************************************
241 * Structure definitions
243 ****************************************************************************/
245 typedef enum widgetType { CascadeBG, DrawingA, Frame, Form, MessageBox,
246 Label, LabelG, PushB, PushBG, SeparatorG,
247 ToggleB, ToggleBG, Text }
251 typedef enum dialogType { error, help, copyright, hostname, expassword,
257 Boolean workspaceCursor;/* whether to define a root window cursor */
258 XmFontList labelFont; /* font for labels and buttons */
259 XmFontList textFont; /* font for dialog text */
260 XmFontList chlistFont; /* font for chooser list and heading */
261 int optionsDelay; /* seconds to delay before building menu */
262 int altDts; /* number of alternate desktops */
263 char *languageList; /* list of languages to display in menu */
264 int unitType; /* widgets' unit type */
265 char *languageListCmd; /* command to produce language list */
266 #if defined(USE_XINERAMA)
267 int xineramaPreferredScreen; /* preferred screen for xinerama */
269 } AppInfo, *AppInfoPtr;
273 typedef struct displayInfo {
274 Display *dpy; /* initialized with XtDisplay() */
275 char *name; /* ASCII name of the display being used */
276 int screen; /* initialized with DefaultScreen() */
277 Window root; /* initialized with RootWindow() */
278 int depth; /* initialized with DefaultDepth() */
279 int width; /* initialized with DisplayWidth() */
280 int height; /* initialized with DisplayHeight() */
281 Pixel black_pixel; /* initialized with BlackPixel() */
282 Visual *visual; /* initialized with DefaultVisual() */
283 #ifdef USE_XINERAMA /* initialized with _DtXineramaInit() */
284 DtXineramaInfoPtr_t DtXineramaInfo;
292 char *bitmapFile; /* bitmap file (if any) */
293 } LogoInfo, *LogoInfoPtr;
296 int bEcho; /* True=echoOn, False=echoOff */
297 Widget text[2]; /* [0] is echoOff, [1] is echoOn */
298 String onGreeting; /* echoOn greeting */
299 char *offGreetingFormat; /* printf format for echoOff greeting */
300 char *offGreetingUname; /* insert for echoOff greeting */
301 char noechobuf[MAXPATHLEN+1]; /* alternate buffer for echoOff */
302 } LoginText, *LoginTextPtr;
305 /****************************************************************************
307 * External variable declarations
309 ****************************************************************************/
311 extern Arg argt[]; /* used for resources */
312 extern DisplayInfo dpyinfo; /* information about the display */
313 extern char *errorLogFile; /* name of error log file (if any) */
314 extern char *langenv; /* current value of LANG environment var. */
315 extern XmString xmstr; /* used for compound strings */
316 extern int showVerifyError;/* display a Verify() error dialog */
318 extern AppInfo appInfo; /* application resources */
320 extern Widget toplevel; /* top level shell widget */
321 extern Widget login_shell; /* shell for the main login widgets. */
322 extern Widget table; /* black background for everything */
323 extern Widget matte; /* main level form widget */
324 extern Widget matteFrame; /* main level form widget */
325 extern Widget matte1; /* main level form widget */
327 extern Widget greeting; /* Welcome message */
328 extern Widget dt_label; /* Desktop label set in options menu */
330 extern Widget logo1; /* frame around the Corporate logo */
331 extern Widget logo_pixmap; /* Corporate logo */
332 extern Widget logo_shadow; /* drop shadow under the Corporate logo */
334 extern Widget login_matte; /* bulletin board for login/password */
335 extern Widget login_form; /* form containing the login extern Widgets */
336 extern Widget login_label; /* label to left of login text widget */
337 extern Widget login_text; /* login text widget */
338 extern Widget passwd_form; /* form containing the password widgets */
339 extern Widget passwd_label; /* label to left of password text widget */
340 extern Widget passwd_text; /* password text widget */
342 extern Widget ok_button; /* accept name/password text button */
343 extern Widget clear_button; /* clear name/password text button */
344 extern Widget options_button; /* login options button */
345 extern Widget help_button; /* help button */
347 extern Widget copyright_msg; /* copyright notice widget */
348 extern Widget help_message; /* the help message box */
349 extern Widget error_message; /* the error message box */
350 extern Widget hostname_message; /* the invalid hostname message box */
351 extern Widget passwd_message; /* the password expired message box */
353 extern Widget options_menu; /* pop-up menu on options button */
354 extern Widget options_item[]; /* items on options pop_up menu */
355 extern Widget options_failsafe; /* failsafe pane on options pop_up menu */
356 extern Widget options_dtlite; /* dtlite pane on options pop_up menu */
357 extern Widget options_dt; /* dt pane on options pop_up menu */
358 extern Widget *alt_dts; /* alt_dts widgets on options pop_up menu */
359 extern Widget options_last_dt; /* toggle button for user's last dt */
360 extern Widget options_sp_dt; /* toggle for user's special dt */
363 extern Widget lang_menu; /* cascading menu on "Language" option */
364 extern LogoInfo logoInfo; /* logo resources */
366 /****************************************************************************
370 ****************************************************************************/
371 #define vg_TRACE_EXECUTION(str) \
372 LogError((unsigned char *)"VG_TRACE: %s\n", str)
375 /****************************************************************************
377 * External procedure declarations
379 ****************************************************************************/
381 extern void ChangeBell( char *string) ;
382 extern void CleanupAndExit( Widget w, int exit_code) ;
383 extern void ClearCB( Widget w, XtPointer client_data, XtPointer call_data) ;
384 extern void CloseCatalog();
385 extern void CopyrightCB( Widget w, XtPointer client_data, XtPointer call_data) ;
386 extern void EditPasswdCB( Widget w, XtPointer client, XtPointer call_data) ;
387 extern void FakeFocusIn( Widget focus_widget, XtPointer client_data,
389 Boolean *continue_to_dispatch) ;
390 extern int FromMM( int mm ) ;
391 extern int FromPixel( Widget w, int orientation, int pixel) ;
392 extern void GetBiggest( Widget widget, Dimension *width, Dimension *height) ;
393 extern LoginTextPtr GetLoginTextPtr( Widget w );
394 extern int InitArg( WidgetType wtype) ;
395 extern void LangItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
396 extern void LayoutCB( Widget w, XtPointer client_data, XtPointer call_data) ;
397 extern void LogError( unsigned char *fmt, ... );
398 extern void MakeDialog( DialogType dtype) ;
399 extern void MakeLangMenu( void ) ;
400 extern void MakeLogo( void ) ;
401 extern void MakeOptionsMenu( void ) ;
402 extern void MenuItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
403 extern void OpenCatalog();
404 extern void OptionsUnmapCB( Widget wd, XtPointer client_data, XtPointer call_data) ;
405 extern void PingServerCB( XtPointer call_data, XtIntervalId *id) ;
406 extern void PostMenuCB( Widget w, XtPointer client_data, XtPointer call_data);
407 extern unsigned char * ReadCatalog( int set_num, int msg_num, char *def_str) ;
408 extern XmString ReadCatalogXms( int set_num, int msg_num, char *def_str) ;
409 extern void RefreshEH( Widget w, XtPointer client_data, XEvent *event,
410 Boolean *continue_to_dispatch) ;
411 extern void RequestCB( XtPointer client_data, int *source, XtInputId *id);
412 extern void RespondExitCB( Widget w, XtPointer client, XtPointer call);
413 extern void RespondLangCB( Widget w, XtPointer client, XtPointer call);
414 extern void RespondChallengeCB(Widget w, XtPointer client, XtPointer call);
415 extern void RespondClearCB(Widget w, XtPointer client, XtPointer call);
416 extern void RespondDialogCB(Widget w, XtPointer client, XtPointer call_data);
417 extern int SecureDisplay( void ) ;
418 extern void SetResourceDatabase( void ) ;
419 extern void ShowDialogCB( Widget w, XtPointer dialog, XtPointer call_data) ;
420 extern void TextFocusCB( Widget w, XtPointer client_data, XtPointer call_data) ;
421 extern int ToPixel( Widget w, int orientation, int pixel) ;
422 extern void UnsecureDisplay( void ) ;
423 extern void SetDtLabelAndIcon( void );
424 extern void SetDefaultDt( Widget w );
426 extern int Verify( char *name, char *passwd) ;