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 /*****************************************************************************
29 ** Description: main Dtstyle program
32 ****************************************************************************
33 ************************************<+>*************************************/
34 /*$TOG: Main.c /main/16 1998/07/30 12:32:34 mgreess $*/
36 * (c) Copyright 1997, The Open Group
39 * (c) Copyright 1996 Digital Equipment Corporation.
40 * (c) Copyright 1990, 1993, 1996 Hewlett-Packard Company.
41 * (c) Copyright 1996 International Business Machines Corp.
42 * (c) Copyright 1996 Sun Microsystems, Inc.
43 * (c) Copyright 1996 Novell, Inc.
44 * (c) Copyright 1996 FUJITSU LIMITED.
45 * (c) Copyright 1996 Hitachi.
48 /*+++++++++++++++++++++++++++++++++++++++*/
50 /*+++++++++++++++++++++++++++++++++++++++*/
56 #ifndef NO_MESSAGE_CATALOG
57 # include <nl_types.h>
63 /* #include <sys/dir.h> */
65 #include <Xm/MwmUtil.h>
69 #include <Xm/MessageB.h>
71 #include <Dt/GetDispRes.h>
72 #include <Dt/EnvControlP.h>
73 #include <Dt/Message.h>
74 #include <Dt/SessionM.h>
75 #include <Dt/UserMsg.h>
77 #include <Dt/DtNlUtils.h>
81 #include "ColorMain.h"
82 #include "ColorFile.h"
86 /*+++++++++++++++++++++++++++++++++++++++*/
87 /* include extern functions */
88 /*+++++++++++++++++++++++++++++++++++++++*/
91 /*+++++++++++++++++++++++++++++++++++++++*/
93 /*+++++++++++++++++++++++++++++++++++++++*/
94 #define STYLE_LOCK "STYLE_LOCK"
95 #define SYS_FILE_SEARCH_PATH "DTPMSYSFILESEARCHPATH"
96 #define MAX_STR_LEN 128
98 /*+++++++++++++++++++++++++++++++++++++++*/
99 /* Internal Functions */
100 /*+++++++++++++++++++++++++++++++++++++++*/
103 static int ErrorHandler(
105 XErrorEvent *event ) ;
106 static int IOErrorHandler(
109 static void ToolkitErrorHandler(
111 static void errParentMap(
113 XtPointer client_data,
115 static void UnmanageCB(
117 XtPointer client_data,
118 XtPointer call_data) ;
119 static void DestroyCB(
121 XtPointer client_data,
122 XtPointer call_data) ;
123 static Boolean NewCreateD( XtPointer shell) ;
124 static Boolean NewAddTo( XtPointer shell) ;
125 static Boolean NewCreateTop1( XtPointer shell) ;
126 static Boolean NewCreateTop2( XtPointer shell) ;
127 static Boolean NewAddSysPath( XtPointer shell) ;
128 static Boolean NewAddDirectories( XtPointer shell) ;
129 static Boolean NewAddHomePath( XtPointer shell) ;
130 static Boolean NewReadPal( XtPointer shell) ;
131 static Boolean NewInitPal( XtPointer shell) ;
132 static Boolean NewAllocColor( XtPointer shell) ;
133 static Boolean NewBottomColor( XtPointer shell) ;
134 static Boolean NewCreateButtons( XtPointer shell) ;
136 extern void WaitChildDeath(void);
138 /*++++++++++++++++++++++++++++++++++++++*/
139 /* Internal Variables */
140 /*++++++++++++++++++++++++++++++++++++++*/
141 static XrmOptionDescRec option_list[] =
143 { "-session", "session", XrmoptionSepArg, NULL },
146 /*++++++++++++++++++++++++++++++++++++++*/
147 /* Global Variables */
148 /*++++++++++++++++++++++++++++++++++++++*/
152 /*+++++++++++++++++++++++++++++++++++++++++++*/
153 /*Misc functions all the dialogs use */
154 /*+++++++++++++++++++++++++++++++++++++++++++*/
156 /*+++++++++++++++++++++++++++++++++++++++++++*/
157 /* raise a dialog window above peer dialogs */
158 /* Needs the SHELL of the dialog, not the */
160 /*+++++++++++++++++++++++++++++++++++++++++++*/
165 static int changeMask = CWStackMode;
166 static XWindowChanges windowChanges = {0,0,0,0,0,NULL,Above};
168 XReconfigureWMWindow(style.display, dialogWin,
169 style.screenNum, changeMask, &windowChanges);
173 /************************************************************************
175 * - to be used with message dialogs (assumptions are being made that
176 * parent is dialog shell, and child is bb, due to Xm hacks for them)
177 * (eg. it sets bb x,y to 0,0 and parents x,y to x,y set for bb)
178 * - parent for positioning only (may not be real parent)
179 * - use client_data for parent... if NULL, use style.errParent if ok,
180 * - or main style.shell (makes this routine more generally usefull)
182 ************************************************************************/
186 XtPointer client_data,
187 XtPointer call_data )
194 /* figure out what to use as "visual" parent */
195 shell = (Widget)client_data;
198 if (!style.errParent || !XtParent(style.errParent) ||
199 !XtIsManaged(style.errParent))
202 shell = XtParent(style.errParent);
205 shell = XtParent(shell);
207 /* calculate new x,y to be centered in visualParent */
208 newX = XtX(shell) + XtWidth(shell)/2 - XtWidth(w)/2;
209 newY = XtY(shell) + XtHeight(shell)/2 - XtHeight(w)/2;
211 if (newX < 0) newX = 0;
212 if (newY < 0) newY = 0;
215 XtSetArg(args[n], XmNx, newX); n++;
216 XtSetArg(args[n], XmNy, newY); n++;
217 XtSetValues(w, args, n);
221 /*************************************************************/
223 /* Put up an error dialog and block until the user clicks OK */
224 /* by default, there is no cancel or help button, but the */
225 /* dialog is created with autoUnmanage false, and ok/cancel */
226 /* callbacks to do the unmanage, so that a help button can */
228 /*************************************************************/
232 Widget visualParent )
238 /* create the compound string */
239 style.tmpXmStr = CMPSTR(errString);
241 style.errParent = visualParent;
243 if (style.errDialog == NULL) /* create it */
245 ok = XmStringCreateLocalized(_DtOkString);
248 XtSetArg(args[n], XmNokLabelString, ok); n++;
249 XtSetArg(args[n], XmNmessageString, style.tmpXmStr); n++;
250 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
251 XtSetArg (args[n], XmNautoUnmanage, False); n++;
252 XtSetArg (args[n], XmNdefaultPosition, False); n++;
253 style.errDialog = XmCreateErrorDialog(style.shell,"ErrorNotice",args,n);
255 XtAddCallback (style.errDialog, XmNokCallback, UnmanageCB, NULL);
256 XtAddCallback (style.errDialog, XmNcancelCallback, UnmanageCB, NULL);
257 XtAddCallback (style.errDialog, XmNmapCallback, CenterMsgCB, NULL);
258 XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog,
259 XmDIALOG_CANCEL_BUTTON));
260 XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog,
261 XmDIALOG_HELP_BUTTON));
263 /* set the dialog shell parent title */
265 XtSetArg (args[n], XmNmwmInputMode,
266 MWM_INPUT_PRIMARY_APPLICATION_MODAL); n++;
267 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
268 XtSetArg (args[n], XmNtitle, ((char *)GETMESSAGE(2, 3, "Error"))); n++;
269 XtSetValues (XtParent(style.errDialog), args, n);
271 else /* change the string */
274 XtSetArg(args[n], XmNmessageString, style.tmpXmStr); n++;
275 XtSetValues (style.errDialog, args, n);
278 /* free the compound string */
279 XmStringFree (style.tmpXmStr);
281 if (XtIsManaged(style.errParent) || XtParent(style.errParent) == NULL)
283 XtManageChild(style.errDialog);
284 /* ring the bell (PM behavior) */
285 XBell(style.display, 0);
289 XtAddEventHandler(XtParent(style.errParent), StructureNotifyMask, 0,
290 (XtEventHandler)errParentMap, NULL);
300 XtPointer client_data,
303 if (event->type == MapNotify)
305 XtManageChild(style.errDialog);
306 /* ring the bell (PM behavior) */
307 XBell(style.display, 0);
308 XtRemoveEventHandler(XtParent(style.errParent), StructureNotifyMask,
309 0, (XtEventHandler)errParentMap, NULL);
313 /*********************************************************/
315 /* Put up a modeless info dialog. */
316 /* There is no cancel or help button. */
317 /* Dialog is created with autoUnmanage true. */
318 /* An ok callback is added which will destroy the dialog */
319 /* and optionally unmap the parent. */
320 /*********************************************************/
325 Boolean unmapParent )
329 static XmString ok = NULL;
332 /* create the compound string */
333 style.tmpXmStr = CMPSTR(infoString);
336 ok = CMPSTR(_DtOkString);
340 XtSetArg(args[n], XmNokLabelString, ok); n++;
341 XtSetArg(args[n], XmNmessageString, style.tmpXmStr); n++;
342 XtSetArg(args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
343 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
344 w = XmCreateInformationDialog(parent, "Notice", args, n);
347 XtAddCallback (w, XmNokCallback, DestroyCB, parent);
349 XtAddCallback (w, XmNokCallback, DestroyCB, NULL);
350 XtUnmanageChild ( XmMessageBoxGetChild(w, XmDIALOG_CANCEL_BUTTON) );
351 XtUnmanageChild ( XmMessageBoxGetChild(w, XmDIALOG_HELP_BUTTON) );
353 /* set the dialog shell parent title */
355 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
356 XtSetArg (args[n], XmNtitle, ((char *)GETMESSAGE(2, 2, "Notice"))); n++;
357 XtSetValues (XtParent(w), args, n);
359 /* free the compound string */
360 XmStringFree (style.tmpXmStr);
362 /* manage the info dialog */
368 /*++++++++++++++++++++++++++++++++++++++*/
370 /*++++++++++++++++++++++++++++++++++++++*/
374 XtPointer client_data,
375 XtPointer call_data )
381 /*++++++++++++++++++++++++++++++++++++++*/
383 /*++++++++++++++++++++++++++++++++++++++*/
387 XtPointer client_data,
388 XtPointer call_data )
390 XtDestroyWidget(XtParent(w));
391 if (client_data != NULL)
392 XtUnmanageChild((Widget)client_data);
396 /**********************************************************/
398 /* move a dialog up so it isn't covering the main window */
399 /* Or down if there is no room up. */
400 /* note: "parent" needs to have valid x,y information... */
401 /* ex: a child of dialog shell doesn't, its parent */
402 /* does, so the parent shell would be passed in */
403 /**********************************************************/
410 Position newX, newY, pY, pX;
411 Dimension pHeight, myHeight, pWidth, myWidth;
416 pHeight = XtHeight(parent);
417 pWidth = XtWidth(parent);
418 myHeight = XtHeight(dialog);
419 myWidth = XtWidth(dialog);
421 if ((newY = pY - myHeight +5) < 0)
423 newX = pX + pWidth/2 - myWidth/2;
426 XtSetArg(args[n], XmNx, newX); n++;
427 XtSetArg(args[n], XmNy, newY); n++;
428 XtSetValues(dialog,args,n);
431 printf("newX, newY, pY, pX;\n");
432 printf("%d %d %d %d\n",newX, newY, pY, pX);
433 printf("pHeight, myHeight, pWidth, myWidth;\n");
434 printf("%d %d %d %d\n", pHeight, myHeight, pWidth, myWidth);
439 /*++++++++++++++++++++++++++++++++++++++*/
441 /*++++++++++++++++++++++++++++++++++++++*/
450 XPropertyEvent *pEvent=(XPropertyEvent *)&event;
452 Boolean useMaskRtn, useIconFileCacheRtn;
461 XtSetLanguageProc(NULL, NULL, NULL);
462 _DtEnvControl(DT_ENV_SET);
465 /* Initialize the toolkit and open the display */
467 XtInitialize(argv[0], XMCLASS, option_list, 1, (int *)&argc, argv);
470 _XmColorObjCreate(style.shell, NULL, NULL);
473 /* Allow all WS manipulation functions except resize and maximize */
474 mwmFunc = MWM_FUNC_ALL ^ (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
477 XtSetArg(args[n], XmNmwmFunctions, mwmFunc); n++;
478 XtSetArg(args[n], XmNuseAsyncGeometry, True); n++;
479 XtSetValues(style.shell, args, n);
481 /* initialize global style data */
483 style.display = XtDisplay(style.shell);
484 style.screen = DefaultScreenOfDisplay(style.display);
485 style.screenNum = DefaultScreen(style.display);
486 style.colormap = DefaultColormap(style.display, style.screenNum);
487 style.root = DefaultRootWindow(style.display);
488 style.execName = argv[0];
489 style.errDialog = NULL;
490 style.tmpXmStr = NULL;
491 style.home = (char *) XtMalloc(strlen((char *) getenv("HOME")) + 1);
492 strcpy(style.home, (char *) getenv("HOME"));
493 style.colorDialog = NULL;
494 style.backdropDialog = NULL;
495 style.fontDialog = NULL;
496 style.kbdDialog = NULL;
497 style.mouseDialog = NULL;
498 style.audioDialog = NULL;
499 style.screenDialog = NULL;
500 style.startupDialog = NULL;
501 style.dtwmDialog = NULL;
502 style.i18nDialog = NULL;
504 if (progName = DtStrrchr(argv[0], '/')) progName++;
505 else progName = argv[0];
507 /* Get the lock established to ensure only one dtstyle process
508 * is running per screen .. first malloc enough space*/
510 if (_DtGetLock (style.display, STYLE_LOCK) == 0)
512 _DtSimpleError (progName, DtError, NULL, "%s",
513 ((char *)GETMESSAGE(2, 5, "Style Manager is already running, second attempt aborted.")));
517 InitDtstyleProtocol();
518 SetWindowProperties();
520 /* Register error handlers */
521 XSetErrorHandler(ErrorHandler);
522 XSetIOErrorHandler(IOErrorHandler);
523 XtAppSetErrorHandler(XtWidgetToApplicationContext(style.shell),
524 ToolkitErrorHandler);
525 XtAddEventHandler(style.shell, StructureNotifyMask, 0,
526 (XtEventHandler)MwmReparentNotify, NULL);
528 /* set up resolution dependent layout variables */
529 switch (_DtGetDisplayResolution(style.display, style.screenNum))
531 case LOW_RES_DISPLAY:
532 style.horizontalSpacing =
533 style.verticalSpacing = 3;
536 case MED_RES_DISPLAY:
537 style.horizontalSpacing =
538 style.verticalSpacing = 5;
541 case HIGH_RES_DISPLAY:
542 style.horizontalSpacing =
543 style.verticalSpacing = 8;
547 GetApplicationResources();
549 XmeGetIconControlInfo(style.screen, &useMaskRtn,
550 &style.useMultiColorIcons, &useIconFileCacheRtn);
553 /* add the directory $HOME/.dt/backdrops */
555 string = (char *)XtMalloc(strlen(style.home) + strlen("/.dt/backdrops:") + 1);
556 sprintf(string, "%s/.dt/backdrops:", style.home);
558 dirs = (char *)XtCalloc(1, strlen("/etc/dt/backdrops:/usr/dt/backdrops") +
559 (style.xrdb.backdropDir == NULL ? 2 :
560 strlen(style.xrdb.backdropDir)) +
564 strcpy(dirs, string);
565 if (style.xrdb.backdropDir)
567 strcat(dirs, style.xrdb.backdropDir);
570 strcat(dirs, "/etc/dt/backdrops:/usr/dt/backdrops");
572 _DtWsmSetBackdropSearchPath(style.screen, dirs, style.useMultiColorIcons);
575 XtFree((char *)string);
578 XtFree((char *)dirs);
583 /* if this is started from save session we need to set up the BMS
584 first, otherwise do it after making the window. (for user perception
585 for how long it takes for the dtstyle to come up) */
586 if(style.xrdb.session != NULL) {
587 DtInitialize (style.display, style.shell, progName, progName);
588 /*Restore a session or build and display the main Window.*/
589 if(!restoreSession(style.shell,style.xrdb.session))
590 init_mainWindow(style.shell);
593 init_mainWindow(style.shell);
594 DtInitialize (style.display, style.shell, progName, progName);
596 CheckMonitor(style.shell);
597 GetDefaultPal(style.shell);
600 signal(SIGINT,(void (*)())activateCB_exitBtn);
601 signal(SIGTERM,(void (*)())activateCB_exitBtn);
603 /* to avoid defunct screen saver processes */
604 signal(SIGCHLD, (void (*)())WaitChildDeath);
606 /* backdrop dialog needs to know when the workspace changes to recolor
607 the bitmap displayed in the dialog */
608 ListenForWorkspaceChange();
610 /* if using COLOR builtin, style.workProcs is True */
612 if ((XmeUseColorObj() != FALSE) && style.workProcs)
614 XtAppAddWorkProc(XtWidgetToApplicationContext(style.shell),
615 NewCreateD, style.shell);
617 XtAppMainLoop(XtWidgetToApplicationContext(style.shell));
621 /************************************************************************
625 ************************************************************************/
632 #define _DTSTYLE_BUFSIZE 1024
633 char errmsg[_DTSTYLE_BUFSIZE];
635 _DtPrintDefaultErrorSafe(disp, event, errmsg, _DTSTYLE_BUFSIZE);
636 _DtSimpleError(progName, DtWarning, NULL, errmsg, NULL);
638 /* We do not want to exit here lets try to continue... */
643 /************************************************************************
647 ************************************************************************/
649 IOErrorHandler (display)
654 Warning ("X IO error occurred during generic operation");
663 /************************************************************************
665 * ToolkitErrorHandler
667 * All Xt memory allocation errors should fall through to this routine.
668 * There is no need to check for Xtmalloc errors where they are used.
670 ************************************************************************/
676 _DtSimpleError (progName, DtError, NULL,
677 GETMESSAGE(2, 6, "An X Toolkit error occurred... Exiting.\n"));
687 struct timeval first, second, lapsed;
690 gettimeofday(&first, &tzp);
693 /* Create the Dialog Box Dialog */
694 CreateDialogBoxD((Widget)shell);
697 gettimeofday(&second, &tzp);
698 if(first.tv_usec > second.tv_usec){
699 second.tv_usec += 1000000;
702 printf("CreateDialogBoxD elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
705 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewAddTo, shell);
715 struct timeval first, second, lapsed;
718 gettimeofday(&first, &tzp);
721 /* Create the Dialog Box Dialog */
725 gettimeofday(&second, &tzp);
726 if(first.tv_usec > second.tv_usec){
727 second.tv_usec += 1000000;
730 printf("AddToDialogBox elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
733 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewCreateTop1, shell);
743 struct timeval first, second, lapsed;
746 gettimeofday(&first, &tzp);
749 /* Create the top portion of the color dialog */
753 gettimeofday(&second, &tzp);
754 if(first.tv_usec > second.tv_usec){
755 second.tv_usec += 1000000;
758 printf("CreateTopColor1 elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
761 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewCreateTop2, shell);
770 struct timeval first, second, lapsed;
773 gettimeofday(&first, &tzp);
776 /* Create the top portion of the color dialog */
780 gettimeofday(&second, &tzp);
781 if(first.tv_usec > second.tv_usec){
782 second.tv_usec += 1000000;
785 printf("CreateTopColor2 elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
788 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewAddSysPath, shell);
798 struct timeval first, second, lapsed;
801 gettimeofday(&first, &tzp);
804 /* initialize the system directory */
808 gettimeofday(&second, &tzp);
809 if(first.tv_usec > second.tv_usec){
810 second.tv_usec += 1000000;
813 printf("AddSystemPath elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
816 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewAddDirectories, shell);
826 struct timeval first, second, lapsed;
829 gettimeofday(&first, &tzp);
832 /* initialize the directorys list in the resource */
833 if(style.xrdb.paletteDir != NULL)
834 AddDirectories(style.xrdb.paletteDir);
839 gettimeofday(&second, &tzp);
840 if(first.tv_usec > second.tv_usec){
841 second.tv_usec += 1000000;
844 printf("AddDirectories elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
847 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewAddHomePath, shell);
857 struct timeval first, second, lapsed;
860 gettimeofday(&first, &tzp);
863 /* initialize the home directory */
867 gettimeofday(&second, &tzp);
868 if(first.tv_usec > second.tv_usec){
869 second.tv_usec += 1000000;
872 printf("AddHomePath elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
875 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewReadPal, shell);
885 struct timeval first, second, lapsed;
888 gettimeofday(&first, &tzp);
891 /* Read in the palettes one at a time */
892 if (ReadPaletteLoop(True)) {
895 gettimeofday(&second, &tzp);
896 if(first.tv_usec > second.tv_usec){
897 second.tv_usec += 1000000;
900 printf("ReadPaletteLoop DONE elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
903 /* Stop work procs if no palettes found - fatal color error.
904 * When the color button is pressed, the regular processing
905 * will pick up on NumOfPalettes == 0 and post an error
908 if (NumOfPalettes == 0)
911 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewInitPal, shell);
916 gettimeofday(&second, &tzp);
917 if(first.tv_usec > second.tv_usec){
918 second.tv_usec += 1000000;
921 printf("ReadPaletteLoop NOT DONE elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
933 struct timeval first, second, lapsed;
936 gettimeofday(&first, &tzp);
939 /* initialize the palette list */
940 if(InitializePaletteList((Widget)shell, paletteList, True)) {
943 gettimeofday(&second, &tzp);
944 if(first.tv_usec > second.tv_usec){
945 second.tv_usec += 1000000;
948 printf("InitializePaletteList DONE elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
951 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewAllocColor, shell);
956 gettimeofday(&second, &tzp);
957 if(first.tv_usec > second.tv_usec){
958 second.tv_usec += 1000000;
961 printf("InitializePaletteList NOT DONE elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
972 struct timeval first, second, lapsed;
975 gettimeofday(&first, &tzp);
978 /* initialize pixels to the right color */
979 AllocatePaletteCells((Widget)shell);
982 gettimeofday(&second, &tzp);
983 if(first.tv_usec > second.tv_usec){
984 second.tv_usec += 1000000;
987 printf("AllocatePaletteCells elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
990 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewBottomColor, shell);
1000 struct timeval first, second, lapsed;
1001 struct timezone tzp;
1003 gettimeofday(&first, &tzp);
1006 /* Create the bottom portion of the color dialog */
1007 CreateBottomColor();
1010 gettimeofday(&second, &tzp);
1011 if(first.tv_usec > second.tv_usec){
1012 second.tv_usec += 1000000;
1015 printf("CreateBottomColor elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
1018 XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) shell), NewCreateButtons, shell);
1028 struct timeval first, second, lapsed;
1029 struct timezone tzp;
1031 gettimeofday(&first, &tzp);
1034 /* initialize pixels to the right color */
1035 CreatePaletteButtons(style.buttonsForm);
1038 gettimeofday(&second, &tzp);
1039 if(first.tv_usec > second.tv_usec){
1040 second.tv_usec += 1000000;
1043 printf("CreatePaletteButtons elapsed time is %ld seconds, %ld microseconds\n", second.tv_sec - first.tv_sec, second.tv_usec - first.tv_usec);
1049 /*************************************<->*************************************
1056 * When a SIGCHLD signal comes in, wait for all child processes to die.
1069 *************************************<->***********************************/
1071 WaitChildDeath( void )
1076 pid = wait(&stat_loc);
1077 signal(SIGCHLD,(void (*)())WaitChildDeath);