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: SmUI.c /main/32 1998/07/23 18:08:17 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. *
31 /*************************************<+>*************************************
32 *****************************************************************************
36 ** Project: DT Session Manager (dtsession)
40 ** This file handles all UI components of the session manager. This
41 ** includes all dialog boxes. The session manager does not handle its
42 ** representations in the front panel and customizer. That is handled
47 *******************************************************************
48 ** (c) Copyright Hewlett-Packard Company, 1990. All rights are
49 ** reserved. Copying or other reproduction of this program
50 ** except for archival purposes is prohibited without prior
51 ** written consent of Hewlett-Packard Company.
52 ********************************************************************
56 *****************************************************************************
57 *************************************<+>*************************************/
61 #include <sys/param.h>
62 #include <X11/Intrinsic.h>
63 #include <Xm/MwmUtil.h>
68 #include <Xm/LabelG.h>
69 #include <Xm/DrawingA.h>
71 #include <Xm/Separator.h>
72 #include <Xm/MessageB.h>
73 #include <Xm/DialogS.h>
76 #include <Dt/SessionM.h>
78 #include <Dt/MsgLog.h>
84 #include "SmGlobals.h"
93 ConfirmState confirmState;
98 #define PASSWORD_INDICATOR " "
100 typedef struct _ExitRecord {
103 Widget exitCancelledDialog;
104 int queryExitConfirmedMode;
116 * Local Function Declarations
119 static int CompatModeExit( void ) ;
120 static void ExitConfirmed( Widget, XtPointer, XtPointer ) ;
121 static void ExitCancelled( Widget, XtPointer, XtPointer ) ;
122 static void LockDialogUp( Widget, XtPointer, XtPointer ) ;
123 static void SimpleOK( Widget, XtPointer, XtPointer ) ;
124 static void ConfirmOKCB ( Widget, XtPointer, XtPointer ) ;
125 static void ConfirmCancelCB ( Widget, XtPointer, XtPointer ) ;
126 static void ConfirmHelpCB ( Widget, XtPointer, XtPointer ) ;
127 static void XSMPFailureOKCB( Widget w, XtPointer client_data, XtPointer call_data );
128 static void SaveTimeout( XtPointer , XtIntervalId *) ;
134 static Boolean session_confirmed = False;
135 static Boolean reasonsDialogOK;
136 static Boolean saveTimeout;
140 /*************************************<->*************************************
142 * CreateLockDialog ()
147 * Create the lock dialog when it exists NOT as a part of a cover
162 *************************************<->***********************************/
164 CreateLockDialog( void )
167 Widget loginLabel, instructLabel, tmpLock, indFrame;
168 Widget passwdLabel, passwdForm, picFrame, loginPic, loginFrame;
169 Dimension width; /* width, height of login label */
170 XmString lockString, passwordString;
173 Pixel fg, bg, focus_color; /* foreground, background colors */
176 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
177 XtSetArg(uiArgs[i], XmNmarginWidth, 0); i++;
178 XtSetArg(uiArgs[i], XmNmarginHeight, 0); i++;
179 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
180 XtSetArg(uiArgs[i], XmNshadowThickness,5); i++;
181 XtSetArg(uiArgs[i], XmNunitType, XmPIXELS); i++;
182 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
183 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
184 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
185 XtSetArg(uiArgs[i], XmNmappedWhenManaged, True); i++;
186 tmpLock = XmCreateFormDialog(smGD.topLevelWid, "lockDialog", uiArgs, i);
187 XtAddCallback (XtParent(tmpLock), XmNpopupCallback,
189 smDD.matte[0] = tmpLock;
192 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
193 XtSetArg(uiArgs[i], XmNmwmDecorations, 0);i++;
194 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
195 XtSetValues(XtParent(tmpLock), uiArgs, i);
198 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
199 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
200 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
201 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
202 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
203 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
204 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
205 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
206 picFrame = XmCreateFrame(tmpLock, "picFrame", uiArgs, i);
209 XtSetArg(uiArgs[i], XmNforeground, &fg); i++;
210 XtSetArg(uiArgs[i], XmNbackground, &bg); i++;
211 XtGetValues(tmpLock, uiArgs, i);
214 XtSetArg(uiArgs[i], XmNfillMode, XmFILL_SELF); i++;
215 XtSetArg(uiArgs[i], XmNbehavior, XmICON_LABEL); i++;
216 XtSetArg(uiArgs[i], XmNpixmapForeground, fg); i++;
217 XtSetArg(uiArgs[i], XmNpixmapBackground, bg); i++;
218 XtSetArg(uiArgs[i], XmNstring, NULL); i++;
219 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
220 XtSetArg(uiArgs[i], XmNtraversalOn, False); i++;
221 loginPic = _DtCreateIcon(picFrame, "lockLabelPixmap", uiArgs, i);
224 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
225 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
226 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
227 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
228 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
229 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
230 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
231 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
232 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
233 XtSetArg(uiArgs[i], XmNrightOffset, 0); i++;
234 XtSetArg(uiArgs[i], XmNrightWidget, loginPic); i++;
235 loginFrame = XmCreateFrame(tmpLock, "loginFrame", uiArgs, i);
239 * create the login matte...
242 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
243 smDD.loginMatte[0] = XmCreateForm(loginFrame, "loginMatte", uiArgs, i);
246 * create the login/password forms
249 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
250 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
251 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
252 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
253 XtSetArg(uiArgs[i], XmNbottomPosition, 50); i++;
254 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
255 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
256 smDD.loginForm[0] = XmCreateForm(smDD.loginMatte[0], "loginForm", uiArgs, i);
259 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
260 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
261 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
262 XtSetArg(uiArgs[i], XmNtopPosition, 50); i++;
263 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
264 XtSetArg(uiArgs[i], XmNleftWidget, smDD.loginForm[0]); i++;
265 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
266 XtSetArg(uiArgs[i], XmNrightWidget, smDD.loginForm[0]); i++;
267 passwdForm = XmCreateForm(smDD.loginMatte[0], "passwdForm", uiArgs, i);
271 * create the login/password labels...
274 envLog = getenv("LOGNAME");
275 lockMessage = XtMalloc(100 + strlen(envLog));
278 (char*) GETMESSAGE(18, 1, "Display locked by user %s."), envLog);
279 lockString = XmStringCreateLocalized(lockMessage);
280 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
281 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
282 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
283 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
284 loginLabel = XmCreateLabelGadget(smDD.loginForm[0],
285 "loginLabel", uiArgs, i);
286 XtManageChild(loginLabel);
287 XmStringFree(lockString);
291 lockString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 2, "Enter password to unlock.")));
292 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
293 XtSetArg(uiArgs[i], XmNtopWidget, loginLabel); i++;
294 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
295 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
296 instructLabel = XmCreateLabelGadget(smDD.loginForm[0], "instructLabel",
298 XtManageChild(instructLabel);
299 XmStringFree(lockString);
302 passwordString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 3, "Password: ")));
303 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
304 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
305 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
306 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
307 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
308 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
309 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
310 passwdLabel = XmCreateLabelGadget(passwdForm,
311 "passwdLabel", uiArgs, i);
312 XtManageChild(passwdLabel);
313 XmStringFree(passwordString);
316 * Give the password label an offset
319 XtSetArg(uiArgs[i], XmNwidth, &width);i++;
320 XtGetValues(passwdLabel, uiArgs, i);
324 XtSetArg(uiArgs[i], XmNwidth, width);i++;
325 XtSetArg(uiArgs[i], XmNrecomputeSize, False);i++;
326 XtSetValues(passwdLabel, uiArgs, i);
330 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_IN); i++;
331 XtSetArg(uiArgs[i], XmNshadowThickness, 1); i++;
332 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
333 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
334 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
335 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
336 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
337 XtSetArg(uiArgs[i], XmNleftWidget, passwdLabel); i++;
338 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
339 XtSetArg(uiArgs[i], XmNrightOffset, 10); i++;
340 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
341 indFrame = XmCreateFrame(passwdForm, "indFrame", uiArgs, i);
344 passwordString = XmStringCreateLocalized("|");
345 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
346 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_BEGINNING); i++;
347 smDD.indLabel[0] = XmCreateLabel(indFrame, "indLabel",
349 XtManageChild(smDD.indLabel[0]);
350 XmStringFree(passwordString);
353 XtSetArg(uiArgs[i], XmNhighlightColor, &focus_color); i++;
354 XtGetValues(indFrame, uiArgs, i);
355 XtVaSetValues ( smDD.indLabel[0],
357 XmNborderColor, focus_color,
361 * Manage forms AFTER all children have been managed
363 XtManageChild(indFrame);
364 XtManageChild(passwdForm);
365 XtManageChild(smDD.loginForm[0]);
366 XtManageChild(smDD.loginMatte[0]);
367 XtManageChild(loginPic);
368 XtManageChild(picFrame);
369 XtManageChild(loginFrame);
376 /*************************************<->*************************************
383 * Determines which exit routines get called when an exit request is made
384 * of the session manager.
385 * If smGD.bmsDead == false, we just exit.
386 * If ASK_STATE is turned on, the query dialog is
387 * put up, if VERBOSE is on, confirm exit in current mode (restart or reset)
388 * if confirmation is turned off - exit immediately.
393 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
404 *************************************<->***********************************/
409 if (smGD.bmsDead == True)
411 ImmediateExit(-1, msg, True);
413 if(smGD.compatMode == True)
416 tt_message_reply( msg );
417 tt_message_destroy( msg );
423 if(smSettings.confirmMode == DtSM_VERBOSE_MODE ||
424 smSettings.startState == DtSM_ASK_STATE)
426 ConfirmExit( msg, True );
430 ImmediateExit(smSettings.startState, msg, True);
437 /*************************************<->*************************************
444 * Create the exit confirmation dialog box (if it hasn't been) and confirm
445 * that the user wants to exit the session. This routine only gets called
446 * when the user hasn't turned of exit confirmation and is not in ASK mode
451 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
462 *************************************<->***********************************/
472 static XmString homeToHome; /* started Home, restore to Home */
473 static XmString returnToCurrent; /* started Home or Current but
475 static XmString currentToHome; /* started Current, return to Home */
477 if(smDD.confExit == NULL)
480 * Create all compound strings for confirmation dialogs
482 returnToCurrent = XmStringCreateLocalized(((char *)GETMESSAGE(18, 4,
483 "Exiting the desktop session...\n\n\
484 Your Current session will be restored upon login.\n\n\
485 Application updates you have not saved will be lost.\n\n\
486 Continue Logout?")));
488 homeToHome = XmStringCreateLocalized(((char *)GETMESSAGE(18, 5,
489 "Exiting the desktop session...\n\n\
490 Your Home session will be restored upon login.\n\
491 Your Current session will not be saved.\n\n\
492 Application updates you have not saved will be lost.\n\n\
493 Continue Logout?")));
495 currentToHome = XmStringCreateLocalized(((char *)GETMESSAGE(18, 75,
496 "Exiting the desktop session...\n\n\
497 Your Current session will be saved but your Home\n\
498 session will be restored upon login.\n\n\
499 Application updates you have not saved will be lost.\n\n\
500 Continue Logout?")));
503 * Build up the correct string for this dialog
506 if (smGD.sessionType == HOME_SESSION &&
507 smSettings.startState == DtSM_HOME_STATE)
509 XtSetArg(uiArgs[i], XmNmessageString, homeToHome); i++;
511 else if (smGD.sessionType == CURRENT_SESSION &&
512 smSettings.startState == DtSM_HOME_STATE)
514 XtSetArg(uiArgs[i], XmNmessageString, currentToHome); i++;
518 XtSetArg(uiArgs[i], XmNmessageString, returnToCurrent); i++;
522 * Now create the dialog box
524 tmpString = GETMESSAGE(18, 6, "Logout Confirmation");
525 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
526 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
527 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_CENTER); i++;
528 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
529 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okLogoutString); i++;
530 XtSetArg(uiArgs[i], XmNcancelLabelString, smDD.cancelLogoutString); i++;
531 XtSetArg(uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
532 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
534 pmsg = (Tt_message *)XtMalloc(sizeof(Tt_message));
535 XtSetArg(uiArgs[i], XmNuserData, pmsg); i++;
537 smDD.confExit = XmCreateWarningDialog(smGD.topLevelWid, "exitDialog",
541 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
542 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
543 XtSetArg(uiArgs[i], XmNmwmDecorations,
544 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
545 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
546 XtSetValues(XtParent(smDD.confExit), uiArgs, i);
548 exitRec = (ExitRecord *)XtMalloc( sizeof(ExitRecord) );
549 exitRec->pmsg = pmsg;
550 exitRec->doSave = doSave;
551 XtAddCallback (smDD.confExit, XmNokCallback, ExitConfirmed, exitRec);
553 XtAddCallback (smDD.confExit, XmNhelpCallback,
554 TopicHelpRequested, HELP_LOGOUT_STR);
556 exitRec = (ExitRecord *)XtMalloc( sizeof(ExitRecord) );
557 exitRec->pmsg = pmsg;
558 exitRec->doSave = doSave;
559 exitRec->u.exitCancelledDialog = smDD.confExit;
560 XtAddCallback (smDD.confExit, XmNcancelCallback,
561 ExitCancelled, exitRec);
566 * The user may have changed the type of session to be
567 * restored so must update the dialog's message.
570 if (smGD.sessionType == HOME_SESSION &&
571 smSettings.startState == DtSM_HOME_STATE)
573 XtSetArg(uiArgs[i], XmNmessageString, homeToHome); i++;
575 else if (smGD.sessionType == CURRENT_SESSION &&
576 smSettings.startState == DtSM_HOME_STATE)
578 XtSetArg(uiArgs[i], XmNmessageString, currentToHome); i++;
582 XtSetArg(uiArgs[i], XmNmessageString, returnToCurrent); i++;
585 XtSetValues(smDD.confExit, uiArgs, i);
589 * Refresh buffer containing pointer to Tt_message.
592 XtSetArg(uiArgs[i], XmNuserData, &pmsg); i++;
593 XtGetValues(smDD.confExit, uiArgs, i);
597 XtAddCallback (XtParent(smDD.confExit), XmNpopupCallback, DialogUp, NULL);
599 XtManageChild(smDD.confExit);
604 /*************************************<->*************************************
611 * Let the user know that the bms has died and that the current session
627 *************************************<->***********************************/
629 WarnMsgFailure( void )
632 XmString bmsDeadString;
635 if(smDD.deadWid == NULL)
637 bmsDeadString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 38,
638 "Messaging System Inoperative\n\n\
639 To restart:\n\n1) Save all open data files.\n\
641 3) Log in again.\n\nNote: The current session will not be saved.\n\n\
642 When you are ready to begin the restart process, click [OK] and\n\
643 proceed to save your files.")));
646 * Now create the dialog box
649 tmpString = GETMESSAGE(18, 12, "Message Failure");
650 XtSetArg(uiArgs[i], XmNmessageString, bmsDeadString);i++;
651 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
652 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
653 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
654 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
655 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
656 XtSetArg(uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
657 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
658 smDD.deadWid = XmCreateWarningDialog(smGD.topLevelWid, "deadDialog",
662 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
663 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
664 XtSetArg(uiArgs[i], XmNmwmDecorations,
665 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
666 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
667 XtSetValues(XtParent(smDD.deadWid), uiArgs, i);
669 XtAddCallback (XtParent(smDD.deadWid),
670 XmNpopupCallback, DialogUp, NULL);
671 XtUnmanageChild(XmMessageBoxGetChild(smDD.deadWid,
672 XmDIALOG_CANCEL_BUTTON));
675 * Now add in the callback and get out of here
677 XtAddCallback (smDD.deadWid, XmNokCallback,
678 SimpleOK, (XtPointer) smDD.deadWid);
680 XtAddCallback (smDD.deadWid, XmNhelpCallback,
681 TopicHelpRequested, HELP_BMS_DEAD_STR);
683 XtAddCallback (smDD.deadWid, XmNcancelCallback,
685 XmStringFree(bmsDeadString);
688 XtManageChild(smDD.deadWid);
693 /*************************************<->*************************************
700 * Let the user know that the logout button can not be used to exit in
701 * compatibility mode.
716 *************************************<->***********************************/
718 CompatModeExit( void )
721 XmString compatModeString;
724 if(smDD.compatExit == NULL)
726 compatModeString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 34,
727 "This session was started from an X Window System startup script.\n\n\
728 No session information will be saved.\n\nUse the reset key sequence to log out.")));
731 * Now create the dialog box
734 tmpString = GETMESSAGE(18, 35, "Logout Message");
735 XtSetArg(uiArgs[i], XmNmessageString, compatModeString);i++;
736 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
737 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
738 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_CENTER); i++;
739 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
740 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
741 XtSetArg(uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
742 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
743 smDD.compatExit = XmCreateInformationDialog(smGD.topLevelWid,
748 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
749 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
750 XtSetArg(uiArgs[i], XmNmwmDecorations,
751 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
752 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
753 XtSetValues(XtParent(smDD.compatExit), uiArgs, i);
755 XtAddCallback (XtParent(smDD.compatExit),
756 XmNpopupCallback, DialogUp, NULL);
757 XtUnmanageChild(XmMessageBoxGetChild(smDD.compatExit,
758 XmDIALOG_CANCEL_BUTTON));
761 * Now add in the callback and get out of here
763 XtAddCallback (smDD.compatExit, XmNokCallback,
764 SimpleOK, smDD.compatExit);
766 XtAddCallback (smDD.compatExit, XmNhelpCallback,
767 TopicHelpRequested, HELP_LOGOUT_COMPAT_MODE_STR);
769 XmStringFree(compatModeString);
772 XtManageChild(smDD.compatExit);
778 /*************************************<->*************************************
780 * CreateLockDialogWithCover()
785 * Create the lock dialog when it exists as a part of a cover
800 *************************************<->***********************************/
802 CreateLockDialogWithCover(
806 Widget loginLabel, instructLabel, tmpLock;
807 Widget indFrame, loginPic, picFrame, loginFrame;
808 Widget passwdLabel, passwdForm;
809 Dimension width; /* width, height of drop shadow */
810 XmString lockString, passwordString;
813 Pixel fg, bg, focus_color; /* foreground, background colors */
816 XtSetArg(uiArgs[i], XmNmarginWidth, 0); i++;
817 XtSetArg(uiArgs[i], XmNmarginHeight, 0); i++;
818 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
819 XtSetArg(uiArgs[i], XmNshadowThickness,5); i++;
820 XtSetArg(uiArgs[i], XmNunitType, XmPIXELS); i++;
821 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
822 XtSetArg(uiArgs[i], XmNmappedWhenManaged, False); i++;
823 tmpLock = XmCreateForm(parent, "lockDialog", uiArgs, i);
824 smDD.matte[1] = tmpLock;
827 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
828 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
829 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
830 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
831 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
832 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
833 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
834 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
835 picFrame = XmCreateFrame(tmpLock, "picFrame", uiArgs, i);
838 XtSetArg(uiArgs[i], XmNforeground, &fg); i++;
839 XtSetArg(uiArgs[i], XmNbackground, &bg); i++;
840 XtGetValues(tmpLock, uiArgs, i);
843 XtSetArg(uiArgs[i], XmNfillMode, XmFILL_SELF); i++;
844 XtSetArg(uiArgs[i], XmNbehavior, XmICON_LABEL); i++;
845 XtSetArg(uiArgs[i], XmNpixmapForeground, fg); i++;
846 XtSetArg(uiArgs[i], XmNpixmapBackground, bg); i++;
847 XtSetArg(uiArgs[i], XmNstring, NULL); i++;
848 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
849 XtSetArg(uiArgs[i], XmNtraversalOn, False); i++;
850 loginPic = _DtCreateIcon(picFrame, "lockLabelPixmap", uiArgs, i);
853 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
854 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
855 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
856 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
857 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
858 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
859 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
860 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
861 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
862 XtSetArg(uiArgs[i], XmNrightWidget, picFrame); i++;
863 XtSetArg(uiArgs[i], XmNrightOffset, 0); i++;
864 loginFrame = XmCreateFrame(tmpLock, "loginFrame", uiArgs, i);
867 * create the login matte...
870 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
871 smDD.loginMatte[1] = XmCreateForm(loginFrame, "loginMatte", uiArgs, i);
874 * create the login/password forms
877 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
878 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
879 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
880 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
881 XtSetArg(uiArgs[i], XmNbottomPosition, 50); i++;
882 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
883 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
884 smDD.loginForm[1] = XmCreateForm(smDD.loginMatte[1], "loginForm", uiArgs, i);
887 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
888 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
889 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
890 XtSetArg(uiArgs[i], XmNtopPosition, 50); i++;
891 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
892 XtSetArg(uiArgs[i], XmNleftWidget, smDD.loginForm[1]); i++;
893 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
894 XtSetArg(uiArgs[i], XmNrightWidget, smDD.loginForm[1]); i++;
895 passwdForm = XmCreateForm(smDD.loginMatte[1], "passwdForm", uiArgs, i);
899 * create the login/password labels...
902 envLog = getenv("LOGNAME");
903 lockMessage = XtMalloc(100 + strlen(envLog));
906 ((char *)GETMESSAGE(18, 1, "Display locked by user %s.")), envLog);
907 lockString = XmStringCreateLocalized(lockMessage);
908 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
909 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
910 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
911 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
912 loginLabel = XmCreateLabelGadget(smDD.loginForm[1],
913 "loginLabel", uiArgs, i);
914 XtManageChild(loginLabel);
915 XmStringFree(lockString);
919 lockString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 2, "Enter password to unlock.")));
920 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
921 XtSetArg(uiArgs[i], XmNtopWidget, loginLabel); i++;
922 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
923 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
924 instructLabel = XmCreateLabelGadget(smDD.loginForm[1], "instructLabel",
926 XtManageChild(instructLabel);
927 XmStringFree(lockString);
930 passwordString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 3, "Password: ")));
931 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
932 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
933 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
934 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
935 XtSetArg(uiArgs[i], XmNleftOffset, 0); i++;
936 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
937 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
938 passwdLabel = XmCreateLabelGadget(passwdForm,
939 "passwdLabel", uiArgs, i);
940 XtManageChild(passwdLabel);
941 XmStringFree(passwordString);
944 * Give the password label an offset
947 XtSetArg(uiArgs[i], XmNwidth, &width);i++;
948 XtGetValues(passwdLabel, uiArgs, i);
952 XtSetArg(uiArgs[i], XmNwidth, width);i++;
953 XtSetArg(uiArgs[i], XmNrecomputeSize, False);i++;
954 XtSetValues(passwdLabel, uiArgs, i);
958 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_IN); i++;
959 XtSetArg(uiArgs[i], XmNshadowThickness, 1); i++;
960 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
961 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
962 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
963 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
964 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
965 XtSetArg(uiArgs[i], XmNleftWidget, passwdLabel); i++;
966 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
967 XtSetArg(uiArgs[i], XmNrightOffset, 10); i++;
968 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
969 indFrame = XmCreateFrame(passwdForm, "indFrame", uiArgs, i);
972 passwordString = XmStringCreateLocalized("|");
973 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
974 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_BEGINNING); i++;
975 smDD.indLabel[1] = XmCreateLabel(indFrame, "indLabel",
977 XtManageChild(smDD.indLabel[1]);
978 XmStringFree(passwordString);
981 XtSetArg(uiArgs[i], XmNhighlightColor, &focus_color); i++;
982 XtGetValues(indFrame, uiArgs, i);
983 XtVaSetValues ( smDD.indLabel[1],
985 XmNborderColor, focus_color,
988 * Manage forms AFTER all children have been managed
990 XtManageChild(indFrame);
991 XtManageChild(passwdForm);
992 XtManageChild(smDD.loginForm[1]);
993 XtManageChild(smDD.loginMatte[1]);
994 XtManageChild(loginPic);
995 XtManageChild(picFrame);
996 XtManageChild(loginFrame);
1003 /*************************************<->*************************************
1005 * CreateCoverDialog ()
1010 * Create the cover dialogs for all the screens
1025 *************************************<->***********************************/
1032 Widget tmpCover, table;
1033 char geomString[50];
1035 sprintf(geomString, "%dx%d+0+0",
1036 DisplayWidth(smGD.display, screenNum),
1037 DisplayHeight(smGD.display, screenNum));
1040 XtSetArg(uiArgs[i], XmNmwmDecorations, 0);i++;
1041 XtSetArg(uiArgs[i], XmNgeometry, (String) geomString);i++;
1042 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
1043 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
1044 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
1045 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
1046 XtSetArg(uiArgs[i], XmNdepth, DefaultDepth(smGD.display, screenNum));i++;
1047 XtSetArg(uiArgs[i], XmNscreen,
1048 ScreenOfDisplay(smGD.display, screenNum));i++;
1049 XtSetArg(uiArgs[i], XmNcolormap,
1050 DefaultColormap(smGD.display, screenNum));i++;
1051 tmpCover = XtCreatePopupShell("coverDialog", topLevelShellWidgetClass,
1052 smGD.topLevelWid, uiArgs, i);
1055 XtSetArg(uiArgs[i], XmNmarginWidth, 0); i++;
1056 XtSetArg(uiArgs[i], XmNmarginHeight, 0); i++;
1057 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
1058 XtSetArg(uiArgs[i], XmNheight,
1059 (Dimension) DisplayHeight(smGD.display, smGD.screen)); i++;
1060 XtSetArg(uiArgs[i], XmNwidth,
1061 (Dimension) DisplayWidth(smGD.display, smGD.screen)); i++;
1062 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
1063 table = XmCreateDrawingArea(tmpCover, "drawArea", uiArgs, i);
1064 XtManageChild(table);
1065 smDD.coverDrawing[screenNum] = table;
1067 if(withLock == True)
1069 XtAddCallback (tmpCover, XmNpopupCallback,
1070 LockDialogUp, NULL);
1073 XtRealizeWidget(tmpCover);
1079 /*************************************<->*************************************
1086 * Callback that is called when user confirms the exit of a session by
1087 * pressing the OK button on the confirmation dialog. This routine just
1088 * facilitates the exit process.
1103 *************************************<->***********************************/
1107 XtPointer client_data,
1108 XtPointer call_data )
1110 ExitRecord *exitRec = (ExitRecord *)client_data;
1112 XtUnmanageChild(smDD.confExit);
1114 ImmediateExit(smSettings.startState, *exitRec->pmsg, exitRec->doSave);
1119 /*************************************<->*************************************
1126 * This process puts in motion the exit procedure, and then exits.
1131 * mode = Whether this session should be reset or restarted
1132 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
1133 * doSave - if True, the session will be saved.
1144 *************************************<->***********************************/
1155 * Turn off SIGTERM so we don't catch one in the middle of shutting
1158 #if !defined(SVR4) && !defined(sco)
1159 old = sigblock(sigmask(SIGTERM));
1161 old = sighold(SIGTERM);
1166 if(smGD.bmsDead == False)
1168 notice = (Tt_message) tttk_message_create( 0, TT_NOTICE, TT_SESSION, 0,
1169 "XSession_Ending", 0);
1170 tt_message_send( notice );
1171 tt_message_destroy( notice );
1174 tt_message_reply( msg );
1175 tt_message_destroy( msg );
1182 int sessionType = smGD.sessionType;
1183 XtIntervalId timerId;
1185 msg = (Tt_message) tttk_message_create( 0, TT_NOTICE, TT_SESSION, 0,
1186 "DtActivity_Beginning", 0 );
1187 tt_message_send( msg );
1188 tt_message_destroy( msg );
1190 if (smGD.sessionType == CURRENT_SESSION ||
1191 smGD.sessionType == DEFAULT_SESSION)
1192 SaveState (False, DtSM_CURRENT_STATE, SmSaveLocal, True,
1193 DEFAULT_INTERACT_STYLE, DEFAULT_FAST, DEFAULT_GLOBAL);
1194 else if (smGD.sessionType == HOME_SESSION &&
1195 smSettings.startState == DtSM_CURRENT_STATE)
1196 SaveState (False, DtSM_HOME_STATE, SmSaveLocal, True,
1197 DEFAULT_INTERACT_STYLE, DEFAULT_FAST, DEFAULT_GLOBAL);
1199 SaveState (False, DtSM_HOME_STATE, SmSaveGlobal, True,
1200 DEFAULT_INTERACT_STYLE, DEFAULT_FAST, DEFAULT_GLOBAL);
1203 * Restore sessionType - it may have been changed in SaveState
1205 smGD.sessionType = sessionType;
1207 XSync(smGD.display, 0);
1209 smGD.loggingOut = True;
1211 /* JET - set this here so we don't exit prematurely (while
1212 * handling our own SM exit callback - duh).
1214 smGD.ExitComplete = False;
1216 saveTimeout = False;
1217 timerId = XtAppAddTimeOut (smGD.appCon, smRes.saveYourselfTimeout,
1220 while (smXSMP.saveState.saveComplete == False &&
1221 smXSMP.saveState.shutdownCanceled == False) {
1224 XtAppNextEvent(smGD.appCon, &next);
1226 XtDispatchEvent(&next);
1230 /* JET - need this, since dtsession was exiting in the
1231 * XtAppNextEvent above (receiving it's own EXIT SM message) This
1232 * is checked in SmExit() so exit's will only occur after this
1233 * housekeeping has been completed.
1235 smGD.ExitComplete = True;
1237 if (smXSMP.saveState.shutdownCanceled == False) {
1239 * Run the user's exit script if there is one
1241 if (smGD.compatMode == False)
1243 StartEtc(True); /* run sessionexit */
1246 _DtReleaseLock(smGD.display, SM_RUNNING_LOCK);
1253 /*************************************<->*************************************
1260 * Called when the user bails out from a logout at the confirmation dialog
1265 * client_data - tells which dialog to unmange (the query or confirm exit)
1266 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
1277 *************************************<->***********************************/
1281 XtPointer client_data,
1282 XtPointer call_data )
1284 ExitRecord *exitRec = (ExitRecord *)client_data;
1286 if(XtIsManaged(exitRec->u.exitCancelledDialog))
1288 XtUnmanageChild(exitRec->u.exitCancelledDialog);
1291 if(smDD.smHelpDialog && XtIsManaged(smDD.smHelpDialog))
1293 XtUnmanageChild(smDD.smHelpDialog);
1296 if (*exitRec->pmsg != 0) {
1297 tttk_message_fail(*exitRec->pmsg, TT_DESKTOP_ECANCELED, 0, 1 );
1304 /*************************************<->*************************************
1311 * Once the dialog is managed, but not popped up - reposition it so that
1312 * it appears in the middle of the screen then remove the popup callback
1326 * This routine can be used for any generic SYSTEM_MODAL dialog
1328 *************************************<->***********************************/
1332 XtPointer client_data,
1333 XtPointer call_data )
1336 Dimension width, height;
1340 * Get the size of the dialog box - then compute its position
1343 XtSetArg(uiArgs[i], XmNwidth, &width);i++;
1344 XtSetArg(uiArgs[i], XmNheight, &height);i++;
1345 XtGetValues(w, uiArgs, i);
1347 x = (DisplayWidth(smGD.display, smGD.screen) / 2) - (width / 2);
1348 y = (DisplayHeight(smGD.display, smGD.screen) / 2) - (height / 2);
1351 XtSetArg(uiArgs[i], XmNx, x);i++;
1352 XtSetArg(uiArgs[i], XmNy, y);i++;
1353 XtSetValues(w, uiArgs, i);
1355 XtRemoveCallback(w, XmNpopupCallback, DialogUp, NULL);
1361 /*************************************<->*************************************
1363 * ShowWaitState (flag)
1368 * Enter/Leave the wait state.
1373 * flag = TRUE for Enter, FALSE for Leave.
1383 * Stolen from the window manager code.
1385 *************************************<->***********************************/
1393 XGrabPointer (smGD.display, DefaultRootWindow(smGD.display), FALSE,
1394 0, GrabModeAsync, GrabModeAsync, None,
1395 smGD.waitCursor, CurrentTime);
1396 XGrabKeyboard (smGD.display, DefaultRootWindow(smGD.display), FALSE,
1397 GrabModeAsync, GrabModeAsync, CurrentTime);
1401 XUngrabPointer (smGD.display, CurrentTime);
1402 XUngrabKeyboard (smGD.display, CurrentTime);
1404 XSync(smGD.display, 0);
1408 /*************************************<->*************************************
1415 * This function determines whether a server supports large cursors. It it
1416 * does large feedback cursors are used in some cases (wait state and
1417 * system modal state); otherwise smaller (16x16) standard cursors are used.
1421 * Returns true if large cursors are supported, false otherwise
1425 * This code was stolen from the window manager
1427 *************************************<->***********************************/
1429 InitCursorInfo( void )
1431 unsigned int cWidth;
1432 unsigned int cHeight;
1434 if (XQueryBestCursor (smGD.display, DefaultRootWindow(smGD.display),
1435 32, 32, &cWidth, &cHeight))
1437 if ((cWidth >= 32) && (cHeight >= 32))
1448 /*************************************<->*************************************
1455 * Once the lock dialog is managed, but not popped up - reposition it so that
1456 * it appears in the middle of the screen then remove the popup callback
1471 *************************************<->***********************************/
1475 XtPointer client_data,
1476 XtPointer call_data )
1480 Dimension width, height; /* size values returned by XtGetValues */
1481 Dimension shadowThickness;/* size values returned by XtGetValues */
1484 { /* position, size of widgets (pixels) */
1489 } mw; /* matte, logo, drop shadow & login matte */
1491 int width1, width2; /* general width variable */
1492 int x1, y1; /* general position variables */
1496 * The partial cover has widgets of index 0 - the cover has
1499 if(smGD.coverScreen == True)
1509 * - center the main matte horizontally and vertically...
1512 XtSetArg(uiArgs[i], XmNwidth, &width); i++;
1513 XtSetArg(uiArgs[i], XmNheight, &height); i++;
1514 XtSetArg(uiArgs[i], XmNshadowThickness, &shadowThickness); i++;
1515 XtGetValues(smDD.matte[index], uiArgs, i);
1517 mw.shadow = shadowThickness;
1520 mw.x = (DisplayWidth(smGD.display, smGD.screen) - mw.width)/2;
1521 mw.y = (DisplayHeight(smGD.display, smGD.screen) - mw.height)/2;
1523 if ( mw.x < 0 ) mw.x = 0;
1524 if ( mw.y < 0 ) mw.y = 0;
1531 XtSetArg(uiArgs[i], XmNx, x1); i++;
1532 XtSetArg(uiArgs[i], XmNy, y1); i++;
1534 XtSetValues(smDD.matte[index], uiArgs, i);
1537 * - center the login/password frames horizontally in the login_matte...
1539 XtSetArg(uiArgs[0], XmNwidth, &width);
1540 XtGetValues(smDD.loginMatte[index], uiArgs, 1);
1541 width1 = (int)width;
1543 XtSetArg(uiArgs[0], XmNwidth, &width);
1544 XtGetValues(smDD.loginForm[index], uiArgs, 1);
1545 width2 = (int)width;
1548 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
1549 XtSetArg(uiArgs[i], XmNleftOffset, (width1 - width2) / 2); i++;
1550 XtSetValues(smDD.loginForm[index], uiArgs, i);
1555 /*************************************<->*************************************
1562 * Simply dismiss a dialog. Does special process for a compatibility mode
1563 * logout dialog and when the bms won't start.
1568 * client_data - sends in the dialog to be dismissed.
1579 *************************************<->***********************************/
1583 XtPointer client_data,
1584 XtPointer call_data )
1586 Widget dismissDialog = (Widget) client_data;
1588 if(XtIsManaged(dismissDialog))
1590 XtUnmanageChild(dismissDialog);
1593 if(dismissDialog == smDD.compatExit)
1598 if(dismissDialog == smDD.noStart)
1602 if(dismissDialog == smDD.clientReasons)
1604 reasonsDialogOK == True;
1610 /*************************************<->*************************************
1612 * UpdatePasswdField ()
1617 * Give the visual feedback neccessary when the user is entering a password
1622 * numChars = number of characters entered into the field
1633 *************************************<->***********************************/
1639 char passwdMessage[25];
1645 strcpy(passwdMessage, "|");
1646 for(i = 1;i < numChars;i++)
1649 strcpy(passwdMessage, "|");
1651 strcat(passwdMessage, " ");
1653 strcat(passwdMessage, PASSWORD_INDICATOR);
1657 strcpy(passwdMessage, "|");
1660 tmpString = XmStringCreateLocalized (passwdMessage);
1663 * Set the index for the indLabel widget
1665 if(smGD.coverScreen == True)
1675 XtSetArg(uiArgs[i], XmNlabelString, tmpString); i++;
1676 XtSetValues(smDD.indLabel[index], uiArgs, i);
1678 XmStringFree(tmpString);
1683 /*************************************<->*************************************
1690 * When the BMS refuses to be started, warn the user about why dt is
1691 * crashing and then exit.
1706 *************************************<->***********************************/
1708 WarnNoStartup( void )
1711 XmString bmsNoStartString;
1716 bmsNoStartString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 76,
1717 "The DT messaging system could not be started.\n\n\
1718 To correct the problem:\n\n\
1719 1. Choose [OK] to return to the login screen.\n\n\
1720 2. Select Failsafe Session from the login screen's option\n\
1721 menu and log in.\n\n\
1722 3. Check to see that your hostname exists correctly in /etc/hosts if your\n\
1723 network has already been configured.\n\
1724 4. If your network has not yet been configured, make sure that /etc/hosts\n\
1725 has the following entry in it:\n\
1726 127.0.0.1 localhost \n\n\
1727 For additional information, see the CDE User's Guide.")));
1730 bmsNoStartString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 36,
1731 "The desktop messaging system could not be started.\n\n\
1732 To correct the problem:\n\n\
1733 1. Choose [OK] to return to the login screen.\n\n\
1734 2. Select Failsafe Session from the login screen's option\n\
1735 menu and log in.\n\n\
1736 3. Check to see that the desktop is properly installed,\n\
1737 the hostname is correct (/etc/hosts) and that the\n\
1738 network is properly configured.\n\n\
1739 For additional information, see the CDE User's Guide.")));
1743 * Now create the dialog box
1746 tmpString = GETMESSAGE(18, 37, "Action Required");
1747 XtSetArg(uiArgs[i], XmNmessageString, bmsNoStartString);i++;
1748 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
1749 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
1750 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
1751 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
1752 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
1753 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
1754 smDD.noStart = XmCreateWarningDialog(smGD.topLevelWid, "noStartDialog",
1757 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
1758 XtSetValues(XtParent(smDD.noStart), uiArgs, i);
1760 XtAddCallback (XtParent(smDD.noStart),
1761 XmNpopupCallback, DialogUp, NULL);
1762 XtUnmanageChild(XmMessageBoxGetChild(smDD.noStart,
1763 XmDIALOG_HELP_BUTTON));
1764 XtUnmanageChild(XmMessageBoxGetChild(smDD.noStart,
1765 XmDIALOG_CANCEL_BUTTON));
1768 * Now add in the callback and get out of here
1770 XtAddCallback (smDD.noStart, XmNokCallback,
1771 SimpleOK, smDD.noStart);
1772 XmStringFree(bmsNoStartString);
1774 XtManageChild(smDD.noStart);
1777 } /* END OF FUNCTION WarnNoStartup */
1782 /*************************************<->*************************************
1789 * Warn the user that a new .dtprofile has just been added to their $HOME
1790 * directory, indicating a need to edit it and their .login/.profile files.
1805 *************************************<->***********************************/
1807 WarnNewProfile( void )
1810 XmString newProfileString;
1813 newProfileString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 99,
1814 "The new file '.dtprofile' has been added to your home directory.\n\
1816 Follow the instructions in this file to ensure that when you log in\n\
1817 again your '.login' or '.profile' file will be activated and \n\
1818 that it will interact correctly with CDE. \n\
1820 For additional information, see the CDE Advanced User's and System\n\
1821 Administrator's Guide.")));
1825 * Now create the dialog box
1828 tmpString = GETMESSAGE(18, 37, "Action Required");
1829 XtSetArg(uiArgs[i], XmNmessageString, newProfileString);i++;
1830 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
1831 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
1832 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
1833 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
1834 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
1835 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
1836 smDD.newProfile = XmCreateWarningDialog(smGD.topLevelWid,
1840 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
1841 XtSetValues(XtParent(smDD.newProfile), uiArgs, i);
1843 XtAddCallback (XtParent(smDD.newProfile),
1844 XmNpopupCallback, DialogUp, NULL);
1845 XtUnmanageChild(XmMessageBoxGetChild(smDD.newProfile,
1846 XmDIALOG_HELP_BUTTON));
1847 XtUnmanageChild(XmMessageBoxGetChild(smDD.newProfile,
1848 XmDIALOG_CANCEL_BUTTON));
1851 * Now add in the callback and get out of here
1853 XtAddCallback (smDD.newProfile, XmNokCallback,
1854 SimpleOK, smDD.newProfile);
1855 XmStringFree(newProfileString);
1857 XtManageChild(smDD.newProfile);
1860 } /* END OF FUNCTION WarnNewProfile */
1866 /*************************************<->*************************************
1868 * ConfirmSessionCreation () -
1879 * Returns True if the user says to continue the session; False otherwise
1880 * or if malloc fails;
1885 *************************************<->***********************************/
1887 ConfirmSessionCreation (
1893 XmString title_string;
1895 XmString cancel_string;
1896 XmString help_string;
1897 XmString msg_string;
1903 Dimension width, height;
1910 * Create temporary argv because the X toolkit may remove
1911 * pieces of the command line options.
1914 argv = (char **) XtMalloc (_argc * sizeof (char *));
1915 for (i = 0; i < _argc; i++)
1919 if (session_type == HOME_SESSION)
1920 pch1 = strdup ((char *) GETMESSAGE(18, 50, "Home"));
1922 pch1 = strdup ((char *) GETMESSAGE(18, 51, "Current"));
1924 PrintError(DtError, smNLS.cantMallocErrorString);
1928 pch2 = strdup ((char *) GETMESSAGE(18, 52,
1929 "A display-specific '%s' session was selected\nfor display '%s' but one does not exist.\n\nIf you continue, a new display-specific session will\nbe created."));
1931 PrintError(DtError, smNLS.cantMallocErrorString);
1935 pch3 = XtMalloc (strlen (pch1) +
1936 strlen (XDisplayName (getenv("DISPLAY"))) +
1940 PrintError(DtError, smNLS.cantMallocErrorString);
1943 (void) sprintf (pch3, pch2, pch1, XDisplayName (getenv("DISPLAY")));
1946 * The X toolkit has not yet been initialized, so do it now.
1949 XtToolkitInitialize ();
1950 smGD.appCon = XtCreateApplicationContext();
1951 smGD.display = XtOpenDisplay(smGD.appCon, NULL, argv[0],
1952 SM_RESOURCE_CLASS, NULL, 0, &argc, argv);
1954 XtSetArg(args[j], XmNbackground,
1955 XBlackPixel(smGD.display, XDefaultScreen(smGD.display))); j++;
1956 XtSetArg(args[j], XmNmappedWhenManaged, False); j++;
1957 XtSetArg (args[j], XmNwidth, 1); j++;
1958 XtSetArg (args[j], XmNheight, 1); j++;
1959 tmp_widget = XtAppCreateShell (
1961 applicationShellWidgetClass,
1962 smGD.display, args, j);
1963 XtRealizeWidget(tmp_widget);
1966 * Create the compound strings for the confirmation dialog
1968 msg_string = XmStringCreateLocalized (pch3);
1969 title_string = XmStringCreateLocalized(pch3);
1971 ok_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 39, "OK")));
1972 cancel_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 40, "Cancel")));
1973 help_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 41, "Help")));
1975 free (pch1); free (pch2); XtFree (pch3);
1978 * Create the dialog box
1981 XtSetArg (uiArgs[i], XmNmessageString, msg_string); i++;
1982 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
1983 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
1984 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
1985 XtSetArg (uiArgs[i], XmNmappedWhenManaged, True); i++;
1986 XtSetArg (uiArgs[i], XmNtitle, title_string); i++;
1987 XtSetArg (uiArgs[i], XmNokLabelString, ok_string); i++;
1988 XtSetArg (uiArgs[i], XmNcancelLabelString, cancel_string); i++;
1989 XtSetArg (uiArgs[i], XmNhelpLabelString, help_string); i++;
1990 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
1992 smDD.confirmSession = XmCreateWarningDialog(
1993 tmp_widget, "confirmDialog", uiArgs, i);
1995 XtAddCallback (smDD.confirmSession, XmNokCallback,
1999 * Some help state is not yet initialized and the help
2000 * callback assumes it is so some initializations must
2003 smDD.smHelpDialog = NULL;
2004 smDD.okString = ok_string;
2005 smGD.topLevelWid = tmp_widget;
2007 XtAddCallback (smDD.confirmSession, XmNhelpCallback,
2008 TopicHelpRequested, HELP_CONFIRMATION_SESSION_STR);
2010 XtAddCallback (smDD.confirmSession, XmNcancelCallback,
2011 ConfirmCancelCB, NULL);
2013 XtManageChild(smDD.confirmSession);
2016 * Center the dialog on the display
2019 XtSetArg(uiArgs[i], XmNwidth, &width); i++;
2020 XtSetArg(uiArgs[i], XmNheight, &height); i++;
2021 XtGetValues(smDD.confirmSession, uiArgs, i);
2023 x = (DisplayWidth(smGD.display, XDefaultScreen(smGD.display)) / 2)
2025 y = (DisplayHeight(smGD.display, XDefaultScreen(smGD.display)) / 2)
2029 XtSetArg(uiArgs[i], XmNx, x); i++;
2030 XtSetArg(uiArgs[i], XmNy, y); i++;
2031 XtSetValues(smDD.confirmSession, uiArgs, i);
2033 XmStringFree (msg_string);
2034 XmStringFree (title_string);
2035 XmStringFree (cancel_string);
2036 XmStringFree (help_string);
2039 * Spin until the OK or Cancel CB is invoked
2041 confirmState = ConfirmationNone;
2043 XtAppNextEvent(smGD.appCon, &next);
2045 XtDispatchEvent(&next);
2046 if (confirmState == ConfirmationOK) {
2047 XtDestroyWidget (tmp_widget);
2048 XmStringFree (ok_string);
2051 else if (confirmState == ConfirmationCancel) {
2052 XtDestroyWidget (tmp_widget);
2053 XmStringFree (ok_string);
2060 /*************************************<->*************************************
2064 *************************************<->***********************************/
2068 XtPointer client_data,
2069 XtPointer call_data )
2071 XtUnmanageChild(smDD.confirmSession);
2072 confirmState = ConfirmationOK;
2076 /*************************************<->*************************************
2078 * ConfirmCancelCB ()
2080 *************************************<->***********************************/
2084 XtPointer client_data,
2085 XtPointer call_data )
2087 XtUnmanageChild(smDD.confirmSession);
2088 confirmState = ConfirmationCancel;
2092 /*************************************<->*************************************
2094 * PostXSMPFailureDialog () -
2105 * Returns True if the user says to continue the session; False otherwise
2106 * or if malloc fails;
2111 *************************************<->***********************************/
2113 PostXSMPFailureDialog (
2114 XSMPFailure failure_code,
2115 Boolean check_errorlog)
2119 XmString help_string;
2120 XmString msg_string;
2128 Dimension width, height;
2133 pch1 = strdup ((char *) GETMESSAGE(40, 1,
2134 "A session cannot be started because of the\nfollowing error:"));
2136 PrintError(DtError, smNLS.cantMallocErrorString);
2140 switch (failure_code) {
2141 case XSMP_FAILURE_SMS_INITIALIZE:
2142 pch2 = strdup ((char *) GETMESSAGE (40, 2,
2143 "SmsInitialize failed."));
2145 case XSMP_FAILURE_ICE_LISTEN:
2146 pch2 = strdup ((char *) GETMESSAGE (40, 3,
2147 "IceListenForConnections failed."));
2149 case XSMP_FAILURE_AUTHENTICATION:
2150 pch2 = strdup ((char *) GETMESSAGE (40, 4,
2151 "The authentication file ~/.ICEauthority could not be created.\n If the files ~/.ICEauthority-c and ~/.ICEauthority-l exist,\n they must be removed before your session can be started."));
2153 case XSMP_FAILURE_ICE_ADD_WATCH:
2154 pch2 = strdup ((char *) GETMESSAGE (40, 5,
2155 "IceAddConnectionWatch failed."));
2157 case XSMP_FAILURE_ICE_COMPOSE_IDS:
2158 pch2 = strdup ((char *) GETMESSAGE (40, 6,
2159 "IceComposeNetworkIds failed."));
2161 case XSMP_FAILURE_MALLOC:
2162 pch2 = strdup ((char *) GETMESSAGE (40, 7,
2163 "Could not create the SESSION_MANAGER environment variable."));
2167 PrintError(DtError, smNLS.cantMallocErrorString);
2171 pch3 = strdup ((char *) GETMESSAGE(18, 70,
2172 "See the following for more information:"));
2174 PrintError(DtError, smNLS.cantMallocErrorString);
2178 pch4 = strdup ((char *) GETMESSAGE(18, 71,
2179 "CDE Advanced Users and System's Administration Guide"));
2181 PrintError(DtError, smNLS.cantMallocErrorString);
2185 error_file = XtMalloc(MAXPATHLEN+1);
2186 strcpy (error_file, "");
2188 /* JET - VU#497553 */
2193 if (home = getenv ("HOME"))
2195 len = strlen(home) +
2196 strlen(DtPERSONAL_CONFIG_DIRECTORY) +
2197 strlen(DtERRORLOG_FILE);
2199 if (len > MAXPATHLEN)
2200 error_file = XtRealloc(error_file, len + 1);
2202 sprintf (error_file, "%s/%s/%s", home,
2203 DtPERSONAL_CONFIG_DIRECTORY,
2208 pch5 = XtMalloc (strlen (pch1) + strlen (pch2) + strlen (pch3) + strlen (pch4) +
2209 strlen (error_file) + 15);
2211 PrintError(DtError, smNLS.cantMallocErrorString);
2214 (void) sprintf (pch5, "%s\n\n %s\n\n%s\n\n %s\n %s\n",
2215 pch1, pch2, pch3, pch4, error_file);
2220 * No top level widget has been created so must create one now.
2223 XtSetArg (args[j], XmNbackground, XBlackPixel(smGD.display,
2224 XDefaultScreen(smGD.display))); j++;
2225 XtSetArg (args[j], XmNmappedWhenManaged, False); j++;
2226 XtSetArg (args[j], XmNwidth, 1); j++;
2227 XtSetArg (args[j], XmNheight, 1); j++;
2229 smGD.topLevelWid = XtAppCreateShell (SM_RESOURCE_NAME,
2230 SM_RESOURCE_CLASS, applicationShellWidgetClass,
2231 smGD.display, args, j);
2233 XtRealizeWidget(smGD.topLevelWid);
2236 * Create the compound strings for the confirmation dialog
2238 msg_string = XmStringCreateLocalized (pch5);
2240 ok_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 39, "OK")));
2241 help_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 41, "Help")));
2243 free (pch1); free (pch2); free (pch3); free (pch4); XtFree (pch5);
2246 * Create the dialog box
2249 XtSetArg (uiArgs[i], XmNmessageString, msg_string); i++;
2250 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
2251 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
2252 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
2253 XtSetArg (uiArgs[i], XmNmappedWhenManaged, True); i++;
2254 XtSetArg (uiArgs[i], XmNokLabelString, ok_string); i++;
2255 XtSetArg (uiArgs[i], XmNhelpLabelString, help_string); i++;
2256 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
2258 smDD.confirmSession = XmCreateWarningDialog(
2259 smGD.topLevelWid, "confirmDialog", uiArgs, i);
2261 XtAddCallback (smDD.confirmSession, XmNokCallback,
2262 XSMPFailureOKCB, NULL);
2265 * Some help state is not yet initialized and the help
2266 * callback assumes it is so some initializations must
2269 smDD.smHelpDialog = NULL;
2270 smDD.okString = ok_string;
2272 XtAddCallback (smDD.confirmSession, XmNhelpCallback,
2273 TopicHelpRequested, HELP_XSMP_INIT_FAILURE_STR);
2275 XtUnmanageChild(XmMessageBoxGetChild(smDD.confirmSession,
2276 XmDIALOG_CANCEL_BUTTON));
2278 XtManageChild(smDD.confirmSession);
2281 * Center the dialog on the display
2284 XtSetArg(uiArgs[i], XmNwidth, &width); i++;
2285 XtSetArg(uiArgs[i], XmNheight, &height); i++;
2286 XtGetValues(smDD.confirmSession, uiArgs, i);
2288 x = (DisplayWidth(smGD.display, XDefaultScreen(smGD.display)) / 2)
2290 y = (DisplayHeight(smGD.display, XDefaultScreen(smGD.display)) / 2)
2294 XtSetArg(uiArgs[i], XmNx, x); i++;
2295 XtSetArg(uiArgs[i], XmNy, y); i++;
2296 XtSetValues(smDD.confirmSession, uiArgs, i);
2298 XmStringFree (msg_string);
2299 XmStringFree (help_string);
2302 * Spin until the OK CB is invoked
2305 XtAppNextEvent(smGD.appCon, &next);
2307 XtDispatchEvent(&next);
2312 /*************************************<->*************************************
2314 * XSMPFailureOKCB ()
2316 *************************************<->***********************************/
2320 XtPointer client_data,
2321 XtPointer call_data )
2323 XtUnmanageChild(smDD.confirmSession);
2330 /*************************************<->*************************************
2332 * PostSaveSessionErrorDialog
2336 * Let the user know that the Save_Session message does not have the
2337 * required data and the session will not be saved.
2345 *************************************<->***********************************/
2347 PostSaveSessionErrorDialog ( void )
2350 XmString messageString;
2353 if(smDD.saveSession == NULL)
2355 messageString = XmStringCreateLocalized (((char *) GETMESSAGE(18, 56,
2356 "The session cannot be saved because the required\n\
2357 'save_type' parameter was not in the message.\n\n\
2358 The session will not be saved.")));
2360 titleString = GETMESSAGE(18, 55, "Save Session Failure");
2363 XtSetArg (uiArgs[i], XmNmessageString, messageString); i++;
2364 XtSetArg (uiArgs[i], XmNallowShellResize, True); i++;
2365 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
2366 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
2367 XtSetArg (uiArgs[i], XmNtitle, titleString); i++;
2368 XtSetArg (uiArgs[i], XmNokLabelString, smDD.okString); i++;
2369 XtSetArg (uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
2370 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
2372 smDD.saveSession = XmCreateErrorDialog(smGD.topLevelWid,
2373 "sessionSaveDialog", uiArgs, i);
2376 XtSetArg (uiArgs[i], XmNuseAsyncGeometry, True);i++;
2377 XtSetArg (uiArgs[i], XmNmwmFunctions, 0);i++;
2378 XtSetArg (uiArgs[i], XmNmwmDecorations,
2379 (MWM_DECOR_TITLE | MWM_DECOR_BORDER)); i++;
2380 XtSetArg (uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
2382 XtSetValues(XtParent(smDD.saveSession), uiArgs, i);
2384 XtAddCallback (XtParent(smDD.saveSession),
2385 XmNpopupCallback, DialogUp, NULL);
2387 XtUnmanageChild (XmMessageBoxGetChild(smDD.saveSession,
2388 XmDIALOG_CANCEL_BUTTON));
2390 XtAddCallback (smDD.saveSession, XmNokCallback,
2391 SimpleOK, (XtPointer) smDD.saveSession);
2393 XtAddCallback (smDD.saveSession, XmNhelpCallback,
2394 TopicHelpRequested, HELP_SESSION_SAVE_ERROR_STR);
2396 XmStringFree(messageString);
2399 XtManageChild(smDD.saveSession);
2406 /*************************************<->*************************************
2408 * PostReasonsDialog - posts a Warning dialog on behalf of a client
2409 * that supplied a "reason" when it closed its connection
2417 *************************************<->***********************************/
2423 Boolean waitForResponse)
2427 XmString helpString;
2437 str1 = strdup ((char *) GETMESSAGE(40, 28,
2438 "Application '%s'\nexited for the following reason:\n\n%s"));
2440 PrintError(DtError, smNLS.cantMallocErrorString);
2444 for (i = 0, len = 0; i < numMsgs; i++)
2445 len += strlen (message[i]);
2447 str2 = XtMalloc (len + (numMsgs * 3) + 1);
2449 PrintError(DtError, smNLS.cantMallocErrorString);
2453 for (i = 0; i < numMsgs; i++) {
2454 strcat (str2, message[i]);
2455 strcat (str2, "\n");
2458 str3 = XtMalloc (strlen (str1) + strlen (str2) + strlen (progName) + 4);
2460 PrintError(DtError, smNLS.cantMallocErrorString);
2463 (void) sprintf (str3, str1, progName, str2);
2465 DtMsgLogMessage (smGD.programName, DtMsgLogWarning, str3);
2468 str1 = strdup ((char *) GETMESSAGE(40, 29,
2469 "Application Close Reasons"));
2471 PrintError(DtError, smNLS.cantMallocErrorString);
2475 msgString = XmStringCreateLocalized (str3);
2477 okString = XmStringCreateLocalized(((char *) GETMESSAGE(18, 39, "OK")));
2479 helpString = XmStringCreateLocalized(((char *) GETMESSAGE(18, 41, "Help")));
2482 * Create the dialog box
2485 XtSetArg (uiArgs[i], XmNmessageString, msgString); i++;
2486 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
2487 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
2488 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
2489 XtSetArg (uiArgs[i], XmNmappedWhenManaged, True); i++;
2490 XtSetArg (uiArgs[i], XmNtitle, str1); i++;
2491 XtSetArg (uiArgs[i], XmNokLabelString, okString); i++;
2492 XtSetArg (uiArgs[i], XmNhelpLabelString, helpString); i++;
2493 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
2495 smDD.clientReasons = XmCreateWarningDialog(smGD.topLevelWid,
2496 "clientReasons", uiArgs, i);
2499 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
2500 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
2501 XtSetArg(uiArgs[i], XmNmwmDecorations,
2502 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
2503 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
2504 XtSetValues(XtParent(smDD.clientReasons), uiArgs, i);
2506 XtAddCallback (XtParent(smDD.clientReasons),
2507 XmNpopupCallback, DialogUp, NULL);
2509 XtUnmanageChild (XmMessageBoxGetChild (smDD.clientReasons,
2510 XmDIALOG_CANCEL_BUTTON));
2513 * Now add in the callback and get out of here
2515 XtAddCallback (smDD.clientReasons, XmNokCallback,
2516 SimpleOK, (XtPointer) smDD.clientReasons);
2518 XtAddCallback (smDD.clientReasons, XmNhelpCallback,
2519 TopicHelpRequested, HELP_APP_CLOSE_REASONS_STR);
2524 XmStringFree (msgString);
2525 XmStringFree (okString);
2526 XmStringFree (helpString);
2528 XtManageChild (smDD.clientReasons);
2531 * Spin until the OK callback is invoked. If a shutdown
2532 * is in progress, we don't want to return until the
2533 * user has acknowledged this message.
2535 reasonsDialogOK = False;
2536 if (waitForResponse) {
2538 XtAppNextEvent (smGD.appCon, &next);
2540 XtDispatchEvent(&next);
2541 if (reasonsDialogOK == True)
2548 /*************************************<->*************************************
2554 * Timeout procedure that is invoked when a save timer expires.
2562 *************************************<->***********************************/
2565 XtPointer client_data,
2570 if (smXSMP.saveState.shutdownCanceled == False) {
2572 * Run the user's exit script if there is one
2574 if (smGD.compatMode == False)
2575 StartEtc(True); /* run sessionexit */
2577 _DtReleaseLock(smGD.display, SM_RUNNING_LOCK);