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>
85 #include "SmRestore.h"
87 #include "SmGlobals.h"
96 ConfirmState confirmState;
101 #define PASSWORD_INDICATOR " "
103 typedef struct _ExitRecord {
106 Widget exitCancelledDialog;
107 int queryExitConfirmedMode;
119 * Local Function Declarations
122 static int CompatModeExit( void ) ;
123 static void ExitConfirmed( Widget, XtPointer, XtPointer ) ;
124 static void ExitCancelled( Widget, XtPointer, XtPointer ) ;
125 static void LockDialogUp( Widget, XtPointer, XtPointer ) ;
126 static void SimpleOK( Widget, XtPointer, XtPointer ) ;
127 static void ConfirmOKCB ( Widget, XtPointer, XtPointer ) ;
128 static void ConfirmCancelCB ( Widget, XtPointer, XtPointer ) ;
129 static void ConfirmHelpCB ( Widget, XtPointer, XtPointer ) ;
130 static void XSMPFailureOKCB( Widget w, XtPointer client_data, XtPointer call_data );
131 static void SaveTimeout( XtPointer , XtIntervalId *) ;
137 static Boolean session_confirmed = False;
138 static Boolean reasonsDialogOK;
139 static Boolean saveTimeout;
143 /*************************************<->*************************************
145 * CreateLockDialog ()
150 * Create the lock dialog when it exists NOT as a part of a cover
165 *************************************<->***********************************/
167 CreateLockDialog( void )
170 Widget loginLabel, instructLabel, tmpLock, indFrame;
171 Widget passwdLabel, passwdForm, picFrame, loginPic, loginFrame;
172 Dimension width; /* width, height of login label */
173 XmString lockString, passwordString;
176 Pixel fg, bg, focus_color; /* foreground, background colors */
179 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
180 XtSetArg(uiArgs[i], XmNmarginWidth, 0); i++;
181 XtSetArg(uiArgs[i], XmNmarginHeight, 0); i++;
182 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
183 XtSetArg(uiArgs[i], XmNshadowThickness,5); i++;
184 XtSetArg(uiArgs[i], XmNunitType, XmPIXELS); i++;
185 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
186 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
187 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
188 XtSetArg(uiArgs[i], XmNmappedWhenManaged, True); i++;
189 tmpLock = XmCreateFormDialog(smGD.topLevelWid, "lockDialog", uiArgs, i);
190 XtAddCallback (XtParent(tmpLock), XmNpopupCallback,
192 smDD.matte[0] = tmpLock;
195 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
196 XtSetArg(uiArgs[i], XmNmwmDecorations, 0);i++;
197 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
198 XtSetValues(XtParent(tmpLock), uiArgs, i);
201 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
202 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
203 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
204 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
205 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
206 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
207 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
208 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
209 picFrame = XmCreateFrame(tmpLock, "picFrame", uiArgs, i);
212 XtSetArg(uiArgs[i], XmNforeground, &fg); i++;
213 XtSetArg(uiArgs[i], XmNbackground, &bg); i++;
214 XtGetValues(tmpLock, uiArgs, i);
217 XtSetArg(uiArgs[i], XmNfillMode, XmFILL_SELF); i++;
218 XtSetArg(uiArgs[i], XmNbehavior, XmICON_LABEL); i++;
219 XtSetArg(uiArgs[i], XmNpixmapForeground, fg); i++;
220 XtSetArg(uiArgs[i], XmNpixmapBackground, bg); i++;
221 XtSetArg(uiArgs[i], XmNstring, NULL); i++;
222 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
223 XtSetArg(uiArgs[i], XmNtraversalOn, False); i++;
224 loginPic = _DtCreateIcon(picFrame, "lockLabelPixmap", uiArgs, i);
227 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
228 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
229 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
230 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
231 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
232 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
233 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
234 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
235 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
236 XtSetArg(uiArgs[i], XmNrightOffset, 0); i++;
237 XtSetArg(uiArgs[i], XmNrightWidget, loginPic); i++;
238 loginFrame = XmCreateFrame(tmpLock, "loginFrame", uiArgs, i);
242 * create the login matte...
245 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
246 smDD.loginMatte[0] = XmCreateForm(loginFrame, "loginMatte", uiArgs, i);
249 * create the login/password forms
252 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
253 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
254 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
255 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
256 XtSetArg(uiArgs[i], XmNbottomPosition, 50); i++;
257 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
258 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
259 smDD.loginForm[0] = XmCreateForm(smDD.loginMatte[0], "loginForm", uiArgs, i);
262 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
263 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
264 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
265 XtSetArg(uiArgs[i], XmNtopPosition, 50); i++;
266 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
267 XtSetArg(uiArgs[i], XmNleftWidget, smDD.loginForm[0]); i++;
268 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
269 XtSetArg(uiArgs[i], XmNrightWidget, smDD.loginForm[0]); i++;
270 passwdForm = XmCreateForm(smDD.loginMatte[0], "passwdForm", uiArgs, i);
274 * create the login/password labels...
277 envLog = getenv("LOGNAME");
278 lockMessage = XtMalloc(100 + strlen(envLog));
281 (char*) GETMESSAGE(18, 1, "Display locked by user %s."), envLog);
282 lockString = XmStringCreateLocalized(lockMessage);
283 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
284 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
285 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
286 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
287 loginLabel = XmCreateLabelGadget(smDD.loginForm[0],
288 "loginLabel", uiArgs, i);
289 XtManageChild(loginLabel);
290 XmStringFree(lockString);
294 lockString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 2, "Enter password to unlock.")));
295 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
296 XtSetArg(uiArgs[i], XmNtopWidget, loginLabel); i++;
297 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
298 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
299 instructLabel = XmCreateLabelGadget(smDD.loginForm[0], "instructLabel",
301 XtManageChild(instructLabel);
302 XmStringFree(lockString);
305 passwordString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 3, "Password: ")));
306 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
307 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
308 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
309 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
310 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
311 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
312 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
313 passwdLabel = XmCreateLabelGadget(passwdForm,
314 "passwdLabel", uiArgs, i);
315 XtManageChild(passwdLabel);
316 XmStringFree(passwordString);
319 * Give the password label an offset
322 XtSetArg(uiArgs[i], XmNwidth, &width);i++;
323 XtGetValues(passwdLabel, uiArgs, i);
327 XtSetArg(uiArgs[i], XmNwidth, width);i++;
328 XtSetArg(uiArgs[i], XmNrecomputeSize, False);i++;
329 XtSetValues(passwdLabel, uiArgs, i);
333 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_IN); i++;
334 XtSetArg(uiArgs[i], XmNshadowThickness, 1); i++;
335 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
336 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
337 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
338 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
339 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
340 XtSetArg(uiArgs[i], XmNleftWidget, passwdLabel); i++;
341 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
342 XtSetArg(uiArgs[i], XmNrightOffset, 10); i++;
343 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
344 indFrame = XmCreateFrame(passwdForm, "indFrame", uiArgs, i);
347 passwordString = XmStringCreateLocalized("|");
348 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
349 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_BEGINNING); i++;
350 smDD.indLabel[0] = XmCreateLabel(indFrame, "indLabel",
352 XtManageChild(smDD.indLabel[0]);
353 XmStringFree(passwordString);
356 XtSetArg(uiArgs[i], XmNhighlightColor, &focus_color); i++;
357 XtGetValues(indFrame, uiArgs, i);
358 XtVaSetValues ( smDD.indLabel[0],
360 XmNborderColor, focus_color,
364 * Manage forms AFTER all children have been managed
366 XtManageChild(indFrame);
367 XtManageChild(passwdForm);
368 XtManageChild(smDD.loginForm[0]);
369 XtManageChild(smDD.loginMatte[0]);
370 XtManageChild(loginPic);
371 XtManageChild(picFrame);
372 XtManageChild(loginFrame);
379 /*************************************<->*************************************
386 * Determines which exit routines get called when an exit request is made
387 * of the session manager.
388 * If smGD.bmsDead == false, we just exit.
389 * If ASK_STATE is turned on, the query dialog is
390 * put up, if VERBOSE is on, confirm exit in current mode (restart or reset)
391 * if confirmation is turned off - exit immediately.
396 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
407 *************************************<->***********************************/
412 if (smGD.bmsDead == True)
414 ImmediateExit(-1, msg, True);
416 if(smGD.compatMode == True)
419 tt_message_reply( msg );
420 tt_message_destroy( msg );
426 if(smSettings.confirmMode == DtSM_VERBOSE_MODE ||
427 smSettings.startState == DtSM_ASK_STATE)
429 ConfirmExit( msg, True );
433 ImmediateExit(smSettings.startState, msg, True);
440 /*************************************<->*************************************
447 * Create the exit confirmation dialog box (if it hasn't been) and confirm
448 * that the user wants to exit the session. This routine only gets called
449 * when the user hasn't turned of exit confirmation and is not in ASK mode
454 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
465 *************************************<->***********************************/
475 static XmString homeToHome; /* started Home, restore to Home */
476 static XmString returnToCurrent; /* started Home or Current but
478 static XmString currentToHome; /* started Current, return to Home */
480 if(smDD.confExit == NULL)
483 * Create all compound strings for confirmation dialogs
485 returnToCurrent = XmStringCreateLocalized(((char *)GETMESSAGE(18, 4,
486 "Exiting the desktop session...\n\n\
487 Your Current session will be restored upon login.\n\n\
488 Application updates you have not saved will be lost.\n\n\
489 Continue Logout?")));
491 homeToHome = XmStringCreateLocalized(((char *)GETMESSAGE(18, 5,
492 "Exiting the desktop session...\n\n\
493 Your Home session will be restored upon login.\n\
494 Your Current session will not be saved.\n\n\
495 Application updates you have not saved will be lost.\n\n\
496 Continue Logout?")));
498 currentToHome = XmStringCreateLocalized(((char *)GETMESSAGE(18, 75,
499 "Exiting the desktop session...\n\n\
500 Your Current session will be saved but your Home\n\
501 session will be restored upon login.\n\n\
502 Application updates you have not saved will be lost.\n\n\
503 Continue Logout?")));
506 * Build up the correct string for this dialog
509 if (smGD.sessionType == HOME_SESSION &&
510 smSettings.startState == DtSM_HOME_STATE)
512 XtSetArg(uiArgs[i], XmNmessageString, homeToHome); i++;
514 else if (smGD.sessionType == CURRENT_SESSION &&
515 smSettings.startState == DtSM_HOME_STATE)
517 XtSetArg(uiArgs[i], XmNmessageString, currentToHome); i++;
521 XtSetArg(uiArgs[i], XmNmessageString, returnToCurrent); i++;
525 * Now create the dialog box
527 tmpString = GETMESSAGE(18, 6, "Logout Confirmation");
528 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
529 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
530 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_CENTER); i++;
531 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
532 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okLogoutString); i++;
533 XtSetArg(uiArgs[i], XmNcancelLabelString, smDD.cancelLogoutString); i++;
534 XtSetArg(uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
535 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
537 pmsg = (Tt_message *)XtMalloc(sizeof(Tt_message));
538 XtSetArg(uiArgs[i], XmNuserData, pmsg); i++;
540 smDD.confExit = XmCreateWarningDialog(smGD.topLevelWid, "exitDialog",
544 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
545 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
546 XtSetArg(uiArgs[i], XmNmwmDecorations,
547 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
548 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
549 XtSetValues(XtParent(smDD.confExit), uiArgs, i);
551 exitRec = (ExitRecord *)XtMalloc( sizeof(ExitRecord) );
552 exitRec->pmsg = pmsg;
553 exitRec->doSave = doSave;
554 XtAddCallback (smDD.confExit, XmNokCallback, ExitConfirmed, exitRec);
556 XtAddCallback (smDD.confExit, XmNhelpCallback,
557 TopicHelpRequested, HELP_LOGOUT_STR);
559 exitRec = (ExitRecord *)XtMalloc( sizeof(ExitRecord) );
560 exitRec->pmsg = pmsg;
561 exitRec->doSave = doSave;
562 exitRec->u.exitCancelledDialog = smDD.confExit;
563 XtAddCallback (smDD.confExit, XmNcancelCallback,
564 ExitCancelled, exitRec);
569 * The user may have changed the type of session to be
570 * restored so must update the dialog's message.
573 if (smGD.sessionType == HOME_SESSION &&
574 smSettings.startState == DtSM_HOME_STATE)
576 XtSetArg(uiArgs[i], XmNmessageString, homeToHome); i++;
578 else if (smGD.sessionType == CURRENT_SESSION &&
579 smSettings.startState == DtSM_HOME_STATE)
581 XtSetArg(uiArgs[i], XmNmessageString, currentToHome); i++;
585 XtSetArg(uiArgs[i], XmNmessageString, returnToCurrent); i++;
588 XtSetValues(smDD.confExit, uiArgs, i);
592 * Refresh buffer containing pointer to Tt_message.
595 XtSetArg(uiArgs[i], XmNuserData, &pmsg); i++;
596 XtGetValues(smDD.confExit, uiArgs, i);
600 XtAddCallback (XtParent(smDD.confExit), XmNpopupCallback, DialogUp, NULL);
602 XtManageChild(smDD.confExit);
607 /*************************************<->*************************************
614 * Let the user know that the bms has died and that the current session
630 *************************************<->***********************************/
632 WarnMsgFailure( void )
635 XmString bmsDeadString;
638 if(smDD.deadWid == NULL)
640 bmsDeadString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 38,
641 "Messaging System Inoperative\n\n\
642 To restart:\n\n1) Save all open data files.\n\
644 3) Log in again.\n\nNote: The current session will not be saved.\n\n\
645 When you are ready to begin the restart process, click [OK] and\n\
646 proceed to save your files.")));
649 * Now create the dialog box
652 tmpString = GETMESSAGE(18, 12, "Message Failure");
653 XtSetArg(uiArgs[i], XmNmessageString, bmsDeadString);i++;
654 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
655 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
656 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
657 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
658 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
659 XtSetArg(uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
660 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
661 smDD.deadWid = XmCreateWarningDialog(smGD.topLevelWid, "deadDialog",
665 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
666 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
667 XtSetArg(uiArgs[i], XmNmwmDecorations,
668 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
669 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
670 XtSetValues(XtParent(smDD.deadWid), uiArgs, i);
672 XtAddCallback (XtParent(smDD.deadWid),
673 XmNpopupCallback, DialogUp, NULL);
674 XtUnmanageChild(XmMessageBoxGetChild(smDD.deadWid,
675 XmDIALOG_CANCEL_BUTTON));
678 * Now add in the callback and get out of here
680 XtAddCallback (smDD.deadWid, XmNokCallback,
681 SimpleOK, (XtPointer) smDD.deadWid);
683 XtAddCallback (smDD.deadWid, XmNhelpCallback,
684 TopicHelpRequested, HELP_BMS_DEAD_STR);
686 XtAddCallback (smDD.deadWid, XmNcancelCallback,
688 XmStringFree(bmsDeadString);
691 XtManageChild(smDD.deadWid);
696 /*************************************<->*************************************
703 * Let the user know that the logout button can not be used to exit in
704 * compatibility mode.
719 *************************************<->***********************************/
721 CompatModeExit( void )
724 XmString compatModeString;
727 if(smDD.compatExit == NULL)
729 compatModeString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 34,
730 "This session was started from an X Window System startup script.\n\n\
731 No session information will be saved.\n\nUse the reset key sequence to log out.")));
734 * Now create the dialog box
737 tmpString = GETMESSAGE(18, 35, "Logout Message");
738 XtSetArg(uiArgs[i], XmNmessageString, compatModeString);i++;
739 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
740 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
741 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_CENTER); i++;
742 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
743 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
744 XtSetArg(uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
745 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
746 smDD.compatExit = XmCreateInformationDialog(smGD.topLevelWid,
751 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
752 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
753 XtSetArg(uiArgs[i], XmNmwmDecorations,
754 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
755 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
756 XtSetValues(XtParent(smDD.compatExit), uiArgs, i);
758 XtAddCallback (XtParent(smDD.compatExit),
759 XmNpopupCallback, DialogUp, NULL);
760 XtUnmanageChild(XmMessageBoxGetChild(smDD.compatExit,
761 XmDIALOG_CANCEL_BUTTON));
764 * Now add in the callback and get out of here
766 XtAddCallback (smDD.compatExit, XmNokCallback,
767 SimpleOK, smDD.compatExit);
769 XtAddCallback (smDD.compatExit, XmNhelpCallback,
770 TopicHelpRequested, HELP_LOGOUT_COMPAT_MODE_STR);
772 XmStringFree(compatModeString);
775 XtManageChild(smDD.compatExit);
781 /*************************************<->*************************************
783 * CreateLockDialogWithCover()
788 * Create the lock dialog when it exists as a part of a cover
803 *************************************<->***********************************/
805 CreateLockDialogWithCover(
809 Widget loginLabel, instructLabel, tmpLock;
810 Widget indFrame, loginPic, picFrame, loginFrame;
811 Widget passwdLabel, passwdForm;
812 Dimension width; /* width, height of drop shadow */
813 XmString lockString, passwordString;
816 Pixel fg, bg, focus_color; /* foreground, background colors */
819 XtSetArg(uiArgs[i], XmNmarginWidth, 0); i++;
820 XtSetArg(uiArgs[i], XmNmarginHeight, 0); i++;
821 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
822 XtSetArg(uiArgs[i], XmNshadowThickness,5); i++;
823 XtSetArg(uiArgs[i], XmNunitType, XmPIXELS); i++;
824 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
825 XtSetArg(uiArgs[i], XmNmappedWhenManaged, False); i++;
826 tmpLock = XmCreateForm(parent, "lockDialog", uiArgs, i);
827 smDD.matte[1] = tmpLock;
830 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
831 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
832 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
833 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
834 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
835 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
836 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
837 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
838 picFrame = XmCreateFrame(tmpLock, "picFrame", uiArgs, i);
841 XtSetArg(uiArgs[i], XmNforeground, &fg); i++;
842 XtSetArg(uiArgs[i], XmNbackground, &bg); i++;
843 XtGetValues(tmpLock, uiArgs, i);
846 XtSetArg(uiArgs[i], XmNfillMode, XmFILL_SELF); i++;
847 XtSetArg(uiArgs[i], XmNbehavior, XmICON_LABEL); i++;
848 XtSetArg(uiArgs[i], XmNpixmapForeground, fg); i++;
849 XtSetArg(uiArgs[i], XmNpixmapBackground, bg); i++;
850 XtSetArg(uiArgs[i], XmNstring, NULL); i++;
851 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
852 XtSetArg(uiArgs[i], XmNtraversalOn, False); i++;
853 loginPic = _DtCreateIcon(picFrame, "lockLabelPixmap", uiArgs, i);
856 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_OUT); i++;
857 XtSetArg(uiArgs[i], XmNshadowThickness, 2); i++;
858 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_FORM); i++;
859 XtSetArg(uiArgs[i], XmNtopOffset, 15); i++;
860 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_FORM); i++;
861 XtSetArg(uiArgs[i], XmNbottomOffset, 15); i++;
862 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
863 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
864 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
865 XtSetArg(uiArgs[i], XmNrightWidget, picFrame); i++;
866 XtSetArg(uiArgs[i], XmNrightOffset, 0); i++;
867 loginFrame = XmCreateFrame(tmpLock, "loginFrame", uiArgs, i);
870 * create the login matte...
873 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
874 smDD.loginMatte[1] = XmCreateForm(loginFrame, "loginMatte", uiArgs, i);
877 * create the login/password forms
880 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
881 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
882 XtSetArg(uiArgs[i], XmNrightOffset, 15); i++;
883 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
884 XtSetArg(uiArgs[i], XmNbottomPosition, 50); i++;
885 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
886 XtSetArg(uiArgs[i], XmNleftOffset, 15); i++;
887 smDD.loginForm[1] = XmCreateForm(smDD.loginMatte[1], "loginForm", uiArgs, i);
890 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
891 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
892 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
893 XtSetArg(uiArgs[i], XmNtopPosition, 50); i++;
894 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
895 XtSetArg(uiArgs[i], XmNleftWidget, smDD.loginForm[1]); i++;
896 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
897 XtSetArg(uiArgs[i], XmNrightWidget, smDD.loginForm[1]); i++;
898 passwdForm = XmCreateForm(smDD.loginMatte[1], "passwdForm", uiArgs, i);
902 * create the login/password labels...
905 envLog = getenv("LOGNAME");
906 lockMessage = XtMalloc(100 + strlen(envLog));
909 ((char *)GETMESSAGE(18, 1, "Display locked by user %s.")), envLog);
910 lockString = XmStringCreateLocalized(lockMessage);
911 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
912 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
913 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
914 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
915 loginLabel = XmCreateLabelGadget(smDD.loginForm[1],
916 "loginLabel", uiArgs, i);
917 XtManageChild(loginLabel);
918 XmStringFree(lockString);
922 lockString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 2, "Enter password to unlock.")));
923 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
924 XtSetArg(uiArgs[i], XmNtopWidget, loginLabel); i++;
925 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_CENTER); i++;
926 XtSetArg(uiArgs[i], XmNlabelString, lockString); i++;
927 instructLabel = XmCreateLabelGadget(smDD.loginForm[1], "instructLabel",
929 XtManageChild(instructLabel);
930 XmStringFree(lockString);
933 passwordString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 3, "Password: ")));
934 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
935 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
936 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
937 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
938 XtSetArg(uiArgs[i], XmNleftOffset, 0); i++;
939 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
940 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
941 passwdLabel = XmCreateLabelGadget(passwdForm,
942 "passwdLabel", uiArgs, i);
943 XtManageChild(passwdLabel);
944 XmStringFree(passwordString);
947 * Give the password label an offset
950 XtSetArg(uiArgs[i], XmNwidth, &width);i++;
951 XtGetValues(passwdLabel, uiArgs, i);
955 XtSetArg(uiArgs[i], XmNwidth, width);i++;
956 XtSetArg(uiArgs[i], XmNrecomputeSize, False);i++;
957 XtSetValues(passwdLabel, uiArgs, i);
961 XtSetArg(uiArgs[i], XmNshadowType, XmSHADOW_IN); i++;
962 XtSetArg(uiArgs[i], XmNshadowThickness, 1); i++;
963 XtSetArg(uiArgs[i], XmNtopAttachment, XmATTACH_POSITION); i++;
964 XtSetArg(uiArgs[i], XmNtopPosition, 20); i++;
965 XtSetArg(uiArgs[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
966 XtSetArg(uiArgs[i], XmNbottomPosition, 80); i++;
967 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
968 XtSetArg(uiArgs[i], XmNleftWidget, passwdLabel); i++;
969 XtSetArg(uiArgs[i], XmNrightAttachment, XmATTACH_FORM); i++;
970 XtSetArg(uiArgs[i], XmNrightOffset, 10); i++;
971 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_END); i++;
972 indFrame = XmCreateFrame(passwdForm, "indFrame", uiArgs, i);
975 passwordString = XmStringCreateLocalized("|");
976 XtSetArg(uiArgs[i], XmNlabelString, passwordString); i++;
977 XtSetArg(uiArgs[i], XmNalignment, XmALIGNMENT_BEGINNING); i++;
978 smDD.indLabel[1] = XmCreateLabel(indFrame, "indLabel",
980 XtManageChild(smDD.indLabel[1]);
981 XmStringFree(passwordString);
984 XtSetArg(uiArgs[i], XmNhighlightColor, &focus_color); i++;
985 XtGetValues(indFrame, uiArgs, i);
986 XtVaSetValues ( smDD.indLabel[1],
988 XmNborderColor, focus_color,
991 * Manage forms AFTER all children have been managed
993 XtManageChild(indFrame);
994 XtManageChild(passwdForm);
995 XtManageChild(smDD.loginForm[1]);
996 XtManageChild(smDD.loginMatte[1]);
997 XtManageChild(loginPic);
998 XtManageChild(picFrame);
999 XtManageChild(loginFrame);
1006 /*************************************<->*************************************
1008 * CreateCoverDialog ()
1013 * Create the cover dialogs for all the screens
1028 *************************************<->***********************************/
1035 Widget tmpCover, table;
1036 char geomString[50];
1038 sprintf(geomString, "%dx%d+0+0",
1039 DisplayWidth(smGD.display, screenNum),
1040 DisplayHeight(smGD.display, screenNum));
1043 XtSetArg(uiArgs[i], XmNmwmDecorations, 0);i++;
1044 XtSetArg(uiArgs[i], XmNgeometry, (String) geomString);i++;
1045 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
1046 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
1047 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
1048 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
1049 XtSetArg(uiArgs[i], XmNdepth, DefaultDepth(smGD.display, screenNum));i++;
1050 XtSetArg(uiArgs[i], XmNscreen,
1051 ScreenOfDisplay(smGD.display, screenNum));i++;
1052 XtSetArg(uiArgs[i], XmNcolormap,
1053 DefaultColormap(smGD.display, screenNum));i++;
1054 tmpCover = XtCreatePopupShell("coverDialog", topLevelShellWidgetClass,
1055 smGD.topLevelWid, uiArgs, i);
1058 XtSetArg(uiArgs[i], XmNmarginWidth, 0); i++;
1059 XtSetArg(uiArgs[i], XmNmarginHeight, 0); i++;
1060 XtSetArg(uiArgs[i], XmNshadowThickness, 0); i++;
1061 XtSetArg(uiArgs[i], XmNheight,
1062 (Dimension) DisplayHeight(smGD.display, smGD.screen)); i++;
1063 XtSetArg(uiArgs[i], XmNwidth,
1064 (Dimension) DisplayWidth(smGD.display, smGD.screen)); i++;
1065 XtSetArg(uiArgs[i], XmNresizePolicy, XmRESIZE_NONE);i++;
1066 table = XmCreateDrawingArea(tmpCover, "drawArea", uiArgs, i);
1067 XtManageChild(table);
1068 smDD.coverDrawing[screenNum] = table;
1070 if(withLock == True)
1072 XtAddCallback (tmpCover, XmNpopupCallback,
1073 LockDialogUp, NULL);
1076 XtRealizeWidget(tmpCover);
1082 /*************************************<->*************************************
1089 * Callback that is called when user confirms the exit of a session by
1090 * pressing the OK button on the confirmation dialog. This routine just
1091 * facilitates the exit process.
1106 *************************************<->***********************************/
1110 XtPointer client_data,
1111 XtPointer call_data )
1113 ExitRecord *exitRec = (ExitRecord *)client_data;
1115 XtUnmanageChild(smDD.confExit);
1117 ImmediateExit(smSettings.startState, *exitRec->pmsg, exitRec->doSave);
1122 /*************************************<->*************************************
1129 * This process puts in motion the exit procedure, and then exits.
1134 * mode = Whether this session should be reset or restarted
1135 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
1136 * doSave - if True, the session will be saved.
1147 *************************************<->***********************************/
1158 * Turn off SIGTERM so we don't catch one in the middle of shutting
1161 #if !defined(SVR4) && !defined(sco)
1162 old = sigblock(sigmask(SIGTERM));
1163 sigblock(sigmask(SIGHUP));
1164 sigblock(sigmask(SIGPIPE));
1166 old = sighold(SIGTERM);
1171 if(smGD.bmsDead == False)
1173 notice = (Tt_message) tttk_message_create( NULL, TT_NOTICE, TT_SESSION, NULL,
1174 "XSession_Ending", NULL);
1175 tt_message_send( notice );
1176 tt_message_destroy( notice );
1179 tt_message_reply( msg );
1180 tt_message_destroy( msg );
1187 int sessionType = smGD.sessionType;
1188 XtIntervalId timerId;
1190 msg = (Tt_message) tttk_message_create( NULL, TT_NOTICE, TT_SESSION, NULL,
1191 "DtActivity_Beginning", NULL );
1192 tt_message_send( msg );
1193 tt_message_destroy( msg );
1195 if (smGD.sessionType == CURRENT_SESSION ||
1196 smGD.sessionType == DEFAULT_SESSION)
1197 SaveState (False, DtSM_CURRENT_STATE, SmSaveLocal, True,
1198 DEFAULT_INTERACT_STYLE, DEFAULT_FAST, DEFAULT_GLOBAL);
1199 else if (smGD.sessionType == HOME_SESSION &&
1200 smSettings.startState == DtSM_CURRENT_STATE)
1201 SaveState (False, DtSM_HOME_STATE, SmSaveLocal, True,
1202 DEFAULT_INTERACT_STYLE, DEFAULT_FAST, DEFAULT_GLOBAL);
1204 SaveState (False, DtSM_HOME_STATE, SmSaveGlobal, True,
1205 DEFAULT_INTERACT_STYLE, DEFAULT_FAST, DEFAULT_GLOBAL);
1208 * Restore sessionType - it may have been changed in SaveState
1210 smGD.sessionType = sessionType;
1212 XSync(smGD.display, 0);
1214 smGD.loggingOut = True;
1216 /* JET - set this here so we don't exit prematurely (while
1217 * handling our own SM exit callback - duh).
1219 smGD.ExitComplete = False;
1221 saveTimeout = False;
1222 timerId = XtAppAddTimeOut (smGD.appCon, smRes.saveYourselfTimeout,
1225 while (smXSMP.saveState.saveComplete == False &&
1226 smXSMP.saveState.shutdownCanceled == False) {
1229 XtAppNextEvent(smGD.appCon, &next);
1231 XtDispatchEvent(&next);
1235 /* JET - need this, since dtsession was exiting in the
1236 * XtAppNextEvent above (receiving it's own EXIT SM message) This
1237 * is checked in SmExit() so exit's will only occur after this
1238 * housekeeping has been completed.
1240 smGD.ExitComplete = True;
1242 if (smXSMP.saveState.shutdownCanceled == False) {
1244 * Run the user's exit script if there is one
1246 if (smGD.compatMode == False)
1248 StartEtc(True); /* run sessionexit */
1251 _DtReleaseLock(smGD.display, SM_RUNNING_LOCK);
1258 /*************************************<->*************************************
1265 * Called when the user bails out from a logout at the confirmation dialog
1270 * client_data - tells which dialog to unmange (the query or confirm exit)
1271 * msg -- if non-zero, Session_Exit request to reply/fail && destroy
1282 *************************************<->***********************************/
1286 XtPointer client_data,
1287 XtPointer call_data )
1289 ExitRecord *exitRec = (ExitRecord *)client_data;
1291 if(XtIsManaged(exitRec->u.exitCancelledDialog))
1293 XtUnmanageChild(exitRec->u.exitCancelledDialog);
1296 if(smDD.smHelpDialog && XtIsManaged(smDD.smHelpDialog))
1298 XtUnmanageChild(smDD.smHelpDialog);
1301 if (*exitRec->pmsg != 0) {
1302 tttk_message_fail(*exitRec->pmsg, TT_DESKTOP_ECANCELED, 0, 1 );
1309 /*************************************<->*************************************
1316 * Once the dialog is managed, but not popped up - reposition it so that
1317 * it appears in the middle of the screen then remove the popup callback
1331 * This routine can be used for any generic SYSTEM_MODAL dialog
1333 *************************************<->***********************************/
1337 XtPointer client_data,
1338 XtPointer call_data )
1341 Dimension width, height;
1345 * Get the size of the dialog box - then compute its position
1348 XtSetArg(uiArgs[i], XmNwidth, &width);i++;
1349 XtSetArg(uiArgs[i], XmNheight, &height);i++;
1350 XtGetValues(w, uiArgs, i);
1352 x = (DisplayWidth(smGD.display, smGD.screen) / 2) - (width / 2);
1353 y = (DisplayHeight(smGD.display, smGD.screen) / 2) - (height / 2);
1356 XtSetArg(uiArgs[i], XmNx, x);i++;
1357 XtSetArg(uiArgs[i], XmNy, y);i++;
1358 XtSetValues(w, uiArgs, i);
1360 XtRemoveCallback(w, XmNpopupCallback, DialogUp, NULL);
1366 /*************************************<->*************************************
1368 * ShowWaitState (flag)
1373 * Enter/Leave the wait state.
1378 * flag = TRUE for Enter, FALSE for Leave.
1388 * Stolen from the window manager code.
1390 *************************************<->***********************************/
1398 XGrabPointer (smGD.display, DefaultRootWindow(smGD.display), FALSE,
1399 0, GrabModeAsync, GrabModeAsync, None,
1400 smGD.waitCursor, CurrentTime);
1401 XGrabKeyboard (smGD.display, DefaultRootWindow(smGD.display), FALSE,
1402 GrabModeAsync, GrabModeAsync, CurrentTime);
1406 XUngrabPointer (smGD.display, CurrentTime);
1407 XUngrabKeyboard (smGD.display, CurrentTime);
1409 XSync(smGD.display, 0);
1413 /*************************************<->*************************************
1420 * This function determines whether a server supports large cursors. It it
1421 * does large feedback cursors are used in some cases (wait state and
1422 * system modal state); otherwise smaller (16x16) standard cursors are used.
1426 * Returns true if large cursors are supported, false otherwise
1430 * This code was stolen from the window manager
1432 *************************************<->***********************************/
1434 InitCursorInfo( void )
1436 unsigned int cWidth;
1437 unsigned int cHeight;
1439 if (XQueryBestCursor (smGD.display, DefaultRootWindow(smGD.display),
1440 32, 32, &cWidth, &cHeight))
1442 if ((cWidth >= 32) && (cHeight >= 32))
1453 /*************************************<->*************************************
1460 * Once the lock dialog is managed, but not popped up - reposition it so that
1461 * it appears in the middle of the screen then remove the popup callback
1476 *************************************<->***********************************/
1480 XtPointer client_data,
1481 XtPointer call_data )
1485 Dimension width, height; /* size values returned by XtGetValues */
1486 Dimension shadowThickness;/* size values returned by XtGetValues */
1489 { /* position, size of widgets (pixels) */
1494 } mw; /* matte, logo, drop shadow & login matte */
1496 int width1, width2; /* general width variable */
1497 int x1, y1; /* general position variables */
1501 * The partial cover has widgets of index 0 - the cover has
1504 if(smGD.coverScreen == True)
1514 * - center the main matte horizontally and vertically...
1517 XtSetArg(uiArgs[i], XmNwidth, &width); i++;
1518 XtSetArg(uiArgs[i], XmNheight, &height); i++;
1519 XtSetArg(uiArgs[i], XmNshadowThickness, &shadowThickness); i++;
1520 XtGetValues(smDD.matte[index], uiArgs, i);
1522 mw.shadow = shadowThickness;
1525 mw.x = (DisplayWidth(smGD.display, smGD.screen) - mw.width)/2;
1526 mw.y = (DisplayHeight(smGD.display, smGD.screen) - mw.height)/2;
1528 if ( mw.x < 0 ) mw.x = 0;
1529 if ( mw.y < 0 ) mw.y = 0;
1536 XtSetArg(uiArgs[i], XmNx, x1); i++;
1537 XtSetArg(uiArgs[i], XmNy, y1); i++;
1539 XtSetValues(smDD.matte[index], uiArgs, i);
1542 * - center the login/password frames horizontally in the login_matte...
1544 XtSetArg(uiArgs[0], XmNwidth, &width);
1545 XtGetValues(smDD.loginMatte[index], uiArgs, 1);
1546 width1 = (int)width;
1548 XtSetArg(uiArgs[0], XmNwidth, &width);
1549 XtGetValues(smDD.loginForm[index], uiArgs, 1);
1550 width2 = (int)width;
1553 XtSetArg(uiArgs[i], XmNleftAttachment, XmATTACH_FORM); i++;
1554 XtSetArg(uiArgs[i], XmNleftOffset, (width1 - width2) / 2); i++;
1555 XtSetValues(smDD.loginForm[index], uiArgs, i);
1560 /*************************************<->*************************************
1567 * Simply dismiss a dialog. Does special process for a compatibility mode
1568 * logout dialog and when the bms won't start.
1573 * client_data - sends in the dialog to be dismissed.
1584 *************************************<->***********************************/
1588 XtPointer client_data,
1589 XtPointer call_data )
1591 Widget dismissDialog = (Widget) client_data;
1593 if(XtIsManaged(dismissDialog))
1595 XtUnmanageChild(dismissDialog);
1598 if(dismissDialog == smDD.compatExit)
1603 if(dismissDialog == smDD.noStart)
1607 if(dismissDialog == smDD.clientReasons)
1609 reasonsDialogOK = True;
1615 /*************************************<->*************************************
1617 * UpdatePasswdField ()
1622 * Give the visual feedback neccessary when the user is entering a password
1627 * numChars = number of characters entered into the field
1638 *************************************<->***********************************/
1644 char passwdMessage[25];
1650 strcpy(passwdMessage, "|");
1651 for(i = 1;i < numChars;i++)
1654 strcpy(passwdMessage, "|");
1656 strcat(passwdMessage, " ");
1658 strcat(passwdMessage, PASSWORD_INDICATOR);
1662 strcpy(passwdMessage, "|");
1665 tmpString = XmStringCreateLocalized (passwdMessage);
1668 * Set the index for the indLabel widget
1670 if(smGD.coverScreen == True)
1680 XtSetArg(uiArgs[i], XmNlabelString, tmpString); i++;
1681 XtSetValues(smDD.indLabel[index], uiArgs, i);
1683 XmStringFree(tmpString);
1688 /*************************************<->*************************************
1695 * When the BMS refuses to be started, warn the user about why dt is
1696 * crashing and then exit.
1711 *************************************<->***********************************/
1713 WarnNoStartup( void )
1716 XmString bmsNoStartString;
1721 bmsNoStartString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 76,
1722 "The DT messaging system could not be started.\n\n\
1723 To correct the problem:\n\n\
1724 1. Choose [OK] to return to the login screen.\n\n\
1725 2. Select Failsafe Session from the login screen's option\n\
1726 menu and log in.\n\n\
1727 3. Check to see that your hostname exists correctly in /etc/hosts if your\n\
1728 network has already been configured.\n\
1729 4. If your network has not yet been configured, make sure that /etc/hosts\n\
1730 has the following entry in it:\n\
1731 127.0.0.1 localhost \n\n\
1732 For additional information, see the CDE User's Guide.")));
1735 bmsNoStartString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 36,
1736 "The desktop messaging system could not be started.\n\n\
1737 To correct the problem:\n\n\
1738 1. Choose [OK] to return to the login screen.\n\n\
1739 2. Select Failsafe Session from the login screen's option\n\
1740 menu and log in.\n\n\
1741 3. Check to see that the desktop is properly installed,\n\
1742 the hostname is correct (/etc/hosts) and that the\n\
1743 network is properly configured.\n\n\
1744 For additional information, see the CDE User's Guide.")));
1748 * Now create the dialog box
1751 tmpString = GETMESSAGE(18, 37, "Action Required");
1752 XtSetArg(uiArgs[i], XmNmessageString, bmsNoStartString);i++;
1753 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
1754 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
1755 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
1756 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
1757 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
1758 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
1759 smDD.noStart = XmCreateWarningDialog(smGD.topLevelWid, "noStartDialog",
1762 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
1763 XtSetValues(XtParent(smDD.noStart), uiArgs, i);
1765 XtAddCallback (XtParent(smDD.noStart),
1766 XmNpopupCallback, DialogUp, NULL);
1767 XtUnmanageChild(XmMessageBoxGetChild(smDD.noStart,
1768 XmDIALOG_HELP_BUTTON));
1769 XtUnmanageChild(XmMessageBoxGetChild(smDD.noStart,
1770 XmDIALOG_CANCEL_BUTTON));
1773 * Now add in the callback and get out of here
1775 XtAddCallback (smDD.noStart, XmNokCallback,
1776 SimpleOK, smDD.noStart);
1777 XmStringFree(bmsNoStartString);
1779 XtManageChild(smDD.noStart);
1782 } /* END OF FUNCTION WarnNoStartup */
1787 /*************************************<->*************************************
1794 * Warn the user that a new .dtprofile has just been added to their $HOME
1795 * directory, indicating a need to edit it and their .login/.profile files.
1810 *************************************<->***********************************/
1812 WarnNewProfile( void )
1815 XmString newProfileString;
1818 newProfileString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 99,
1819 "The new file '.dtprofile' has been added to your home directory.\n\
1821 Follow the instructions in this file to ensure that when you log in\n\
1822 again your '.login' or '.profile' file will be activated and \n\
1823 that it will interact correctly with CDE. \n\
1825 For additional information, see the CDE Advanced User's and System\n\
1826 Administrator's Guide.")));
1830 * Now create the dialog box
1833 tmpString = GETMESSAGE(18, 37, "Action Required");
1834 XtSetArg(uiArgs[i], XmNmessageString, newProfileString);i++;
1835 XtSetArg(uiArgs[i], XmNallowShellResize, True); i++;
1836 XtSetArg(uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
1837 XtSetArg(uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
1838 XtSetArg(uiArgs[i], XmNtitle, tmpString); i++;
1839 XtSetArg(uiArgs[i], XmNokLabelString, smDD.okString); i++;
1840 XtSetArg(uiArgs[i], XmNautoUnmanage, False); i++;
1841 smDD.newProfile = XmCreateWarningDialog(smGD.topLevelWid,
1845 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
1846 XtSetValues(XtParent(smDD.newProfile), uiArgs, i);
1848 XtAddCallback (XtParent(smDD.newProfile),
1849 XmNpopupCallback, DialogUp, NULL);
1850 XtUnmanageChild(XmMessageBoxGetChild(smDD.newProfile,
1851 XmDIALOG_HELP_BUTTON));
1852 XtUnmanageChild(XmMessageBoxGetChild(smDD.newProfile,
1853 XmDIALOG_CANCEL_BUTTON));
1856 * Now add in the callback and get out of here
1858 XtAddCallback (smDD.newProfile, XmNokCallback,
1859 SimpleOK, smDD.newProfile);
1860 XmStringFree(newProfileString);
1862 XtManageChild(smDD.newProfile);
1865 } /* END OF FUNCTION WarnNewProfile */
1871 /*************************************<->*************************************
1873 * ConfirmSessionCreation () -
1884 * Returns True if the user says to continue the session; False otherwise
1885 * or if malloc fails;
1890 *************************************<->***********************************/
1892 ConfirmSessionCreation (
1898 XmString title_string;
1900 XmString cancel_string;
1901 XmString help_string;
1902 XmString msg_string;
1908 Dimension width, height;
1915 * Create temporary argv because the X toolkit may remove
1916 * pieces of the command line options.
1919 argv = (char **) XtMalloc (_argc * sizeof (char *));
1920 for (i = 0; i < _argc; i++)
1924 if (session_type == HOME_SESSION)
1925 pch1 = strdup ((char *) GETMESSAGE(18, 50, "Home"));
1927 pch1 = strdup ((char *) GETMESSAGE(18, 51, "Current"));
1929 PrintError(DtError, smNLS.cantMallocErrorString);
1933 pch2 = strdup ((char *) GETMESSAGE(18, 52,
1934 "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."));
1936 PrintError(DtError, smNLS.cantMallocErrorString);
1940 pch3 = XtMalloc (strlen (pch1) +
1941 strlen (XDisplayName (getenv("DISPLAY"))) +
1945 PrintError(DtError, smNLS.cantMallocErrorString);
1948 (void) sprintf (pch3, pch2, pch1, XDisplayName (getenv("DISPLAY")));
1951 * The X toolkit has not yet been initialized, so do it now.
1954 XtToolkitInitialize ();
1955 smGD.appCon = XtCreateApplicationContext();
1956 smGD.display = XtOpenDisplay(smGD.appCon, NULL, argv[0],
1957 SM_RESOURCE_CLASS, NULL, 0, &argc, argv);
1959 XtSetArg(args[j], XmNbackground,
1960 XBlackPixel(smGD.display, XDefaultScreen(smGD.display))); j++;
1961 XtSetArg(args[j], XmNmappedWhenManaged, False); j++;
1962 XtSetArg (args[j], XmNwidth, 1); j++;
1963 XtSetArg (args[j], XmNheight, 1); j++;
1964 tmp_widget = XtAppCreateShell (
1966 applicationShellWidgetClass,
1967 smGD.display, args, j);
1968 XtRealizeWidget(tmp_widget);
1971 * Create the compound strings for the confirmation dialog
1973 msg_string = XmStringCreateLocalized (pch3);
1974 title_string = XmStringCreateLocalized(pch3);
1976 ok_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 39, "OK")));
1977 cancel_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 40, "Cancel")));
1978 help_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 41, "Help")));
1980 free (pch1); free (pch2); XtFree (pch3);
1983 * Create the dialog box
1986 XtSetArg (uiArgs[i], XmNmessageString, msg_string); i++;
1987 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
1988 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
1989 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
1990 XtSetArg (uiArgs[i], XmNmappedWhenManaged, True); i++;
1991 XtSetArg (uiArgs[i], XmNtitle, title_string); i++;
1992 XtSetArg (uiArgs[i], XmNokLabelString, ok_string); i++;
1993 XtSetArg (uiArgs[i], XmNcancelLabelString, cancel_string); i++;
1994 XtSetArg (uiArgs[i], XmNhelpLabelString, help_string); i++;
1995 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
1997 smDD.confirmSession = XmCreateWarningDialog(
1998 tmp_widget, "confirmDialog", uiArgs, i);
2000 XtAddCallback (smDD.confirmSession, XmNokCallback,
2004 * Some help state is not yet initialized and the help
2005 * callback assumes it is so some initializations must
2008 smDD.smHelpDialog = NULL;
2009 smDD.okString = ok_string;
2010 smGD.topLevelWid = tmp_widget;
2012 XtAddCallback (smDD.confirmSession, XmNhelpCallback,
2013 TopicHelpRequested, HELP_CONFIRMATION_SESSION_STR);
2015 XtAddCallback (smDD.confirmSession, XmNcancelCallback,
2016 ConfirmCancelCB, NULL);
2018 XtManageChild(smDD.confirmSession);
2021 * Center the dialog on the display
2024 XtSetArg(uiArgs[i], XmNwidth, &width); i++;
2025 XtSetArg(uiArgs[i], XmNheight, &height); i++;
2026 XtGetValues(smDD.confirmSession, uiArgs, i);
2028 x = (DisplayWidth(smGD.display, XDefaultScreen(smGD.display)) / 2)
2030 y = (DisplayHeight(smGD.display, XDefaultScreen(smGD.display)) / 2)
2034 XtSetArg(uiArgs[i], XmNx, x); i++;
2035 XtSetArg(uiArgs[i], XmNy, y); i++;
2036 XtSetValues(smDD.confirmSession, uiArgs, i);
2038 XmStringFree (msg_string);
2039 XmStringFree (title_string);
2040 XmStringFree (cancel_string);
2041 XmStringFree (help_string);
2044 * Spin until the OK or Cancel CB is invoked
2046 confirmState = ConfirmationNone;
2048 XtAppNextEvent(smGD.appCon, &next);
2050 XtDispatchEvent(&next);
2051 if (confirmState == ConfirmationOK) {
2052 XtDestroyWidget (tmp_widget);
2053 XmStringFree (ok_string);
2056 else if (confirmState == ConfirmationCancel) {
2057 XtDestroyWidget (tmp_widget);
2058 XmStringFree (ok_string);
2065 /*************************************<->*************************************
2069 *************************************<->***********************************/
2073 XtPointer client_data,
2074 XtPointer call_data )
2076 XtUnmanageChild(smDD.confirmSession);
2077 confirmState = ConfirmationOK;
2081 /*************************************<->*************************************
2083 * ConfirmCancelCB ()
2085 *************************************<->***********************************/
2089 XtPointer client_data,
2090 XtPointer call_data )
2092 XtUnmanageChild(smDD.confirmSession);
2093 confirmState = ConfirmationCancel;
2097 /*************************************<->*************************************
2099 * PostXSMPFailureDialog () -
2110 * Returns True if the user says to continue the session; False otherwise
2111 * or if malloc fails;
2116 *************************************<->***********************************/
2118 PostXSMPFailureDialog (
2119 XSMPFailure failure_code,
2120 Boolean check_errorlog)
2124 XmString help_string;
2125 XmString msg_string;
2133 Dimension width, height;
2138 pch1 = strdup ((char *) GETMESSAGE(40, 1,
2139 "A session cannot be started because of the\nfollowing error:"));
2141 PrintError(DtError, smNLS.cantMallocErrorString);
2145 switch (failure_code) {
2146 case XSMP_FAILURE_SMS_INITIALIZE:
2147 pch2 = strdup ((char *) GETMESSAGE (40, 2,
2148 "SmsInitialize failed."));
2150 case XSMP_FAILURE_ICE_LISTEN:
2151 pch2 = strdup ((char *) GETMESSAGE (40, 3,
2152 "IceListenForConnections failed."));
2154 case XSMP_FAILURE_AUTHENTICATION:
2155 pch2 = strdup ((char *) GETMESSAGE (40, 4,
2156 "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."));
2158 case XSMP_FAILURE_ICE_ADD_WATCH:
2159 pch2 = strdup ((char *) GETMESSAGE (40, 5,
2160 "IceAddConnectionWatch failed."));
2162 case XSMP_FAILURE_ICE_COMPOSE_IDS:
2163 pch2 = strdup ((char *) GETMESSAGE (40, 6,
2164 "IceComposeNetworkIds failed."));
2166 case XSMP_FAILURE_MALLOC:
2167 pch2 = strdup ((char *) GETMESSAGE (40, 7,
2168 "Could not create the SESSION_MANAGER environment variable."));
2172 PrintError(DtError, smNLS.cantMallocErrorString);
2176 pch3 = strdup ((char *) GETMESSAGE(18, 70,
2177 "See the following for more information:"));
2179 PrintError(DtError, smNLS.cantMallocErrorString);
2183 pch4 = strdup ((char *) GETMESSAGE(18, 71,
2184 "CDE Advanced Users and System's Administration Guide"));
2186 PrintError(DtError, smNLS.cantMallocErrorString);
2190 error_file = XtMalloc(MAXPATHLEN+1);
2191 strcpy (error_file, "");
2193 /* JET - VU#497553 */
2198 if (home = getenv ("HOME"))
2200 len = strlen(home) +
2201 strlen(DtPERSONAL_CONFIG_DIRECTORY) +
2202 strlen(DtERRORLOG_FILE);
2204 if (len > MAXPATHLEN)
2205 error_file = XtRealloc(error_file, len + 1);
2207 sprintf (error_file, "%s/%s/%s", home,
2208 DtPERSONAL_CONFIG_DIRECTORY,
2213 pch5 = XtMalloc (strlen (pch1) + strlen (pch2) + strlen (pch3) + strlen (pch4) +
2214 strlen (error_file) + 15);
2216 PrintError(DtError, smNLS.cantMallocErrorString);
2219 (void) sprintf (pch5, "%s\n\n %s\n\n%s\n\n %s\n %s\n",
2220 pch1, pch2, pch3, pch4, error_file);
2225 * No top level widget has been created so must create one now.
2228 XtSetArg (args[j], XmNbackground, XBlackPixel(smGD.display,
2229 XDefaultScreen(smGD.display))); j++;
2230 XtSetArg (args[j], XmNmappedWhenManaged, False); j++;
2231 XtSetArg (args[j], XmNwidth, 1); j++;
2232 XtSetArg (args[j], XmNheight, 1); j++;
2234 smGD.topLevelWid = XtAppCreateShell (SM_RESOURCE_NAME,
2235 SM_RESOURCE_CLASS, applicationShellWidgetClass,
2236 smGD.display, args, j);
2238 XtRealizeWidget(smGD.topLevelWid);
2241 * Create the compound strings for the confirmation dialog
2243 msg_string = XmStringCreateLocalized (pch5);
2245 ok_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 39, "OK")));
2246 help_string = XmStringCreateLocalized(((char *) GETMESSAGE(18, 41, "Help")));
2248 free (pch1); free (pch2); free (pch3); free (pch4); XtFree (pch5);
2251 * Create the dialog box
2254 XtSetArg (uiArgs[i], XmNmessageString, msg_string); i++;
2255 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
2256 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
2257 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
2258 XtSetArg (uiArgs[i], XmNmappedWhenManaged, True); i++;
2259 XtSetArg (uiArgs[i], XmNokLabelString, ok_string); i++;
2260 XtSetArg (uiArgs[i], XmNhelpLabelString, help_string); i++;
2261 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
2263 smDD.confirmSession = XmCreateWarningDialog(
2264 smGD.topLevelWid, "confirmDialog", uiArgs, i);
2266 XtAddCallback (smDD.confirmSession, XmNokCallback,
2267 XSMPFailureOKCB, NULL);
2270 * Some help state is not yet initialized and the help
2271 * callback assumes it is so some initializations must
2274 smDD.smHelpDialog = NULL;
2275 smDD.okString = ok_string;
2277 XtAddCallback (smDD.confirmSession, XmNhelpCallback,
2278 TopicHelpRequested, HELP_XSMP_INIT_FAILURE_STR);
2280 XtUnmanageChild(XmMessageBoxGetChild(smDD.confirmSession,
2281 XmDIALOG_CANCEL_BUTTON));
2283 XtManageChild(smDD.confirmSession);
2286 * Center the dialog on the display
2289 XtSetArg(uiArgs[i], XmNwidth, &width); i++;
2290 XtSetArg(uiArgs[i], XmNheight, &height); i++;
2291 XtGetValues(smDD.confirmSession, uiArgs, i);
2293 x = (DisplayWidth(smGD.display, XDefaultScreen(smGD.display)) / 2)
2295 y = (DisplayHeight(smGD.display, XDefaultScreen(smGD.display)) / 2)
2299 XtSetArg(uiArgs[i], XmNx, x); i++;
2300 XtSetArg(uiArgs[i], XmNy, y); i++;
2301 XtSetValues(smDD.confirmSession, uiArgs, i);
2303 XmStringFree (msg_string);
2304 XmStringFree (help_string);
2307 * Spin until the OK CB is invoked
2310 XtAppNextEvent(smGD.appCon, &next);
2312 XtDispatchEvent(&next);
2317 /*************************************<->*************************************
2319 * XSMPFailureOKCB ()
2321 *************************************<->***********************************/
2325 XtPointer client_data,
2326 XtPointer call_data )
2328 XtUnmanageChild(smDD.confirmSession);
2335 /*************************************<->*************************************
2337 * PostSaveSessionErrorDialog
2341 * Let the user know that the Save_Session message does not have the
2342 * required data and the session will not be saved.
2350 *************************************<->***********************************/
2352 PostSaveSessionErrorDialog ( void )
2355 XmString messageString;
2358 if(smDD.saveSession == NULL)
2360 messageString = XmStringCreateLocalized (((char *) GETMESSAGE(18, 56,
2361 "The session cannot be saved because the required\n\
2362 'save_type' parameter was not in the message.\n\n\
2363 The session will not be saved.")));
2365 titleString = GETMESSAGE(18, 55, "Save Session Failure");
2368 XtSetArg (uiArgs[i], XmNmessageString, messageString); i++;
2369 XtSetArg (uiArgs[i], XmNallowShellResize, True); i++;
2370 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
2371 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
2372 XtSetArg (uiArgs[i], XmNtitle, titleString); i++;
2373 XtSetArg (uiArgs[i], XmNokLabelString, smDD.okString); i++;
2374 XtSetArg (uiArgs[i], XmNhelpLabelString, smDD.helpString); i++;
2375 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
2377 smDD.saveSession = XmCreateErrorDialog(smGD.topLevelWid,
2378 "sessionSaveDialog", uiArgs, i);
2381 XtSetArg (uiArgs[i], XmNuseAsyncGeometry, True);i++;
2382 XtSetArg (uiArgs[i], XmNmwmFunctions, 0);i++;
2383 XtSetArg (uiArgs[i], XmNmwmDecorations,
2384 (MWM_DECOR_TITLE | MWM_DECOR_BORDER)); i++;
2385 XtSetArg (uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
2387 XtSetValues(XtParent(smDD.saveSession), uiArgs, i);
2389 XtAddCallback (XtParent(smDD.saveSession),
2390 XmNpopupCallback, DialogUp, NULL);
2392 XtUnmanageChild (XmMessageBoxGetChild(smDD.saveSession,
2393 XmDIALOG_CANCEL_BUTTON));
2395 XtAddCallback (smDD.saveSession, XmNokCallback,
2396 SimpleOK, (XtPointer) smDD.saveSession);
2398 XtAddCallback (smDD.saveSession, XmNhelpCallback,
2399 TopicHelpRequested, HELP_SESSION_SAVE_ERROR_STR);
2401 XmStringFree(messageString);
2404 XtManageChild(smDD.saveSession);
2411 /*************************************<->*************************************
2413 * PostReasonsDialog - posts a Warning dialog on behalf of a client
2414 * that supplied a "reason" when it closed its connection
2422 *************************************<->***********************************/
2428 Boolean waitForResponse)
2432 XmString helpString;
2442 str1 = strdup ((char *) GETMESSAGE(40, 28,
2443 "Application '%s'\nexited for the following reason:\n\n%s"));
2445 PrintError(DtError, smNLS.cantMallocErrorString);
2449 for (i = 0, len = 0; i < numMsgs; i++)
2450 len += strlen (message[i]);
2452 str2 = XtMalloc (len + (numMsgs * 3) + 1);
2454 PrintError(DtError, smNLS.cantMallocErrorString);
2458 for (i = 0; i < numMsgs; i++) {
2459 strcat (str2, message[i]);
2460 strcat (str2, "\n");
2463 str3 = XtMalloc (strlen (str1) + strlen (str2) + strlen (progName) + 4);
2465 PrintError(DtError, smNLS.cantMallocErrorString);
2468 (void) sprintf (str3, str1, progName, str2);
2470 DtMsgLogMessage (smGD.programName, DtMsgLogWarning, str3);
2473 str1 = strdup ((char *) GETMESSAGE(40, 29,
2474 "Application Close Reasons"));
2476 PrintError(DtError, smNLS.cantMallocErrorString);
2480 msgString = XmStringCreateLocalized (str3);
2482 okString = XmStringCreateLocalized(((char *) GETMESSAGE(18, 39, "OK")));
2484 helpString = XmStringCreateLocalized(((char *) GETMESSAGE(18, 41, "Help")));
2487 * Create the dialog box
2490 XtSetArg (uiArgs[i], XmNmessageString, msgString); i++;
2491 XtSetArg (uiArgs[i], XmNallowShellResize, False); i++;
2492 XtSetArg (uiArgs[i], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); i++;
2493 XtSetArg (uiArgs[i], XmNmessageAlignment, XmALIGNMENT_BEGINNING); i++;
2494 XtSetArg (uiArgs[i], XmNmappedWhenManaged, True); i++;
2495 XtSetArg (uiArgs[i], XmNtitle, str1); i++;
2496 XtSetArg (uiArgs[i], XmNokLabelString, okString); i++;
2497 XtSetArg (uiArgs[i], XmNhelpLabelString, helpString); i++;
2498 XtSetArg (uiArgs[i], XmNautoUnmanage, False); i++;
2500 smDD.clientReasons = XmCreateWarningDialog(smGD.topLevelWid,
2501 "clientReasons", uiArgs, i);
2504 XtSetArg(uiArgs[i], XmNuseAsyncGeometry, True);i++;
2505 XtSetArg(uiArgs[i], XmNmwmFunctions, 0);i++;
2506 XtSetArg(uiArgs[i], XmNmwmDecorations,
2507 (MWM_DECOR_TITLE | MWM_DECOR_BORDER));i++;
2508 XtSetArg(uiArgs[i], XmNmwmInputMode, MWM_INPUT_SYSTEM_MODAL);i++;
2509 XtSetValues(XtParent(smDD.clientReasons), uiArgs, i);
2511 XtAddCallback (XtParent(smDD.clientReasons),
2512 XmNpopupCallback, DialogUp, NULL);
2514 XtUnmanageChild (XmMessageBoxGetChild (smDD.clientReasons,
2515 XmDIALOG_CANCEL_BUTTON));
2518 * Now add in the callback and get out of here
2520 XtAddCallback (smDD.clientReasons, XmNokCallback,
2521 SimpleOK, (XtPointer) smDD.clientReasons);
2523 XtAddCallback (smDD.clientReasons, XmNhelpCallback,
2524 TopicHelpRequested, HELP_APP_CLOSE_REASONS_STR);
2529 XmStringFree (msgString);
2530 XmStringFree (okString);
2531 XmStringFree (helpString);
2533 XtManageChild (smDD.clientReasons);
2536 * Spin until the OK callback is invoked. If a shutdown
2537 * is in progress, we don't want to return until the
2538 * user has acknowledged this message.
2540 reasonsDialogOK = False;
2541 if (waitForResponse) {
2543 XtAppNextEvent (smGD.appCon, &next);
2545 XtDispatchEvent(&next);
2546 if (reasonsDialogOK == True)
2553 /*************************************<->*************************************
2559 * Timeout procedure that is invoked when a save timer expires.
2567 *************************************<->***********************************/
2570 XtPointer client_data,
2575 if (smXSMP.saveState.shutdownCanceled == False) {
2577 * Run the user's exit script if there is one
2579 if (smGD.compatMode == False)
2580 StartEtc(True); /* run sessionexit */
2582 _DtReleaseLock(smGD.display, SM_RUNNING_LOCK);