vg.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  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)
  10. * any later version.
  11. *
  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
  16. * details.
  17. *
  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
  22. */
  23. /* $TOG: vg.h /main/10 1998/09/14 18:30:15 mgreess $ */
  24. /* *
  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. *
  29. */
  30. /************************************<+>*************************************
  31. ****************************************************************************
  32. **
  33. ** File: vg.h
  34. **
  35. ** Project: HP Visual User Environment (DT)
  36. **
  37. ** Description: Main header file for Dtgreet application.
  38. **
  39. ** Defines, structure definitions, and external declarations
  40. ** are specified here.
  41. **
  42. **
  43. ** (c) Copyright 1987, 1988, 1989 by Hewlett-Packard Company
  44. **
  45. **
  46. **
  47. ****************************************************************************
  48. ************************************<+>*************************************/
  49. #ifndef _VG_H
  50. #define _VG_H
  51. #include <X11/Xosdefs.h>
  52. #include <errno.h>
  53. #ifdef X_NOT_STDC_ENV
  54. extern int errno;
  55. #endif
  56. #include <sys/errno.h>
  57. #include <sys/param.h>
  58. #include <stdlib.h>
  59. #include <Xm/Xm.h>
  60. #include "vgproto.h"
  61. #ifdef BLS
  62. # include <sys/security.h>
  63. #endif
  64. #ifdef USE_XINERAMA
  65. # include <DtXinerama.h>
  66. #endif
  67. #ifdef SIGNALRETURNSINT
  68. #define SIGVAL int
  69. #else
  70. #define SIGVAL void
  71. #endif
  72. /****************************************************************************
  73. *
  74. * Defines
  75. *
  76. ****************************************************************************/
  77. /*
  78. * SAIC DT copyright is in a dt directory
  79. */
  80. #if defined( _SUN_OS )
  81. # define COPYRIGHT "/usr/lib/X11/dt/etc/copyright"
  82. #else
  83. # define COPYRIGHT "/etc/copyright"
  84. #endif
  85. #define NO_LOGIN_FILE "/etc/nologin"
  86. #define DTLITESESSION "/usr/dt/bin/dtlitesession"
  87. #define LOGIN_STR_LEN 1024
  88. /*
  89. * option menu items...
  90. */
  91. #define OB_RESTART_SERVER 1
  92. #define OB_NO_WINDOWS 2
  93. #define OB_COPYRIGHT 3
  94. #define OB_FAILSAFE 4
  95. #define OB_LANGUAGE 5
  96. #define OB_DTLITE 6
  97. #define OB_DT 7
  98. #define OB_ALT_DTS 8
  99. #define OB_LAST_DT 10
  100. #ifndef LAST_SESSION_FILE
  101. #define LAST_SESSION_FILE "/.dt/sessions/lastsession"
  102. #endif
  103. #ifndef DEF_SESSION
  104. #define DEF_SESSION CDE_INSTALLATION_TOP "/bin/Xsession"
  105. #endif
  106. /*
  107. * default resources... (Dimensions are in units of 100TH_MILLIMETER)
  108. *
  109. * - width/height of main matte
  110. * - percentage offsets of login matte within main matte
  111. * - shadow thickness
  112. * - margin height for message box buttons
  113. * - fonts
  114. * - colors
  115. */
  116. #ifndef XmNPIXELS
  117. #define XmNPIXELS "PIXELS"
  118. #endif
  119. #ifndef XmN100TH_MILLIMETERS
  120. #define XmN100TH_MILLIMETERS "100TH_MILLIMETERS"
  121. #endif
  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"
  128. #define MATTE_WIDTH 18500
  129. #define MATTE_HEIGHT 6746
  130. #define HRES_MATTE_WIDTH "835" /* pixels */
  131. #define HRES_MATTE_HEIGHT "425" /* pixels */
  132. #define MRES_MATTE_WIDTH "775" /* pixels */
  133. #define MRES_MATTE_HEIGHT "400" /* pixels */
  134. #define LRES_MATTE_WIDTH "585" /* pixels */
  135. #define LRES_MATTE_HEIGHT "300" /* pixels */
  136. #define LOGIN_TOP_POSITION "31" /* percent */
  137. #define LOGIN_BOTTOM_POSITION "79" /* percent */
  138. #define LOGIN_LEFT_POSITION "12" /* percent */
  139. #define LOGIN_RIGHT_POSITION "88" /* percent */
  140. #define SHADOW_THICKNESS FromMM(100) /* general border size */
  141. #define ETCH_THICKNESS FromMM(150) /* login etch thickness */
  142. #define MBOX_MARGIN_WIDTH FromMM(300)
  143. #define MBOX_MARGIN_HEIGHT FromMM(300)
  144. #define DROP_SHADOW_THICKNESS FromMM(400) /* logo drop shadow size */
  145. /*#define MIN_BUTTON_SIZE FromMM(3600) minimum button size */
  146. #define MIN_BUTTON_SIZE FromMM(3100) /* minimum button size */
  147. #define TEXT_MARGIN_WIDTH FromMM(200) /* text wgt margin width */
  148. #define TEXT_MARGIN_HEIGHT FromMM(100) /* text wgt margin height */
  149. # define LABEL_FONT "-*-swiss 742-bold-r-normal-*-140-*-p-100-*"
  150. # define LABEL_FONT_HRES "-*-swiss 742-medium-r-normal-*-140-*-p-110-*"
  151. # define TEXT_FONT "-*-prestige-medium-r-normal-*-128-72-*"
  152. # define TEXT_FONT_LRES "-*-helvetica-bold-r-normal-*-100-*"
  153. # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*"
  154. #if 0
  155. # define GREET_FONT "-*-*schoolbook-medium-i-normal--18-*-*-*-*-*-ISO8859-1"
  156. #endif
  157. #define TABLE_BACKGROUND "black"
  158. #define TEXT_FOREGROUND "white"
  159. #define BW_BACKGROUND "white"
  160. #define BW_FOREGROUND "black"
  161. #define BW_TEXT_BACKGROUND "black"
  162. #define BW_LOGO_BACKGROUND "#a8a8a8"
  163. #define BW_LOGO_TOPSHPIXMAP "25_foreground"
  164. #define BW_DROP_BACKGROUND "black"
  165. #define BW_DROP_FOREGROUND "white"
  166. #define BW_DROP_BACKPIXMAP "25_foreground"
  167. /*
  168. * define colors by rgb value rather than name. On other systems the name
  169. * may map to a different shade of the desired color.
  170. *
  171. * on hp-ux...
  172. *
  173. * #a8a8a8 = lightgray
  174. * #7e7e7e = gray
  175. * #ef506f = burgundy
  176. *
  177. */
  178. #define CO_BACKGROUND "#a8a8a8"
  179. #define CO_FOREGROUND "black"
  180. #define CO_TEXT_BACKGROUND "#7e7e7e"
  181. #define CO_HIGHLIGHT "#ef506f"
  182. #define CO_SELECTCOLOR "#ef506f"
  183. #define CO_LOGO_BACKGROUND "#ef506f"
  184. #define CO_LOGO_TOPSHPIXMAP "25_foreground"
  185. #define CO_DROP_BACKGROUND "#7e7e7e"
  186. #define CO_DROP_FOREGROUND "#7e7e7e"
  187. #define CO_DROP_BACKPIXMAP "background"
  188. /*
  189. * macros to use when differentiating on resolution...
  190. */
  191. #define HIRES (dpyinfo.width > 1200) /* SUN MED_RES = 1182 */
  192. #define MEDRES (dpyinfo.width > 800 && dpyinfo.width <= 1200)
  193. #define LOWRES (dpyinfo.width <= 800)
  194. /*
  195. * macro to determine authentication mechanism name...
  196. */
  197. #define vg_IsVerifyName(n) \
  198. ((strcmp(getenv(VERIFYNAME),(n)) == 0 ) ? TRUE : FALSE)
  199. /****************************************************************************
  200. *
  201. * Structure definitions
  202. *
  203. ****************************************************************************/
  204. typedef enum widgetType { CascadeBG, DrawingA, Frame, Form, MessageBox,
  205. Label, LabelG, PushB, PushBG, SeparatorG,
  206. ToggleB, ToggleBG, Text }
  207. WidgetType;
  208. typedef enum dialogType { error, help, copyright, hostname, expassword,
  209. help_chooser }
  210. DialogType;
  211. typedef struct {
  212. Boolean workspaceCursor;/* whether to define a root window cursor */
  213. XmFontList labelFont; /* font for labels and buttons */
  214. XmFontList textFont; /* font for dialog text */
  215. XmFontList chlistFont; /* font for chooser list and heading */
  216. int optionsDelay; /* seconds to delay before building menu */
  217. int altDts; /* number of alternate desktops */
  218. char *languageList; /* list of languages to display in menu */
  219. int unitType; /* widgets' unit type */
  220. char *languageListCmd; /* command to produce language list */
  221. #if defined(USE_XINERAMA)
  222. int xineramaPreferredScreen; /* preferred screen for xinerama */
  223. #endif
  224. } AppInfo, *AppInfoPtr;
  225. typedef struct displayInfo {
  226. Display *dpy; /* initialized with XtDisplay() */
  227. char *name; /* ASCII name of the display being used */
  228. int screen; /* initialized with DefaultScreen() */
  229. Window root; /* initialized with RootWindow() */
  230. int depth; /* initialized with DefaultDepth() */
  231. int width; /* initialized with DisplayWidth() */
  232. int height; /* initialized with DisplayHeight() */
  233. Pixel black_pixel; /* initialized with BlackPixel() */
  234. Visual *visual; /* initialized with DefaultVisual() */
  235. #ifdef USE_XINERAMA /* initialized with _DtXineramaInit() */
  236. DtXineramaInfoPtr_t DtXineramaInfo;
  237. #endif
  238. } DisplayInfo;
  239. typedef struct {
  240. char *bitmapFile; /* bitmap file (if any) */
  241. } LogoInfo, *LogoInfoPtr;
  242. typedef struct {
  243. int bEcho; /* True=echoOn, False=echoOff */
  244. Widget text[2]; /* [0] is echoOff, [1] is echoOn */
  245. String onGreeting; /* echoOn greeting */
  246. char *offGreetingFormat; /* printf format for echoOff greeting */
  247. char *offGreetingUname; /* insert for echoOff greeting */
  248. char noechobuf[MAXPATHLEN+1]; /* alternate buffer for echoOff */
  249. } LoginText, *LoginTextPtr;
  250. /****************************************************************************
  251. *
  252. * External variable declarations
  253. *
  254. ****************************************************************************/
  255. extern Arg argt[]; /* used for resources */
  256. extern DisplayInfo dpyinfo; /* information about the display */
  257. extern char *errorLogFile; /* name of error log file (if any) */
  258. extern char *langenv; /* current value of LANG environment var. */
  259. extern XmString xmstr; /* used for compound strings */
  260. extern int showVerifyError;/* display a Verify() error dialog */
  261. extern AppInfo appInfo; /* application resources */
  262. extern Widget toplevel; /* top level shell widget */
  263. extern Widget login_shell; /* shell for the main login widgets. */
  264. extern Widget table; /* black background for everything */
  265. extern Widget matte; /* main level form widget */
  266. extern Widget matteFrame; /* main level form widget */
  267. extern Widget matte1; /* main level form widget */
  268. extern Widget greeting; /* Welcome message */
  269. extern Widget dt_label; /* Desktop label set in options menu */
  270. extern Widget logo1; /* frame around the Corporate logo */
  271. extern Widget logo_pixmap; /* Corporate logo */
  272. extern Widget logo_shadow; /* drop shadow under the Corporate logo */
  273. extern Widget login_matte; /* bulletin board for login/password */
  274. extern Widget login_form; /* form containing the login extern Widgets */
  275. extern Widget login_label; /* label to left of login text widget */
  276. extern Widget login_text; /* login text widget */
  277. extern Widget passwd_form; /* form containing the password widgets */
  278. extern Widget passwd_label; /* label to left of password text widget */
  279. extern Widget passwd_text; /* password text widget */
  280. extern Widget ok_button; /* accept name/password text button */
  281. extern Widget clear_button; /* clear name/password text button */
  282. extern Widget options_button; /* login options button */
  283. extern Widget help_button; /* help button */
  284. extern Widget copyright_msg; /* copyright notice widget */
  285. extern Widget help_message; /* the help message box */
  286. extern Widget error_message; /* the error message box */
  287. extern Widget hostname_message; /* the invalid hostname message box */
  288. extern Widget passwd_message; /* the password expired message box */
  289. extern Widget options_menu; /* pop-up menu on options button */
  290. extern Widget options_item[]; /* items on options pop_up menu */
  291. extern Widget options_failsafe; /* failsafe pane on options pop_up menu */
  292. extern Widget options_dtlite; /* dtlite pane on options pop_up menu */
  293. extern Widget options_dt; /* dt pane on options pop_up menu */
  294. extern Widget *alt_dts; /* alt_dts widgets on options pop_up menu */
  295. extern Widget options_last_dt; /* toggle button for user's last dt */
  296. extern Widget options_sp_dt; /* toggle for user's special dt */
  297. extern Widget lang_menu; /* cascading menu on "Language" option */
  298. extern LogoInfo logoInfo; /* logo resources */
  299. /****************************************************************************
  300. *
  301. * Macro definitions
  302. *
  303. ****************************************************************************/
  304. #define vg_TRACE_EXECUTION(str) \
  305. LogError((unsigned char *)"VG_TRACE: %s\n", str)
  306. /****************************************************************************
  307. *
  308. * External procedure declarations
  309. *
  310. ****************************************************************************/
  311. extern void ChangeBell( char *string) ;
  312. extern void CleanupAndExit( Widget w, int exit_code) ;
  313. extern void ClearCB( Widget w, XtPointer client_data, XtPointer call_data) ;
  314. extern void CloseCatalog();
  315. extern void CopyrightCB( Widget w, XtPointer client_data, XtPointer call_data) ;
  316. extern void EditPasswdCB( Widget w, XtPointer client, XtPointer call_data) ;
  317. extern void FakeFocusIn( Widget focus_widget, XtPointer client_data,
  318. XEvent *eventprm,
  319. Boolean *continue_to_dispatch) ;
  320. extern int FromMM( int mm ) ;
  321. extern int FromPixel( Widget w, int orientation, int pixel) ;
  322. extern void GetBiggest( Widget widget, Dimension *width, Dimension *height) ;
  323. extern LoginTextPtr GetLoginTextPtr( Widget w );
  324. extern int InitArg( WidgetType wtype) ;
  325. extern void LangItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
  326. extern void LayoutCB( Widget w, XtPointer client_data, XtPointer call_data) ;
  327. extern void LogError( unsigned char *fmt, ... );
  328. extern void MakeDialog( DialogType dtype) ;
  329. extern void MakeLangMenu( void ) ;
  330. extern void MakeLogo( void ) ;
  331. extern void MakeOptionsMenu( void ) ;
  332. extern void MenuItemCB( Widget w, XtPointer client_data, XtPointer call_data) ;
  333. extern void OpenCatalog();
  334. extern void OptionsUnmapCB( Widget wd, XtPointer client_data, XtPointer call_data) ;
  335. extern void PingServerCB( XtPointer call_data, XtIntervalId *id) ;
  336. extern void PostMenuCB( Widget w, XtPointer client_data, XtPointer call_data);
  337. extern unsigned char * ReadCatalog( int set_num, int msg_num, char *def_str) ;
  338. extern XmString ReadCatalogXms( int set_num, int msg_num, char *def_str) ;
  339. extern void RefreshEH( Widget w, XtPointer client_data, XEvent *event,
  340. Boolean *continue_to_dispatch) ;
  341. extern void RequestCB( XtPointer client_data, int *source, XtInputId *id);
  342. extern void RespondExitCB( Widget w, XtPointer client, XtPointer call);
  343. extern void RespondLangCB( Widget w, XtPointer client, XtPointer call);
  344. extern void RespondChallengeCB(Widget w, XtPointer client, XtPointer call);
  345. extern void RespondClearCB(Widget w, XtPointer client, XtPointer call);
  346. extern void RespondDialogCB(Widget w, XtPointer client, XtPointer call_data);
  347. extern int SecureDisplay( void ) ;
  348. extern void SetResourceDatabase( void ) ;
  349. extern void ShowDialogCB( Widget w, XtPointer dialog, XtPointer call_data) ;
  350. extern void TextFocusCB( Widget w, XtPointer client_data, XtPointer call_data) ;
  351. extern int ToPixel( Widget w, int orientation, int pixel) ;
  352. extern void UnsecureDisplay( void ) ;
  353. extern void SetDtLabelAndIcon( void );
  354. extern void SetDefaultDt( Widget w );
  355. #ifndef _DM_H
  356. extern int Verify( char *name, char *passwd) ;
  357. #endif
  358. #endif /* _VG_H */