dtcm: Coverity 88353
[oweals/cde.git] / cde / programs / dtwm / WmResource.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* 
24  * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC. 
25  * ALL RIGHTS RESERVED 
26 */ 
27 /* 
28  * Motif Release 1.2.3
29 */ 
30 /*
31  * (c) Copyright 1987, 1988, 1989, 1990, 1993, 1994 HEWLETT-PACKARD COMPANY 
32  * (c) Copyright 1993, 1994 International Business Machines Corp.
33  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
34  * (c) Copyright 1993, 1994 Novell, Inc.
35  */
36
37 /*
38  * Included Files:
39  */
40
41 #include "WmGlobal.h"
42 #include "WmResNames.h"
43
44 #define MWM_NEED_IIMAGE
45 #include "WmIBitmap.h"
46
47 #include <stdio.h>
48
49 #include <Xm/XmP.h>
50 #include <Xm/RowColumn.h>
51 #include <Xm/ScreenP.h>         /* for XmGetXmScreen and screen.moveOpaque */
52
53 /*
54  * include extern functions
55  */
56 #include "WmResource.h"
57 #include "WmError.h"
58 #include "WmGraphics.h"
59 #include "WmMenu.h"
60 #include "WmResParse.h"
61 #include "WmBackdrop.h"
62 #include "WmIconBox.h"
63 #include "WmWrkspace.h"
64 #include <Dt/GetDispRes.h>
65 #define cfileP  (wmGD.pWmPB->pFile) /* fopen'ed configuration file or NULL */
66 #include "WmXSMP.h"
67
68 /*
69  * Function Declarations:
70  */
71 XmColorData *_WmGetDefaultColors ();
72
73 void _WmTopShadowPixmapDefault (Widget widget, int offset, XrmValue *value);
74 void _WmIconImageFDefault (Widget widget, int offset, XrmValue *value);
75 void _WmIconImageBDefault (Widget widget, int offset, XrmValue *value);
76 void _WmIconImageBSCDefault (Widget widget, int offset, XrmValue *value);
77 void _WmIconImageBSPDefault (Widget widget, int offset, XrmValue *value);
78 void _WmIconImageTSCDefault (Widget widget, int offset, XrmValue *value);
79 void _WmIconImageTSPDefault (Widget widget, int offset, XrmValue *value);
80 void _WmMatteFDefault (Widget widget, int offset, XrmValue *value);
81 void _WmMatteBDefault (Widget widget, int offset, XrmValue *value);
82 void _WmMatteBSCDefault (Widget widget, int offset, XrmValue *value);
83 void _WmMatteBSPDefault (Widget widget, int offset, XrmValue *value);
84 void _WmMatteTSCDefault (Widget widget, int offset, XrmValue *value);
85 void _WmMatteTSPDefault (Widget widget, int offset, XrmValue *value);
86 void _WmBackgroundDefault (Widget widget, int offset, XrmValue *value);
87 void _WmForegroundDefault (Widget widget, int offset, XrmValue *value);
88 void _WmBackgroundPixmapDefault (Widget widget, int offset, XrmValue *value);
89 void _WmBottomShadowColorDefault (Widget widget, int offset, XrmValue *value);
90 void _WmTopShadowColorDefault (Widget widget, int offset, XrmValue *value);
91 void _WmABackgroundDefault (Widget widget, int offset, XrmValue *value);
92 void _WmAForegroundDefault (Widget widget, int offset, XrmValue *value);
93 void _WmABackgroundPixmapDefault (Widget widget, int offset, XrmValue *value);
94 void _WmABottomShadowColorDefault (Widget widget, int offset, XrmValue *value);
95 void _WmATopShadowColorDefault (Widget widget, int offset, XrmValue *value);
96 void _WmATopShadowPixmapDefault (Widget widget, int offset, XrmValue *value);
97 void _WmFocusAutoRaiseDefault (Widget widget, int offset, XrmValue *value);
98 void _WmMultiClickTimeDefault (Widget widget, int offset, XrmValue *value);
99 void ProcessWmResources (void);
100 void ProcessGlobalScreenResources (void);
101 void SetStdGlobalResourceValues (void);
102 void ProcessScreenListResource (void);
103 void ProcessAppearanceResources (WmScreenData *pSD);
104 void MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean makeActiveResources);
105 void GetAppearanceGCs (WmScreenData *pSD, Pixel fg, Pixel bg, XFontStruct *font, Pixmap bg_pixmap, Pixel ts_color, Pixmap ts_pixmap, Pixel bs_color, Pixmap bs_pixmap, GC *pGC, GC *ptsGC, GC *pbsGC);
106 void ProcessScreenResources (WmScreenData *pSD, unsigned char *screenName);
107 void ProcessWorkspaceResources (WmWorkspaceData *pWS);
108 void ProcessClientResources (ClientData *pCD);
109 void SetStdClientResourceValues (ClientData *pCD);
110 void SetStdScreenResourceValues (WmScreenData *pSD);
111 GC GetHighlightGC (WmScreenData *pSD, Pixel fg, Pixel bg, Pixmap pixmap);
112 static void WriteOutXrmColors (WmScreenData *pSD);
113 void ProcessPresenceResources (WmScreenData *pSD);
114 void ProcessDefaultBackdropImages (WmScreenData *pSD);
115 void _WmBackdropBgDefault (Widget widget, int offset, XrmValue *value);
116 void _WmBackdropFgDefault (Widget widget, int offset, XrmValue *value);
117 void _WmBackdropColorSetDefault (Widget widget, int offset, XrmValue *value);
118 void _WmIconImageMaximumDefault (Widget widget, int offset, XrmValue *value);
119 void _WmSecondariesOnTopDefault (Widget widget, int offset, XrmValue *value);
120 int DefaultWsColorSetId (WmWorkspaceData *pWS);
121 void _WmGetDynamicDefault (Widget widget, unsigned char type, String defaultColor, Pixel newBackground, XrmValue *value);
122 Boolean SimilarAppearanceData (AppearanceData *pAD1, AppearanceData *pAD2);
123
124
125
126 /*
127  * Global Variables:
128  */
129
130 /* builtin window menu specification */
131
132 #ifndef NO_MESSAGE_CATALOG
133 /*
134  * Use the same name as builtin to let the message catalog menu
135  * take precedence over any menus that might match in sys.mwmrc
136  */
137 char defaultSystemMenuName[] = "_MwmWindowMenu_";
138 #else
139 char defaultSystemMenuName[] = "DefaultWindowMenu";
140 #endif  /* NO_MESSAGE_CATALOG */
141 char builtinSystemMenuName[] = "_MwmWindowMenu_";
142 #ifndef MCCABE
143 #define BUILTINSYSTEMMENU "_MwmWindowMenu_\n\
144 {\n\
145         Restore         _R      Alt<Key>F5      f.restore\n\
146         Move            _M      Alt<Key>F7      f.move\n\
147         Size            _S      Alt<Key>F8      f.resize\n\
148         Minimize        _n      Alt<Key>F9      f.minimize\n\
149         Maximize        _x      Alt<Key>F10     f.maximize\n\
150         Lower           _L      Alt<Key>F3      f.lower\n\
151         no-label                                f.separator\n\
152         Close           _C      Alt<Key>F4      f.kill\n\
153 }"
154 #ifdef NO_MESSAGE_CATALOG
155 char builtinSystemMenu[] = BUILTINSYSTEMMENU;
156 #else /* !defined(NO_MESSAGE_CATALOG)*/
157 char *builtinSystemMenu = BUILTINSYSTEMMENU;
158
159 #define DEFAULT_DTWM_SYSTEMMENU "_MwmWindowMenu_\n\
160 {\n\
161         Restore         _R      f.restore\n\
162         Move            _M      f.move\n\
163         Size            _S      f.resize\n\
164         Minimize        _n      f.minimize\n\
165         Maximize        _x      f.maximize\n\
166         Lower           _L      f.lower\n\
167         no-label                f.separator\n\
168       \"Occupy Workspace...\"   _O      f.workspace_presence\n\
169       \"Occupy All Workspaces\" _A      f.occupy_all\n\
170       \"Unoccupy Workspace\"    _U      f.remove\n\
171         no-label                        f.separator\n\
172         Close   _C      Alt<Key>F4      f.kill\n\
173 }"
174
175 void InitBuiltinSystemMenu(void)
176 {
177     char * tmpString;
178     char *ResString = NULL;
179     char *MovString = NULL;
180     char *SizString = NULL;
181     char *MinString = NULL;
182     char *MaxString = NULL;
183     char *LowString = NULL;
184     char *OcpString = NULL;
185     char *OcaString = NULL;
186     char *RemString = NULL;
187     char *CloString = NULL;
188     char dsm[2048];
189     char dsmtemp[sizeof(dsm)];
190     Boolean gotItAll;
191     gotItAll = True;
192     if(gotItAll)
193     {
194 #ifdef sun
195         tmpString = ((char *)GETMESSAGE(62, 60, "Restore _R  Alt<Key>F5 f.restore"));
196 #else
197         tmpString = ((char *)GETMESSAGE(62, 49, "Restore _R  f.restore"));
198 #endif
199         if ((ResString =
200              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
201         {
202             Warning (((char *)GETMESSAGE(62, 2, "Insufficient memory for local default menu.")));
203             gotItAll = False;
204         }
205         else
206         {
207             strcpy(ResString, tmpString);
208         }
209     }
210     if(gotItAll)
211     {
212 #ifdef sun
213         tmpString = ((char *)GETMESSAGE(62, 61, "Move _M  Alt<Key>F7 f.move"));
214 #else
215         tmpString = ((char *)GETMESSAGE(62, 50, "Move _M  f.move"));
216 #endif
217         if ((MovString =
218              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
219         {
220             Warning (((char *)GETMESSAGE(62, 4, "Insufficient memory for local default menu.")));
221             gotItAll = False;
222         }
223         else
224         {
225             strcpy(MovString, tmpString);
226         }
227     }
228     if(gotItAll)
229     {
230 #ifdef sun
231         tmpString = ((char *)GETMESSAGE(62, 62, "Size _S  Alt<Key>F8 f.resize"));
232 #else
233         tmpString = ((char *)GETMESSAGE(62, 51, "Size _S  f.resize"));
234 #endif
235         if ((SizString =
236              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
237         {
238             Warning (((char *)GETMESSAGE(62, 6, "Insufficient memory for local default menu.")));
239             gotItAll = False;
240         }
241         else
242         {
243             strcpy(SizString, tmpString);
244         }
245     }
246     if(gotItAll)
247     {
248 #ifdef sun
249         tmpString = ((char *)GETMESSAGE(62, 63, "Minimize _n  Alt<Key>F9 f.minimize"));
250 #else
251         tmpString = ((char *)GETMESSAGE(62, 52, "Minimize _n  f.minimize"));
252 #endif
253         if ((MinString =
254              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
255         {
256             Warning (((char *)GETMESSAGE(62, 8, "Insufficient memory for local default menu.")));
257             gotItAll = False;
258         }
259         else
260         {
261             strcpy(MinString, tmpString);
262         }
263     }
264     if(gotItAll)
265     {
266 #ifdef sun
267         tmpString = ((char *)GETMESSAGE(62, 64, "Maximize _x  Alt<Key>F10 f.maximize"));
268 #else
269         tmpString = ((char *)GETMESSAGE(62, 53, "Maximize _x  f.maximize"));
270 #endif
271         if ((MaxString =
272              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
273         {
274             Warning (((char *)GETMESSAGE(62, 10, "Insufficient memory for local default menu.")));
275             gotItAll = False;
276         }
277         else
278         {
279             strcpy(MaxString, tmpString);
280         }
281     }
282     if(gotItAll)
283     {
284 #ifdef sun
285         tmpString = ((char *)GETMESSAGE(62, 65, "Lower _L  Alt<Key>F3 f.lower"));
286 #else
287         tmpString = ((char *)GETMESSAGE(62, 54, "Lower _L  f.lower"));
288 #endif
289         if ((LowString =
290              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
291         {
292             Warning (((char *)GETMESSAGE(62, 12, "Insufficient memory for local default menu.")));
293             gotItAll = False;
294         }
295         else
296         {
297             strcpy(LowString, tmpString);
298         }
299     }
300
301     if (DtwmBehavior)
302     {
303         if(gotItAll)
304         {
305             tmpString = ((char *)GETMESSAGE(62, 55, "Occupy\\ Workspace\\.\\.\\. _O  f.workspace_presence"));
306             if ((OcpString =
307                  (char *)XtMalloc ((unsigned int) 
308                                  (strlen(tmpString) + 1))) == NULL)
309             {
310                 Warning (((char *)GETMESSAGE(62, 14, "Insufficient memory for local default menu.")));
311                 gotItAll = False;
312             }
313             else
314             {
315                 strcpy(OcpString, tmpString);
316             }
317         }
318         if(gotItAll)
319         {
320             tmpString = ((char *)GETMESSAGE(62, 56, "Occupy\\ All\\ Workspaces _A  f.occupy_all"));
321             if ((OcaString =
322                  (char *)XtMalloc ((unsigned int) 
323                                  (strlen(tmpString) + 1))) == NULL)
324             {
325                 Warning (((char *)GETMESSAGE(62, 16, "Insufficient memory for local default menu.")));
326                 gotItAll = False;
327             }
328             else
329             {
330                 strcpy(OcaString, tmpString);
331             }
332         }
333         if(gotItAll)
334         {
335             tmpString = ((char *)GETMESSAGE(62, 57, "Unoccupy\\ Workspace _U  f.remove"));
336             if ((RemString =
337                  (char *)XtMalloc ((unsigned int) 
338                                  (strlen(tmpString) + 1))) == NULL)
339             {
340                 Warning (((char *)GETMESSAGE(62, 18, "Insufficient memory for local default menu.")));
341                 gotItAll = False;
342             }
343             else
344             {
345                 strcpy(RemString, tmpString);
346             }
347         }
348     } /* if DTWM */
349
350     if(gotItAll)
351     {
352         tmpString = ((char *)GETMESSAGE(62, 48, "Close _C Alt<Key>F4 f.kill"));
353         if ((CloString =
354              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
355         {
356             Warning (((char *)GETMESSAGE(62, 20, "Insufficient memory for local default menu.")));
357             gotItAll = False;
358         }
359         else
360         {
361             strcpy(CloString, tmpString);
362         }
363     }
364
365     if (!gotItAll)
366     {
367         if (DtwmBehavior)
368         {
369             builtinSystemMenu = (char *) 
370                         XtNewString((String)DEFAULT_DTWM_SYSTEMMENU);
371         }
372         else
373         {
374             builtinSystemMenu = (char *) 
375                         XtNewString((String)BUILTINSYSTEMMENU);
376         }
377     }
378     else
379     {
380         /* put it together */
381         snprintf(dsm, sizeof(dsm), "%s\n{\n%s\n%s\n%s\n%s\n%s\n%s\n no-label  f.separator\n",
382                  defaultSystemMenuName, ResString, MovString,
383                  SizString, MinString, MaxString, LowString);
384         if (DtwmBehavior)
385         {
386             snprintf(dsmtemp, sizeof(dsmtemp), "%s%s\n%s\n%s\n no-label  f.separator\n",
387                      dsm, OcpString, OcaString, RemString);
388             strcpy(dsm, dsmtemp);
389         }
390         snprintf(dsmtemp, sizeof(dsmtemp), "%s%s\n}", dsm, CloString);
391         strcpy(dsm, dsmtemp);
392         
393         if ((builtinSystemMenu =
394              (char *)XtMalloc ((unsigned int) (strlen(dsm) + 1))) == NULL)
395         {
396            Warning (((char *)GETMESSAGE(62, 21, "Insufficient memory for localized default system menu")));
397             if (DtwmBehavior)
398             {
399                 builtinSystemMenu = (char *) 
400                         XtNewString((String)DEFAULT_DTWM_SYSTEMMENU);
401             }
402             else
403             {
404                 builtinSystemMenu = (char *) 
405                         XtNewString((String)BUILTINSYSTEMMENU);
406             }
407         }
408         else
409         {
410             strcpy(builtinSystemMenu, dsm);
411         }
412     }
413
414     if (ResString != NULL)
415        XtFree(ResString);
416     if (MovString != NULL)
417        XtFree(MovString);
418     if (SizString != NULL)
419        XtFree(SizString);
420     if (MinString != NULL)
421        XtFree(MinString);
422     if (MaxString != NULL)
423        XtFree(MaxString);
424     if (LowString != NULL)
425        XtFree(LowString);
426     if (OcpString != NULL)
427        XtFree(OcpString);
428     if (OcaString != NULL)
429        XtFree(OcaString);
430     if (RemString != NULL)
431        XtFree(RemString);
432     if (CloString != NULL)
433        XtFree(CloString);
434     
435 } /* END OF FUNCTION  InitBuiltinSystemMenu */
436 #endif /* NO_MESSAGE_CATALOG */
437 #else /* MCCABE */
438 char builtinSystemMenu[];
439 #endif /* MCCABE */
440
441 #define HARD_CODED_PRIMARY   3
442 char defaultRootMenuName[] = "DefaultRootMenu";
443 char builtinRootMenuName[] = "_MwmRootMenu_";
444 #ifndef MCCABE
445 #define BUILTINROOTMENU "DefaultRootMenu\n\
446 {\n\
447         \"Root Menu\"           f.title\n\
448         \"New Window\"          f.exec \"xterm &\"\n\
449         \"Shuffle Up\"          f.circle_up\n\
450         \"Shuffle Down\"        f.circle_down\n\
451         \"Refresh\"             f.refresh\n\
452         \"Pack Icons\"          f.pack_icons\n\
453          no-label               f.separator\n\
454         \"Restart...\"          f.restart\n\
455 }";
456 char builtinRootMenu[] = BUILTINROOTMENU
457 #else /* MCCABE */
458 char builtinRootMenu[];
459 #endif /* MCCABE */
460
461
462 /* builtin key bindings specification */
463
464 char defaultKeyBindingsName[] = "DefaultKeyBindings";
465 char builtinKeyBindingsName[] = "_MwmKeyBindings_";
466 #ifndef MCCABE
467 #define BUILTINKEYBINDINGS "_MwmKeyBindings_\n\
468 {\n\
469         Shift<Key>Escape        window|icon             f.post_wmenu\n\
470         Alt<Key>space           window|icon             f.post_wmenu\n\
471         Alt<Key>Tab             root|icon|window        f.next_key\n\
472         Alt Shift<Key>Tab       root|icon|window        f.prev_key\n\
473         Alt<Key>Escape          root|icon|window        f.circle_down\n\
474         Alt Shift<Key>Escape    root|icon|window        f.circle_up\n\
475         Alt Shift Ctrl<Key>exclam root|icon|window      f.set_behavior\n\
476         Alt Ctrl<Key>1            root|icon|window      f.set_behavior\n\
477         Alt<Key>F6              window                  f.next_key transient\n\
478         Alt Shift<Key>F6        window                  f.prev_key transient\n\
479         Shift<Key>F10           icon                    f.post_wmenu\n\
480 }";
481 char builtinKeyBindings[] = BUILTINKEYBINDINGS
482
483 #else
484 char builtinKeyBindings[];
485 #endif
486
487 /*
488  * NOTE: Default Toggle Behavior key bindings.  There are TWO key bindings as
489  * of 1.1.4 and 1.2.  Make sure you make any modify builtinKeyBindings (above)
490  * whenever modifying behaviorKeyBindings.
491  */
492
493 char behaviorKeyBindingName[] = "_MwmBehaviorKey_";
494 #ifndef MCCABE
495 #define BEHAVIORKEYBINDINGS "_MwmBehaviorKey_\n\
496 {\n\
497         Alt Shift Ctrl<Key>exclam root|icon|window      f.set_behavior\n\
498         Alt Ctrl<Key>1            root|icon|window      f.set_behavior\n\
499 }";
500 char behaviorKeyBindings[] = BEHAVIORKEYBINDINGS
501
502 #else
503 char behaviorKeyBindings[];
504 #endif
505
506
507 /* default button bindings specification */
508 /* note - the %s will be replaced by the real DefaultRootMenu */
509
510 char defaultButtonBindingsName[] = "DefaultButtonBindings";
511 char builtinButtonBindingsName[] = "_MwmButtonBindings_";
512 #ifndef MCCABE
513 # define BUILTINBUTTONBINDINGS "_MwmButtonBindings_\n\
514 {\n\
515         <Btn1Down>      icon|frame      f.raise\n\
516         <Btn3Down>      icon|frame      f.post_wmenu\n\
517         <Btn3Down>      root            f.menu DefaultRootMenu\n\
518 }";
519 char builtinButtonBindings[] = BUILTINBUTTONBINDINGS
520
521 #else
522 char builtinButtonBindings[];
523 #endif
524
525
526 static ClientData *_pCD;
527 static String _defaultBackground;
528 static String _defaultActiveBackground;
529 static AppearanceData *_pAppearanceData;
530 static WmWorkspaceData *pResWS;
531 static WmScreenData *pResSD;
532
533 static char _defaultColor1HEX[] = "#A8A8A8A8A8A8";
534 static char _defaultColor2HEX[] = "#5F5F92929E9E";
535
536 static char _defaultColor1[] = "LightGrey";
537 static char _defaultColor2[] = "CadetBlue";
538 #define DEFAULT_COLOR_NONE      NULL
539
540 Const char _foreground[]    = "foreground";
541 Const char _75_foreground[] = "75_foreground";
542 Const char _50_foreground[] = "50_foreground";
543 Const char _25_foreground[] = "25_foreground";
544 Const char *_Dither = XmCO_DITHER;
545 Const char *_NoDither = XmCO_NO_DITHER;
546 Const char CLIENT_FRAME_PART[] = "client";
547 Const char ICON_FRAME_PART[] = "icon";
548 Const char FEEDBACK_FRAME_PART[] = "feedback";
549 Const char MENU_ITEM_PART[] = "menu";
550
551 #define WmBGC          XmBACKGROUND
552 #define WmFGC          XmFOREGROUND
553 #define WmTSC          XmTOP_SHADOW
554 #define WmBSC          XmBOTTOM_SHADOW
555
556 #define MAX_SHORT       0xffff
557
558 #ifndef BITMAPDIR
559 #define BITMAPDIR "/usr/include/X11/bitmaps/"
560 #endif
561
562 \f
563 /*************************************<->*************************************
564  *
565  *  wmGlobalResources
566  *
567  *
568  *  Description:
569  *  -----------
570  *  This data structure is used in the processing of mwm general
571  *  appearance and behavior resources.  These resources are specified
572  *  with the following syntax:
573  *
574  *      "Mwm*<resource_identifier>".
575  *
576  *************************************<->***********************************/
577
578
579 XtResource wmGlobalResources[] =
580 {
581
582     {
583         WmNautoKeyFocus,
584         WmCAutoKeyFocus,
585         XtRBoolean,
586         sizeof (Boolean),
587         XtOffsetOf(WmGlobalData, autoKeyFocus),
588         XtRImmediate,
589         (XtPointer)True
590     },
591
592     {
593         WmNautoRaiseDelay,
594         WmCAutoRaiseDelay,
595         XtRInt,
596         sizeof (int),
597         XtOffsetOf(WmGlobalData, autoRaiseDelay),
598         XtRImmediate,
599         (XtPointer)500
600     },
601
602     {
603         WmNbitmapDirectory,
604         WmCBitmapDirectory,
605         XtRString,
606         sizeof (String),
607         XtOffsetOf(WmGlobalData, bitmapDirectory),
608         XtRString,
609         (XtPointer)BITMAPDIR
610     },
611     {
612         WmNblinkOnExec,
613         WmCBlinkOnExec,
614         XtRBoolean,
615         sizeof (Boolean),
616         XtOffsetOf(WmGlobalData, blinkOnExec),
617         XtRImmediate,
618         (XtPointer)False
619     },
620     {
621         WmNframeStyle,
622         WmCFrameStyle,
623         WmRFrameStyle,
624         sizeof (FrameStyle),
625         XtOffsetOf(WmGlobalData, frameStyle),
626         XtRImmediate,
627         (XtPointer)WmRECESSED
628     },
629
630     {
631         WmNclientAutoPlace,
632         WmCClientAutoPlace,
633         XtRBoolean,
634         sizeof (Boolean),
635         XtOffsetOf(WmGlobalData, clientAutoPlace),
636         XtRImmediate,
637         (XtPointer)True
638     },
639
640     {
641         WmNcolormapFocusPolicy,
642         WmCColormapFocusPolicy,
643         WmRCFocusPolicy,
644         sizeof (int),
645         XtOffsetOf(WmGlobalData, colormapFocusPolicy),
646         XtRImmediate,
647         (XtPointer)CMAP_FOCUS_KEYBOARD
648     },
649
650     {
651         WmNconfigFile,
652         WmCConfigFile,
653         XtRString,
654         sizeof (String),
655         XtOffsetOf(WmGlobalData, configFile),
656         XtRImmediate,
657         (XtPointer)NULL
658     },
659
660     {
661         WmNcppCommand,
662         WmCCppCommand,
663         XtRString,
664         sizeof (String),
665         XtOffsetOf(WmGlobalData, cppCommand),
666         XtRImmediate,
667         (XtPointer)NULL
668     },
669
670     {
671         WmNdeiconifyKeyFocus,
672         WmCDeiconifyKeyFocus,
673         XtRBoolean,
674         sizeof (Boolean),
675         XtOffsetOf(WmGlobalData, deiconifyKeyFocus),
676         XtRImmediate,
677         (XtPointer)True
678     },
679
680     {
681         WmNdoubleClickTime,
682         WmCDoubleClickTime,
683         XtRInt,
684         sizeof (int),
685         XtOffsetOf(WmGlobalData, doubleClickTime),
686         XtRCallProc,
687         (XtPointer)_WmMultiClickTimeDefault
688     },
689
690     {
691         WmNenableWarp,
692         WmCEnableWarp,
693         XtRBoolean,
694         sizeof (Boolean),
695         XtOffsetOf(WmGlobalData, enableWarp),
696         XtRImmediate,
697         (XtPointer)True
698     },
699
700     {
701         WmNenforceKeyFocus,
702         WmCEnforceKeyFocus,
703         XtRBoolean,
704         sizeof (Boolean),
705         XtOffsetOf(WmGlobalData, enforceKeyFocus),
706         XtRImmediate,
707         (XtPointer)True
708     },
709
710     {
711         WmNframeExternalShadowWidth,
712         WmCFrameExternalShadowWidth,
713         XtRDimension,
714         sizeof (Dimension),
715         XtOffsetOf(WmGlobalData, frameExternalShadowWidth),
716         XtRImmediate,
717         (XtPointer)2
718     },
719
720     {
721         WmNfreezeOnConfig,
722         WmCFreezeOnConfig,
723         XtRBoolean,
724         sizeof (Boolean),
725         XtOffsetOf(WmGlobalData, freezeOnConfig),
726         XtRImmediate,
727         (XtPointer)True
728     },
729
730     {
731         WmNuseWindowOutline,
732         WmCUseWindowOutline,
733         XtRBoolean,
734         sizeof (Boolean),
735         XtOffsetOf(WmGlobalData, useWindowOutline),
736         XtRImmediate,
737         (XtPointer)False
738     },
739
740     {
741         WmNiconAutoPlace,
742         WmCIconAutoPlace,
743         XtRBoolean,
744         sizeof (Boolean),
745         XtOffsetOf(WmGlobalData, iconAutoPlace),
746         XtRImmediate,
747         (XtPointer)True
748     },
749
750     {
751         WmNiconExternalShadowWidth,
752         WmCIconExternalShadowWidth,
753         XtRDimension,
754         sizeof (Dimension),
755         XtOffsetOf(WmGlobalData, iconExternalShadowWidth),
756         XtRImmediate,
757         (XtPointer)2
758     },
759
760     {
761         WmNiconClick,
762         WmCIconClick,
763         XtRBoolean,
764         sizeof (Boolean),
765         XtOffsetOf(WmGlobalData, iconClick),
766         XtRImmediate,
767         (XtPointer)True
768     },
769
770     {
771         WmNinteractivePlacement,
772         WmCInteractivePlacement,
773         XtRBoolean,
774         sizeof (Boolean),
775         XtOffsetOf(WmGlobalData, interactivePlacement),
776         XtRImmediate,
777         (XtPointer)False
778     },
779
780     {
781         WmNkeyboardFocusPolicy,
782         WmCKeyboardFocusPolicy,
783         WmRKFocusPolicy,
784         sizeof (int),
785         XtOffsetOf(WmGlobalData, keyboardFocusPolicy),
786         XtRImmediate,
787 #if defined(sun)
788         (XtPointer)KEYBOARD_FOCUS_POINTER
789 #else
790         (XtPointer)KEYBOARD_FOCUS_EXPLICIT
791 #endif
792     },
793
794     {
795         WmNlowerOnIconify,
796         WmCLowerOnIconify,
797         XtRBoolean,
798         sizeof (Boolean),
799         XtOffsetOf(WmGlobalData, lowerOnIconify),
800         XtRImmediate,
801         (XtPointer)True
802     },
803
804     {
805         WmNmarqueeSelectGranularity,
806         WmCMarqueeSelectGranularity,
807         XtRInt,
808         sizeof (int),
809         XtOffsetOf(WmGlobalData, marqueeSelectGranularity),
810         XtRImmediate,
811         (XtPointer)0
812     },
813
814     {
815         WmNmoveThreshold,
816         WmCMoveThreshold,
817         XtRInt,
818         sizeof (int),
819         XtOffsetOf(WmGlobalData, moveThreshold),
820         XtRImmediate,
821         (XtPointer)4
822     },
823
824     {
825         WmNpassButtons,
826         WmCPassButtons,
827         XtRBoolean,
828         sizeof (Boolean),
829         XtOffsetOf(WmGlobalData, passButtons),
830         XtRImmediate,
831         (XtPointer)False
832     },
833
834     {
835         WmNpassSelectButton,
836         WmCPassSelectButton,
837         XtRBoolean,
838         sizeof (Boolean),
839         XtOffsetOf(WmGlobalData, passSelectButton),
840         XtRImmediate,
841         (XtPointer)True
842     },
843
844     {
845         WmNpositionIsFrame,
846         WmCPositionIsFrame,
847         XtRBoolean,
848         sizeof (Boolean),
849         XtOffsetOf(WmGlobalData, positionIsFrame),
850         XtRImmediate,
851         (XtPointer)True
852     },
853
854     {
855         WmNpositionOnScreen,
856         WmCPositionOnScreen,
857         XtRBoolean,
858         sizeof (Boolean),
859         XtOffsetOf(WmGlobalData, positionOnScreen),
860         XtRImmediate,
861         (XtPointer)True
862     },
863
864     {
865         WmNquitTimeout,
866         WmCQuitTimeout,
867         XtRInt,
868         sizeof (int),
869         XtOffsetOf(WmGlobalData, quitTimeout),
870         XtRImmediate,
871         (XtPointer)1000
872     },
873
874     {
875         WmNraiseKeyFocus,
876         WmCRaiseKeyFocus,
877         XtRBoolean,
878         sizeof (Boolean),
879         XtOffsetOf(WmGlobalData, raiseKeyFocus),
880         XtRImmediate,
881         (XtPointer)False
882     },
883
884     {
885         WmNrefreshByClearing,
886         WmCRefreshByClearing,
887         XtRBoolean,
888         sizeof (Boolean),
889         XtOffsetOf(WmGlobalData, refreshByClearing),
890         XtRImmediate,
891         (XtPointer)True
892     },
893
894     {
895         WmNrootButtonClick,
896         WmCRootButtonClick,
897         XtRBoolean,
898         sizeof (Boolean),
899         XtOffsetOf(WmGlobalData, rootButtonClick),
900         XtRImmediate,
901         (XtPointer)True
902     },
903
904     {
905         WmNshowFeedback,
906         WmCShowFeedback,
907         WmRShowFeedback,
908         sizeof (int),
909         XtOffsetOf(WmGlobalData, showFeedback),
910         XtRImmediate,
911         (XtPointer)(WM_SHOW_FB_DEFAULT)
912     },
913
914     {
915         WmNstartupKeyFocus,
916         WmCStartupKeyFocus,
917         XtRBoolean,
918         sizeof (Boolean),
919         XtOffsetOf(WmGlobalData, startupKeyFocus),
920         XtRImmediate,
921         (XtPointer)True
922     },
923
924     {
925         WmNsystemButtonClick,
926         WmCSystemButtonClick,
927         XtRBoolean,
928         sizeof (Boolean),
929         XtOffsetOf(WmGlobalData, systemButtonClick),
930         XtRImmediate,
931         (XtPointer)True
932     },
933
934     {
935         WmNsystemButtonClick2,
936         WmCSystemButtonClick2,
937         XtRBoolean,
938         sizeof (Boolean),
939         XtOffsetOf(WmGlobalData, systemButtonClick2),
940         XtRImmediate,
941         (XtPointer)True
942     },
943     {
944         WmNuseFrontPanel,
945         WmCUseFrontPanel,
946         XtRBoolean,
947         sizeof (Boolean),
948         XtOffsetOf(WmGlobalData, useFrontPanel),
949         XtRImmediate,
950         (XtPointer)True
951     },
952
953     {
954         WmNhelpDirectory,
955         WmCHelpDirectory,
956         XtRString,
957         sizeof (String),
958         XtOffsetOf(WmGlobalData, helpDirectory),
959         XtRImmediate,
960         (XtPointer)"DT/Dtwm/"
961     },
962
963     {
964         WmNdtLite,
965         WmCDtLite,
966         XtRBoolean,
967         sizeof (Boolean),
968         XtOffsetOf(WmGlobalData, dtLite),
969         XtRImmediate,
970         (XtPointer)False
971     }
972 }; /* END OF wmGlobalResources[] */
973
974
975 /*
976  * These determine the screens to manage at startup.
977  * These are broken out to enhance startup performance.
978  */
979 XtResource wmGlobalScreenResources[] =
980 {
981     {
982         WmNmultiScreen,
983         WmCMultiScreen,
984         XtRBoolean,
985         sizeof (Boolean),
986         XtOffsetOf(WmGlobalData, multiScreen),
987         XtRImmediate,
988         (XtPointer)True
989     },
990
991     {
992         WmNscreens,
993         WmCScreens,
994         XtRString,
995         sizeof (String),
996         XtOffsetOf(WmGlobalData, screenList),
997         XtRImmediate,
998         (XtPointer)NULL
999     },
1000
1001     {   WmNbackdropDirectories, 
1002         WmCBackdropDirectories, 
1003         XmRString, 
1004         sizeof(char *),
1005         XtOffsetOf(WmGlobalData, backdropDirs), 
1006         XmRString,
1007         DEFAULT_BACKDROP_DIR
1008     },
1009 };
1010
1011
1012 \f
1013 /******************************<->*************************************
1014  *
1015  *  wmStdGlobalResources
1016  *
1017  *
1018  *  Description:
1019  *  -----------
1020  *  This data structure is used in the processing of mwm general appearance
1021  *  and behavior resources that are not automatically set for the standard
1022  *  (default) behavior.  These resources are specified with the following
1023  *  syntax:
1024  *
1025  *      "Mwm*<resource_identifier>".
1026  *
1027  ******************************<->***********************************/
1028
1029 XtResource wmStdGlobalResources[] =
1030 {
1031
1032     {
1033         WmNbitmapDirectory,
1034         WmCBitmapDirectory,
1035         XtRString,
1036         sizeof (String),
1037         XtOffsetOf(WmGlobalData, bitmapDirectory),
1038         XtRString,
1039         (XtPointer)BITMAPDIR
1040     },
1041
1042     {
1043         WmNconfigFile,
1044         WmCConfigFile,
1045         XtRString,
1046         sizeof (String),
1047         XtOffsetOf(WmGlobalData, configFile),
1048         XtRImmediate,
1049         (XtPointer)NULL
1050     },
1051
1052     {
1053         WmNframeStyle,
1054         WmCFrameStyle,
1055         WmRFrameStyle,
1056         sizeof (FrameStyle),
1057         XtOffsetOf(WmGlobalData, frameStyle),
1058         XtRImmediate,
1059         (XtPointer)WmRECESSED
1060     },
1061
1062     {
1063         WmNiconAutoPlace,
1064         WmCIconAutoPlace,
1065         XtRBoolean,
1066         sizeof (Boolean),
1067         XtOffsetOf(WmGlobalData, iconAutoPlace),
1068         XtRImmediate,
1069         (XtPointer)True
1070     },
1071
1072     {
1073         WmNmoveThreshold,
1074         WmCMoveThreshold,
1075         XtRInt,
1076         sizeof (int),
1077         XtOffsetOf(WmGlobalData, moveThreshold),
1078         XtRImmediate,
1079         (XtPointer)4
1080     },
1081
1082     {
1083         WmNpositionIsFrame,
1084         WmCPositionIsFrame,
1085         XtRBoolean,
1086         sizeof (Boolean),
1087         XtOffsetOf(WmGlobalData, positionIsFrame),
1088         XtRImmediate,
1089         (XtPointer)True
1090     },
1091
1092     {
1093         WmNpositionOnScreen,
1094         WmCPositionOnScreen,
1095         XtRBoolean,
1096         sizeof (Boolean),
1097         XtOffsetOf(WmGlobalData, positionOnScreen),
1098         XtRImmediate,
1099         (XtPointer)True
1100     },
1101
1102     {
1103         WmNquitTimeout,
1104         WmCQuitTimeout,
1105         XtRInt,
1106         sizeof (int),
1107         XtOffsetOf(WmGlobalData, quitTimeout),
1108         XtRImmediate,
1109         (XtPointer)1000
1110     },
1111
1112     {
1113         WmNshowFeedback,
1114         WmCShowFeedback,
1115         WmRShowFeedback,
1116         sizeof (int),
1117         XtOffsetOf(WmGlobalData, showFeedback),
1118         XtRImmediate,
1119         (XtPointer)(WM_SHOW_FB_DEFAULT)
1120     },
1121
1122 };
1123
1124 \f
1125 /******************************<->*************************************
1126  *
1127  *  wmScreenResources
1128  *
1129  *
1130  *  Description:
1131  *  -----------
1132  *  This data structure is used in the processing of mwm screen specific
1133  *  appearance and behavior resources.  These resources are specified
1134  *  with the following syntax:
1135  *
1136  *      "Mwm*screen<#>*<resource_identifier>".
1137  *
1138  ******************************<->***********************************/
1139
1140 XtResource wmScreenResources[] =
1141 {
1142     {
1143         WmNbuttonBindings,
1144         WmCButtonBindings,
1145         XtRString,
1146         sizeof (String),
1147         XtOffsetOf (WmScreenData, buttonBindings),
1148         XtRString,
1149         (XtPointer)defaultButtonBindingsName
1150     },
1151
1152     {
1153         WmNcleanText,
1154         WmCCleanText,
1155         XtRBoolean,
1156         sizeof (Boolean),
1157         XtOffsetOf (WmScreenData, cleanText),
1158         XtRImmediate,
1159         (XtPointer)True
1160     },
1161
1162     {
1163         WmNfeedbackGeometry,
1164         WmCFeedbackGeometry,
1165         XtRString,
1166         sizeof (String),
1167         XtOffsetOf (WmScreenData, feedbackGeometry),
1168         XtRString,
1169         (XtPointer)NULL
1170     },
1171
1172     {
1173         WmNfadeNormalIcon,
1174         WmCFadeNormalIcon,
1175         XtRBoolean,
1176         sizeof (Boolean),
1177         XtOffsetOf (WmScreenData, fadeNormalIcon),
1178         XtRImmediate,
1179         (XtPointer)False
1180     },
1181
1182     {
1183         WmNiconDecoration,
1184         WmCIconDecoration,
1185         WmRIconDecor,
1186         sizeof (int),
1187         XtOffsetOf (WmScreenData, iconDecoration),
1188         XtRImmediate,
1189         (XtPointer)USE_ICON_DEFAULT_APPEARANCE
1190     },
1191
1192     {
1193         WmNiconImageMaximum,
1194         WmCIconImageMaximum,
1195         WmRSize,
1196         sizeof (WHSize),
1197         XtOffsetOf (WmScreenData, iconImageMaximum),
1198         XtRCallProc,
1199         (XtPointer) _WmIconImageMaximumDefault
1200     },
1201
1202     {
1203         WmNiconImageMinimum,
1204         WmCIconImageMinimum,
1205         WmRSize,
1206         sizeof (WHSize),
1207         XtOffsetOf (WmScreenData, iconImageMinimum),
1208         XtRString,
1209         "16x16"
1210     },
1211
1212     {
1213         WmNiconPlacement,
1214         WmCIconPlacement,
1215         WmRIconPlacement,
1216         sizeof (int),
1217         XtOffsetOf (WmScreenData, iconPlacement),
1218         XtRImmediate,
1219         (XtPointer)(ICON_PLACE_LEFT_PRIMARY | ICON_PLACE_BOTTOM_SECONDARY)
1220     },
1221
1222     {
1223         WmNiconPlacementMargin,
1224         WmCIconPlacementMargin,
1225         XtRInt,
1226         sizeof (int),
1227         XtOffsetOf (WmScreenData, iconPlacementMargin),
1228         XtRImmediate,
1229         (XtPointer)-1
1230     },
1231
1232     {
1233         WmNkeyBindings,
1234         WmCKeyBindings,
1235         XtRString,
1236         sizeof (String),
1237         XtOffsetOf (WmScreenData, keyBindings),
1238         XtRString,
1239         (XtPointer)defaultKeyBindingsName
1240     },
1241
1242     {
1243         WmNframeBorderWidth,
1244         WmCFrameBorderWidth,
1245         XtRInt,
1246         sizeof (int),
1247         XtOffsetOf (WmScreenData, frameBorderWidth),
1248         XtRImmediate,
1249         (XtPointer) BIGSIZE
1250     },
1251
1252     {
1253         WmNiconBoxName,
1254         WmCIconBoxName,
1255         XtRString,
1256         sizeof (String),
1257         XtOffsetOf (WmScreenData, iconBoxName),
1258         XtRString,
1259         (XtPointer)"iconbox"
1260     },
1261
1262     {
1263         WmNiconBoxSBDisplayPolicy,
1264         WmCIconBoxSBDisplayPolicy,
1265         XtRString,
1266         sizeof (String),
1267         XtOffsetOf (WmScreenData, iconBoxSBDisplayPolicy),
1268         XtRString,
1269         (XtPointer)"all"
1270     },
1271
1272     {
1273         WmNiconBoxScheme,
1274         WmCIconBoxScheme,
1275         XtRInt,
1276         sizeof (int),
1277         XtOffsetOf (WmScreenData, iconBoxScheme),
1278         XtRImmediate,
1279         (XtPointer)0
1280     },
1281
1282     {
1283         WmNiconBoxTitle,
1284         WmCIconBoxTitle,
1285         XmRXmString,
1286         sizeof (XmString),
1287         XtOffsetOf (WmScreenData, iconBoxTitle),
1288         XmRXmString,
1289         (XtPointer)NULL
1290     },
1291
1292     {
1293         WmNlimitResize,
1294         WmCLimitResize,
1295         XtRBoolean,
1296         sizeof (Boolean),
1297         XtOffsetOf (WmScreenData, limitResize),
1298         XtRImmediate,
1299         (XtPointer)True
1300     },
1301
1302     {
1303         WmNmaximumMaximumSize,
1304         WmCMaximumMaximumSize,
1305         WmRSize,
1306         sizeof (WHSize),
1307         XtOffsetOf (WmScreenData, maximumMaximumSize),
1308         XtRString,
1309         "0x0"
1310     },
1311
1312     {
1313         WmNresizeBorderWidth,
1314         WmCFrameBorderWidth,
1315         XtRInt,
1316         sizeof (int),
1317         XtOffsetOf (WmScreenData, resizeBorderWidth),
1318         XtRImmediate,
1319         (XtPointer) BIGSIZE
1320     },
1321
1322     {
1323         WmNresizeCursors,
1324         WmCResizeCursors,
1325         XtRBoolean,
1326         sizeof (Boolean),
1327         XtOffsetOf (WmScreenData, resizeCursors),
1328         XtRImmediate,
1329         (XtPointer)True
1330     },
1331
1332     {
1333         WmNtransientDecoration,
1334         WmCTransientDecoration,
1335         WmRClientDecor,
1336         sizeof (int),
1337         XtOffsetOf (WmScreenData, transientDecoration),
1338         XtRImmediate,
1339         (XtPointer)(WM_DECOR_SYSTEM | WM_DECOR_RESIZEH)
1340     },
1341
1342     {
1343         WmNtransientFunctions,
1344         WmCTransientFunctions,
1345         WmRClientFunction,
1346         sizeof (int),
1347         XtOffsetOf (WmScreenData, transientFunctions),
1348         XtRImmediate,
1349         (XtPointer)(WM_FUNC_ALL & ~(MWM_FUNC_MAXIMIZE | MWM_FUNC_MINIMIZE))
1350     },
1351
1352     {
1353         WmNsubpanelDecoration,
1354         WmCSubpanelDecoration,
1355         WmRClientDecor,
1356         sizeof (int),
1357         XtOffsetOf (WmScreenData, subpanelDecoration),
1358         XtRImmediate,
1359         (XtPointer)(WM_DECOR_SYSTEM)
1360     },
1361
1362     {
1363         WmNsubpanelResources,
1364         WmCSubpanelResources,
1365         XtRString,
1366         sizeof (String),
1367         XtOffsetOf (WmScreenData, subpanelResources),
1368         XtRString,
1369         (XtPointer)NULL
1370     },
1371
1372     {
1373         WmNuseIconBox,
1374         WmCUseIconBox,
1375         XtRBoolean,
1376         sizeof (Boolean),
1377         XtOffsetOf (WmScreenData, useIconBox),
1378         XtRImmediate,
1379         (XtPointer)False
1380     },
1381
1382     {
1383         WmNmoveOpaque,
1384         WmCMoveOpaque,
1385         XtRBoolean,
1386         sizeof (Boolean),
1387         XtOffsetOf (WmScreenData, moveOpaque),
1388         XtRImmediate,
1389         (XtPointer)False
1390
1391     },
1392
1393     {
1394         WmNhelpResources,
1395         WmCHelpResources,
1396         XtRString,
1397         sizeof (String),
1398         XtOffsetOf (WmScreenData, helpResources),
1399         XtRString,
1400         (XtPointer)NULL
1401     },
1402
1403     {
1404         WmNinitialWorkspace,
1405         WmCInitialWorkspace,
1406         XtRString,
1407         sizeof (String),
1408         XtOffsetOf (WmScreenData, initialWorkspace),
1409         XtRString,
1410         (XtPointer)NULL
1411     },
1412
1413     {
1414         WmNworkspaceList,
1415         WmCWorkspaceList,
1416         XtRString,
1417         sizeof (String),
1418         XtOffsetOf (WmScreenData, workspaceList),
1419         XtRImmediate,
1420         (XtPointer)NULL
1421     },
1422
1423     {
1424         WmNworkspaceCount,
1425         WmCWorkspaceCount,
1426         XtRInt,
1427         sizeof (int),
1428         XtOffsetOf (WmScreenData, numWorkspaces),
1429         XtRImmediate,
1430         (XtPointer)0
1431     }
1432
1433 };
1434
1435 \f
1436 /******************************<->*************************************
1437  *
1438  *  wmStdScreenResources
1439  *
1440  *
1441  *  Description:
1442  *  -----------
1443  *  This data structure is used in the processing of mwm screen specific
1444  *  appearance and behavior resources that are not automatically set for 
1445  *  the standard (default) behavior.  These resources are specified with 
1446  *  the following syntax:
1447  *
1448  *      "Mwm*screen<#>*<resource_identifier>".
1449  *
1450  ******************************<->***********************************/
1451
1452 XtResource wmStdScreenResources[] =
1453 {
1454     {
1455         WmNframeBorderWidth,
1456         WmCFrameBorderWidth,
1457         XtRInt,
1458         sizeof (int),
1459         XtOffsetOf (WmScreenData, frameBorderWidth),
1460         XtRImmediate,
1461         (XtPointer) BIGSIZE
1462     },
1463
1464     {
1465         WmNiconImageMaximum,
1466         WmCIconImageMaximum,
1467         WmRSize,
1468         sizeof (WHSize),
1469         XtOffsetOf (WmScreenData, iconImageMaximum),
1470         XtRCallProc,
1471         (XtPointer) _WmIconImageMaximumDefault
1472     },
1473
1474     {
1475         WmNiconImageMinimum,
1476         WmCIconImageMinimum,
1477         WmRSize,
1478         sizeof (WHSize),
1479         XtOffsetOf (WmScreenData, iconImageMinimum),
1480         XtRString,
1481         "32x32"
1482     },
1483
1484     {
1485         WmNiconPlacementMargin,
1486         WmCIconPlacementMargin,
1487         XtRInt,
1488         sizeof (int),
1489         XtOffsetOf (WmScreenData, iconPlacementMargin),
1490         XtRImmediate,
1491         (XtPointer)-1
1492     },
1493
1494     {
1495         WmNmaximumMaximumSize,
1496         WmCMaximumMaximumSize,
1497         WmRSize,
1498         sizeof (WHSize),
1499         XtOffsetOf (WmScreenData, maximumMaximumSize),
1500         XtRString,
1501         "0x0"
1502     },
1503
1504     {
1505         WmNresizeBorderWidth,
1506         WmCFrameBorderWidth,
1507         XtRInt,
1508         sizeof (int),
1509         XtOffsetOf (WmScreenData, resizeBorderWidth),
1510         XtRImmediate,
1511         (XtPointer) BIGSIZE
1512     }
1513 };
1514
1515
1516 \f
1517 /******************************<->*************************************
1518  *
1519  *  wmWorkspaceResources
1520  *
1521  *
1522  *  Description:
1523  *  -----------
1524  *  This data structure is used in the processing of mwm workspace 
1525  *  specific appearance and behavior resources.  These resources are 
1526  *  specified with the following syntax:
1527  *
1528  *      "Mwm*[screen<#>*]<workspace>*<resource_identifier>".
1529  *
1530  ******************************<->***********************************/
1531 XtResource wmWorkspaceResources[] =
1532 {
1533     {
1534         WmNiconBoxGeometry,
1535         WmCIconBoxGeometry,
1536         XtRString,
1537         sizeof (String),
1538         XtOffsetOf (WmWorkspaceData, iconBoxGeometry),
1539         XtRString,
1540         (XtPointer)NULL
1541     },
1542
1543     {
1544         WmNtitle,
1545         WmCTitle,
1546         XmRXmString,
1547         sizeof (XmString),
1548         XtOffsetOf (WmWorkspaceData, title),
1549         XmRXmString,
1550         (XtPointer)NULL
1551     }
1552
1553 };
1554
1555
1556 \f
1557 /******************************<->*************************************
1558  *
1559  *  wmStdWorkspaceResources
1560  *
1561  *
1562  *  Description:
1563  *  -----------
1564  *  This data structure is used in the processing of mwm workspace specific 
1565  *  appearance and behavior resources that are not automatically set for 
1566  *  the standard (default) behavior.  These resources are specified with 
1567  *  the following syntax:
1568  *
1569  *      "Mwm*[screen<#>*]<workspace>*<resource_identifier>".
1570  *
1571  *************************************<->***********************************/
1572
1573 XtResource wmStdWorkspaceResources[] =
1574 {
1575     {
1576         WmNtitle,
1577         WmCTitle,
1578         XmRXmString,
1579         sizeof (XmString),
1580         XtOffsetOf (WmWorkspaceData, title),
1581         XmRXmString,
1582         (XtPointer)NULL
1583     }
1584 };
1585
1586
1587 /*************************************<->*************************************
1588  *
1589  *  wmBackdropResources
1590  *
1591  *
1592  *  Description:
1593  *  -----------
1594  *  This data structure is used in the processing of workspace specific
1595  *  resources that apply to the backdrop.
1596  *
1597  *  These resources are specified with the following syntax:
1598  *
1599  *      "Mwm*[screen*][workspace*]backdrop*<resource_id>:"
1600  *
1601  *  NOTE: The order of these resources is important for correct
1602  *        dynamic processing!!!!
1603  *
1604  *************************************<->***********************************/
1605
1606 XtResource wmBackdropResources[] =
1607 {
1608     {
1609         WmNcolorSetId,
1610         WmCColorSetId,
1611         XtRInt,
1612         sizeof (int),
1613         XtOffsetOf (BackdropData, colorSet),
1614         XtRCallProc,
1615         (XtPointer) _WmBackdropColorSetDefault
1616     },
1617
1618     {
1619         WmNimageBackground,
1620         WmCImageBackground,
1621         XtRPixel,
1622         sizeof (Pixel),
1623         XtOffsetOf (BackdropData, background),
1624         XtRCallProc,
1625         (XtPointer) _WmBackdropBgDefault
1626     },
1627
1628     {
1629         WmNimageForeground,
1630         WmCImageForeground,
1631         XtRPixel,
1632         sizeof (Pixel),
1633         XtOffsetOf (BackdropData, foreground),
1634         XtRCallProc,
1635         (XtPointer) _WmBackdropFgDefault
1636     },
1637
1638     {
1639         WmNimage,
1640         WmCImage,
1641         XtRString,
1642         sizeof (String),
1643         XtOffsetOf (BackdropData, image),
1644         XtRString,
1645         (XtPointer)NULL
1646     },
1647
1648 };
1649
1650 \f
1651 /*************************************<->*************************************
1652  *
1653  *  wmWsPresenceResources
1654  *
1655  *
1656  *  Description:
1657  *  -----------
1658  *  This data structure is used in the processing of specific
1659  *  resources that apply to the WorkspacePresence dialog.
1660  *
1661  *  These resources are specified with the following syntax:
1662  *
1663  *      "Mwm*[screen*][workspace*]workspacePresence*<resource_id>:"
1664  *
1665  *************************************<->***********************************/
1666
1667 XtResource wmWsPresenceResources[] =
1668 {
1669     {
1670         WmNtitle,
1671         WmCTitle,
1672         XmRXmString,
1673         sizeof (XmString),
1674         XtOffsetOf (WsPresenceData, title),
1675         XmRXmString,
1676         (XtPointer)NULL
1677     }
1678 };
1679
1680 /*************************************<->*************************************
1681  *
1682  *  wmClientResources
1683  *
1684  *
1685  *  Description:
1686  *  -----------
1687  *  This data structure is used in the processing of client specific 
1688  *  window manager resources.  These resources are specified with the
1689  *  following syntax:
1690  *
1691  *      "Mwm*<client_name_or_class>*<resource_identifier>"
1692  *
1693  *************************************<->***********************************/
1694
1695 XtResource wmClientResources[] =
1696 {
1697
1698     {
1699         WmNabsentMapBehavior,
1700         WmCAbsentMapBehavior,
1701         WmRAbsentMapBehavior,
1702         sizeof (int),
1703         XtOffsetOf (ClientData, absentMapBehavior),
1704         XtRImmediate,
1705         (XtPointer)(AMAP_BEHAVIOR_ADD)
1706     },
1707
1708     {
1709         WmNclientDecoration,
1710         WmCClientDecoration,
1711         WmRClientDecor,
1712         sizeof (int),
1713         XtOffsetOf (ClientData, clientDecoration),
1714         XtRImmediate,
1715         (XtPointer)(WM_DECOR_DEFAULT)
1716     },
1717
1718     {
1719         WmNclientFunctions,
1720         WmCClientFunctions,
1721         WmRClientFunction,
1722         sizeof (int),
1723         XtOffsetOf (ClientData, clientFunctions),
1724         XtRImmediate,
1725         (XtPointer)(WM_FUNC_DEFAULT)
1726     },
1727
1728     {
1729         WmNfocusAutoRaise,
1730         WmCFocusAutoRaise,
1731         XtRBoolean,
1732         sizeof (Boolean),
1733         XtOffsetOf (ClientData, focusAutoRaise),
1734         XtRCallProc,
1735         (XtPointer)_WmFocusAutoRaiseDefault
1736     },
1737
1738     {
1739         WmNiconImage,
1740         WmCIconImage,
1741         XtRString,
1742         sizeof (String),
1743         XtOffsetOf (ClientData, iconImage),
1744         XtRString,
1745         (XtPointer)NULL
1746     },
1747
1748     {
1749         WmNiconImageBackground,
1750         WmCIconImageBackground,
1751         XtRPixel,
1752         sizeof (Pixel),
1753         XtOffsetOf (ClientData, iconImageBackground),
1754         XtRCallProc,
1755         (XtPointer)_WmIconImageBDefault
1756     },
1757
1758     {
1759         WmNiconImageForeground,
1760         WmCIconImageForeground,
1761         XtRPixel,
1762         sizeof (Pixel),
1763         XtOffsetOf (ClientData, iconImageForeground),
1764         XtRCallProc,
1765         (XtPointer)_WmIconImageFDefault
1766     },
1767
1768     {
1769         WmNiconImageBottomShadowColor,
1770         WmCIconImageBottomShadowColor,
1771         XtRPixel,
1772         sizeof (Pixel),
1773         XtOffsetOf (ClientData, iconImageBottomShadowColor),
1774         XtRCallProc,
1775         (XtPointer)_WmIconImageBSCDefault
1776     },
1777
1778     {
1779         WmNiconImageBottomShadowPixmap,
1780         WmCIconImageBottomShadowPixmap,
1781         XtRString,
1782         sizeof (String),
1783         XtOffsetOf (ClientData, iconImageBottomShadowPStr),
1784         XtRCallProc,
1785         (XtPointer)_WmIconImageBSPDefault
1786     },
1787
1788     {
1789         WmNiconImageTopShadowColor,
1790         WmCIconImageTopShadowColor,
1791         XtRPixel,
1792         sizeof (Pixel),
1793         XtOffsetOf (ClientData, iconImageTopShadowColor),
1794         XtRCallProc,
1795         (XtPointer)_WmIconImageTSCDefault
1796     },
1797
1798     {
1799         WmNiconImageTopShadowPixmap,
1800         WmCIconImageTopShadowPixmap,
1801         XtRString,
1802         sizeof (String),
1803         XtOffsetOf (ClientData, iconImageTopShadowPStr),
1804         XtRCallProc,
1805         (XtPointer)_WmIconImageTSPDefault
1806     },
1807
1808     {
1809         WmNignoreWMSaveHints,
1810         WmCIgnoreWMSaveHints,
1811         XtRBoolean,
1812         sizeof (Boolean),
1813         XtOffsetOf (ClientData, ignoreWMSaveHints),
1814         XtRImmediate,
1815         (XtPointer)True
1816     },
1817
1818     {
1819         WmNmatteWidth,
1820         WmCMatteWidth,
1821         XtRInt,
1822         sizeof (int),
1823         XtOffsetOf (ClientData, matteWidth),
1824         XtRImmediate,
1825         (XtPointer)0
1826     },
1827
1828     {
1829         WmNmaximumClientSize,
1830         WmCMaximumClientSize,
1831         WmRSize,
1832         sizeof (WHSize),
1833         XtOffsetOf (ClientData, maximumClientSize),
1834         XtRString,
1835         "0x0"
1836     },
1837
1838     {
1839         WmNsecondariesOnTop,
1840         WmCSecondariesOnTop,
1841         XtRBoolean,
1842         sizeof (Boolean),
1843         XtOffsetOf (ClientData, secondariesOnTop),
1844         XtRCallProc,
1845         (XtPointer)_WmSecondariesOnTopDefault
1846     },
1847
1848     {
1849         WmNsystemMenu,
1850         WmCSystemMenu,
1851         XtRString,
1852         sizeof (String),
1853         XtOffsetOf (ClientData, systemMenu),
1854         XtRString,
1855         (XtPointer)defaultSystemMenuName
1856     },
1857
1858     {
1859         WmNuseClientIcon,
1860         WmCUseClientIcon,
1861         XtRBoolean,
1862         sizeof (Boolean),
1863         XtOffsetOf (ClientData, useClientIcon),
1864         XtRImmediate,
1865         (XtPointer)True
1866     },
1867
1868     {
1869         WmNusePPosition,
1870         WmCUsePPosition,
1871         WmRUsePPosition,
1872         sizeof (int),
1873         XtOffsetOf (ClientData, usePPosition),
1874         XtRImmediate,
1875         (XtPointer)(USE_PPOSITION_NONZERO)
1876     }
1877
1878 }; /* END OF STRUCTURE wmClientResources */
1879
1880
1881 \f
1882 /*************************************<->*************************************
1883  *
1884  *  wmStdClientResources
1885  *
1886  *
1887  *  Description:
1888  *  -----------
1889  *  This data structure is used in the processing of client specific 
1890  *  window manager resources that are not automatically set for the standard
1891  *  (default) behavior.  These resources are specified with the
1892  *  following syntax:
1893  *
1894  *      "Mwm*<client_name_or_class>*<resource_identifier>"
1895  *
1896  *************************************<->***********************************/
1897
1898 XtResource wmStdClientResources[] =
1899 {
1900
1901     {
1902         WmNiconImage,
1903         WmCIconImage,
1904         XtRString,
1905         sizeof (String),
1906         XtOffsetOf (ClientData, iconImage),
1907         XtRString,
1908         (XtPointer)NULL
1909     },
1910
1911     {
1912         WmNiconImageBackground,
1913         WmCIconImageBackground,
1914         XtRPixel,
1915         sizeof (Pixel),
1916         XtOffsetOf (ClientData, iconImageBackground),
1917         XtRCallProc,
1918         (XtPointer)_WmIconImageBDefault
1919     },
1920
1921     {
1922         WmNiconImageForeground,
1923         WmCIconImageForeground,
1924         XtRPixel,
1925         sizeof (Pixel),
1926         XtOffsetOf (ClientData, iconImageForeground),
1927         XtRCallProc,
1928         (XtPointer)_WmIconImageFDefault
1929     },
1930
1931     {
1932         WmNiconImageBottomShadowColor,
1933         WmCIconImageBottomShadowColor,
1934         XtRPixel,
1935         sizeof (Pixel),
1936         XtOffsetOf (ClientData, iconImageBottomShadowColor),
1937         XtRCallProc,
1938         (XtPointer)_WmIconImageBSCDefault
1939     },
1940
1941     {
1942         WmNiconImageBottomShadowPixmap,
1943         WmCIconImageBottomShadowPixmap,
1944         XtRString,
1945         sizeof (String),
1946         XtOffsetOf (ClientData, iconImageBottomShadowPStr),
1947         XtRCallProc,
1948         (XtPointer)_WmIconImageBSPDefault
1949     },
1950
1951     {
1952         WmNiconImageTopShadowColor,
1953         WmCIconImageTopShadowColor,
1954         XtRPixel,
1955         sizeof (Pixel),
1956         XtOffsetOf (ClientData, iconImageTopShadowColor),
1957         XtRCallProc,
1958         (XtPointer)_WmIconImageTSCDefault
1959     },
1960
1961     {
1962         WmNiconImageTopShadowPixmap,
1963         WmCIconImageTopShadowPixmap,
1964         XtRString,
1965         sizeof (String),
1966         XtOffsetOf (ClientData, iconImageTopShadowPStr),
1967         XtRCallProc,
1968         (XtPointer)_WmIconImageTSPDefault
1969     },
1970
1971     {
1972         WmNmatteWidth,
1973         WmCMatteWidth,
1974         XtRInt,
1975         sizeof (int),
1976         XtOffsetOf (ClientData, matteWidth),
1977         XtRImmediate,
1978         (XtPointer)0
1979     },
1980
1981     {
1982         WmNmaximumClientSize,
1983         WmCMaximumClientSize,
1984         WmRSize,
1985         sizeof (WHSize),
1986         XtOffsetOf (ClientData, maximumClientSize),
1987         XtRString,
1988         "0x0"
1989     },
1990
1991     {
1992         WmNsecondariesOnTop,
1993         WmCSecondariesOnTop,
1994         XtRBoolean,
1995         sizeof (Boolean),
1996         XtOffsetOf (ClientData, secondariesOnTop),
1997         XtRCallProc,
1998         (XtPointer)_WmSecondariesOnTopDefault
1999     },
2000
2001     {
2002         WmNuseClientIcon,
2003         WmCUseClientIcon,
2004         XtRBoolean,
2005         sizeof (Boolean),
2006         XtOffsetOf (ClientData, useClientIcon),
2007         XtRImmediate,
2008         (XtPointer)False
2009     }
2010 };
2011
2012
2013 \f
2014 /*************************************<->*************************************
2015  *
2016  *  wmClientResourcesM
2017  *
2018  *
2019  *  Description:
2020  *  -----------
2021  *  This data structure is used in the processing of client specific 
2022  *  window manager resources that affect the appearance of the client
2023  *  matte.  These resources are specified with the following syntax:
2024  *
2025  *      "Mwm*<client_name_or_class>*<resource_identifier>"
2026  *
2027  *************************************<->***********************************/
2028
2029 XtResource wmClientResourcesM[] =
2030 {
2031     {
2032         WmNmatteBackground,
2033         WmCMatteBackground,
2034         XtRPixel,
2035         sizeof (Pixel),
2036         XtOffsetOf (ClientData, matteBackground),
2037         XtRCallProc,
2038         (XtPointer)_WmMatteBDefault
2039     },
2040
2041     {
2042         WmNmatteForeground,
2043         WmCMatteForeground,
2044         XtRPixel,
2045         sizeof (Pixel),
2046         XtOffsetOf (ClientData, matteForeground),
2047         XtRCallProc,
2048         (XtPointer)_WmMatteFDefault
2049     },
2050
2051     {
2052         WmNmatteBottomShadowColor,
2053         WmCMatteBottomShadowColor,
2054         XtRPixel,
2055         sizeof (Pixel),
2056         XtOffsetOf (ClientData, matteBottomShadowColor),
2057         XtRCallProc,
2058         (XtPointer)_WmMatteBSCDefault
2059     },
2060
2061     {
2062         WmNmatteBottomShadowPixmap,
2063         WmCMatteBottomShadowPixmap,
2064         XtRString,
2065         sizeof (String),
2066         XtOffsetOf (ClientData, matteBottomShadowPStr),
2067         XtRCallProc,
2068         (XtPointer)_WmMatteBSPDefault
2069     },
2070
2071     {
2072         WmNmatteTopShadowColor,
2073         WmCMatteTopShadowColor,
2074         XtRPixel,
2075         sizeof (Pixel),
2076         XtOffsetOf (ClientData, matteTopShadowColor),
2077         XtRCallProc,
2078         (XtPointer)_WmMatteTSCDefault
2079     },
2080
2081     {
2082         WmNmatteTopShadowPixmap,
2083         WmCMatteTopShadowPixmap,
2084         XtRString,
2085         sizeof (String),
2086         XtOffsetOf (ClientData, matteTopShadowPStr),
2087         XtRCallProc,
2088         (XtPointer)_WmMatteTSPDefault
2089     }
2090 };
2091
2092
2093 \f
2094 /*************************************<->*************************************
2095  *
2096  *  wmAppearanceResources
2097  *
2098  *
2099  *  Description:
2100  *  -----------
2101  *  This data structure is used in the processing of component appearance
2102  *  resources.  These resources are specified with the following syntax:
2103  *
2104  *      "Mwm*<resource_identifier>"
2105  *      "Mwm*client*<resource_identifier>"
2106  *      "Mwm*icon*<resource_identifier>"
2107  *      "Mwm*feedback*<resource_identifier>"
2108  *
2109  *************************************<->***********************************/
2110
2111 XtResource wmAppearanceResources[] =
2112 {
2113
2114     {
2115         XmNfontList,
2116         XmCFontList,
2117         XmRFontList,
2118         sizeof (XmFontList),
2119         XtOffsetOf (AppearanceData, fontList),
2120         XtRString,
2121         "fixed"
2122     },
2123
2124     {
2125         WmNsaveUnder,
2126         WmCSaveUnder,
2127         XtRBoolean,
2128         sizeof (Boolean),
2129         XtOffsetOf (AppearanceData, saveUnder),
2130         XtRImmediate,
2131         (XtPointer)False
2132     },
2133
2134     {
2135         XtNbackground,
2136         XtCBackground,
2137         XtRPixel,
2138         sizeof (Pixel),
2139         XtOffsetOf (AppearanceData, background),
2140         XtRCallProc,
2141         (XtPointer)_WmBackgroundDefault
2142     },
2143
2144     {
2145         XtNforeground,
2146         XtCForeground,
2147         XtRPixel,
2148         sizeof (Pixel),
2149         XtOffsetOf (AppearanceData, foreground),
2150         XtRCallProc,
2151         (XtPointer)_WmForegroundDefault
2152     },
2153
2154     {
2155         XmNbottomShadowColor,
2156         XtCForeground,
2157         XtRPixel,
2158         sizeof (Pixel),
2159         XtOffsetOf (AppearanceData, bottomShadowColor),
2160         XtRCallProc,
2161         (XtPointer)_WmBottomShadowColorDefault
2162     },
2163
2164     {
2165         XmNbottomShadowPixmap,
2166         XmCBottomShadowPixmap,
2167         XtRString,
2168         sizeof (String),
2169         XtOffsetOf (AppearanceData, bottomShadowPStr),
2170         XtRString,
2171         (XtPointer)NULL
2172     },
2173
2174     {
2175         XmNtopShadowColor,
2176         XtCForeground,
2177         XtRPixel,
2178         sizeof (Pixel),
2179         XtOffsetOf (AppearanceData, topShadowColor),
2180         XtRCallProc,
2181         (XtPointer)_WmTopShadowColorDefault
2182     },
2183
2184     {
2185         XmNbackgroundPixmap,
2186         XmCBackgroundPixmap,
2187         XtRString,
2188         sizeof (String),
2189         XtOffsetOf (AppearanceData, backgroundPStr),
2190         XtRCallProc,
2191         (XtPointer)_WmBackgroundPixmapDefault
2192     },
2193
2194     {
2195         XmNtopShadowPixmap,
2196         XmCTopShadowPixmap,
2197         XtRString,
2198         sizeof (String),
2199         XtOffsetOf (AppearanceData, topShadowPStr),
2200         XtRCallProc,
2201         (XtPointer)_WmTopShadowPixmapDefault
2202     },
2203
2204     {
2205         WmNactiveBackground,
2206         XtCBackground,
2207         XtRPixel,
2208         sizeof (Pixel),
2209         XtOffsetOf (AppearanceData, activeBackground),
2210         XtRCallProc,
2211         (XtPointer)_WmABackgroundDefault
2212     },
2213
2214     {
2215         WmNactiveForeground,
2216         XtCForeground,
2217         XtRPixel,
2218         sizeof (Pixel),
2219         XtOffsetOf (AppearanceData, activeForeground),
2220         XtRCallProc,
2221         (XtPointer)_WmAForegroundDefault
2222     },
2223
2224     {
2225         WmNactiveBottomShadowColor,
2226         XtCForeground,
2227         XtRPixel,
2228         sizeof (Pixel),
2229         XtOffsetOf (AppearanceData, activeBottomShadowColor),
2230         XtRCallProc,
2231         (XtPointer)_WmABottomShadowColorDefault
2232     },
2233
2234     {
2235         WmNactiveBottomShadowPixmap,
2236         XmCBottomShadowPixmap,
2237         XtRString,
2238         sizeof (String),
2239         XtOffsetOf (AppearanceData, activeBottomShadowPStr),
2240         XtRString,
2241         (XtPointer)NULL
2242     },
2243
2244     {
2245         WmNactiveTopShadowColor,
2246         XtCForeground,
2247         XtRPixel,
2248         sizeof (Pixel),
2249         XtOffsetOf (AppearanceData, activeTopShadowColor),
2250         XtRCallProc,
2251         (XtPointer)_WmATopShadowColorDefault
2252     },
2253
2254     {
2255         WmNactiveBackgroundPixmap,
2256         XmCBackgroundPixmap,
2257         XtRString,
2258         sizeof (String),
2259         XtOffsetOf (AppearanceData, activeBackgroundPStr),
2260         XtRCallProc,
2261         (XtPointer)_WmABackgroundPixmapDefault
2262     },
2263
2264     {
2265         WmNactiveTopShadowPixmap,
2266         XmCTopShadowPixmap,
2267         XtRString,
2268         sizeof (String),
2269         XtOffsetOf (AppearanceData, activeTopShadowPStr),
2270         XtRCallProc,
2271         (XtPointer)_WmATopShadowPixmapDefault
2272     }
2273
2274 };
2275
2276
2277 \f
2278 /*************************************<->*************************************
2279  *
2280  *  _WmIconImageFDefault (widget, offset, value)
2281  *  _WmIconImageBDefault (widget, offset, value)
2282  *  _WmIconImageBSCDefault (widget, offset, value)
2283  *  _WmIconImageBSPDefault (widget, offset, value)
2284  *  _WmIconImageTSCDefault (widget, offset, value)
2285  *  _WmIconImageTSPDefault (widget, offset, value)
2286  *  _WmMatteFDefault (widget, offset, value)
2287  *  _WmMatteBDefault (widget, offset, value)
2288  *  _WmMatteBSCDefault (widget, offset, value)
2289  *  _WmMatteBSPDefault (widget, offset, value)
2290  *  _WmMatteTSCDefault (widget, offset, value)
2291  *  _WmMatteTSPDefault (widget, offset, value)
2292  *
2293  *
2294  *  Description:
2295  *  -----------
2296  *  These functions are used to generate dynamic defaults for various
2297  *  client-specific appearance related resources.
2298  *
2299  *
2300  *  Inputs:
2301  *  ------
2302  *  widget = this is the parent widget for the wm subpart
2303  *
2304  *  offset = this is the resource offset
2305  *
2306  *  value = this is a pointer to a XrmValue in which to store the result
2307  *
2308  *  _pCD = (static global) pointer to client data associated with resources
2309  *
2310  * 
2311  *  Outputs:
2312  *  -------
2313  *  value = default resource value and size
2314  * 
2315  *************************************<->***********************************/
2316
2317 void 
2318 _WmIconImageFDefault (Widget widget, int offset, XrmValue *value)
2319 {
2320     _WmGetDynamicDefault (widget, WmFGC, 0,
2321         _pCD->iconImageBackground, value);
2322
2323 } /* END OF FUNCTION _WmIconImageFDefault */
2324
2325 void 
2326 _WmIconImageBDefault (Widget widget, int offset, XrmValue *value)
2327 {
2328     value->addr = (char *)&(_pCD->pSD->iconAppearance.background);
2329     value->size = sizeof (Pixel);
2330
2331 } /* END OF FUNCTION _WmIconImageBDefault */
2332
2333
2334 void 
2335 _WmIconImageBSCDefault (Widget widget, int offset, XrmValue *value)
2336 {
2337     _WmGetDynamicDefault (widget, WmBSC, 0,
2338         _pCD->iconImageBackground, value);
2339
2340 } /* END OF FUNCTION _WmIconImageBSCDefault */
2341
2342
2343 void 
2344 _WmIconImageBSPDefault (Widget widget, int offset, XrmValue *value)
2345 {
2346
2347     value->addr = (char *)_pCD->pSD->iconAppearance.bottomShadowPStr;
2348     value->size = sizeof (String);
2349
2350 } /* END OF FUNCTION _WmIconImageBSCDefault */
2351
2352
2353 void 
2354 _WmIconImageTSCDefault (Widget widget, int offset, XrmValue *value)
2355 {
2356     _WmGetDynamicDefault (widget, WmTSC, 0,
2357         _pCD->iconImageBackground, value);
2358
2359 } /* END OF FUNCTION _WmIconImageTSCDefault */
2360
2361
2362 void 
2363 _WmIconImageTSPDefault (Widget widget, int offset, XrmValue *value)
2364 {
2365
2366     value->addr = (char *)_pCD->pSD->iconAppearance.topShadowPStr;
2367     value->size = sizeof (String);
2368
2369 } /* END OF FUNCTION _WmIconImageTSPDefault */
2370
2371
2372 void 
2373 _WmMatteFDefault (Widget widget, int offset, XrmValue *value)
2374 {
2375     _WmGetDynamicDefault (widget, WmFGC, 0,
2376         _pCD->matteBackground, value);
2377
2378 } /* END OF FUNCTION _WmMatteFDefault */
2379
2380
2381 void 
2382 _WmMatteBDefault (Widget widget, int offset, XrmValue *value)
2383 {
2384     value->addr = (char *)&(_pCD->pSD->clientAppearance.background);
2385     value->size = sizeof (Pixel);
2386
2387 } /* END OF FUNCTION _WmMatteBDefault */
2388
2389
2390 void 
2391 _WmMatteBSCDefault (Widget widget, int offset, XrmValue *value)
2392 {
2393     _WmGetDynamicDefault (widget, WmBSC, 0,
2394         _pCD->matteBackground, value);
2395
2396 } /* END OF FUNCTION _WmMatteBSCDefault */
2397
2398
2399 void 
2400 _WmMatteBSPDefault (Widget widget, int offset, XrmValue *value)
2401 {
2402
2403     value->addr = (char *)_pCD->pSD->clientAppearance.bottomShadowPStr;
2404     value->size = sizeof (String);
2405
2406 } /* END OF FUNCTION _WmMatteBSCDefault */
2407
2408
2409 void 
2410 _WmMatteTSCDefault (Widget widget, int offset, XrmValue *value)
2411 {
2412     _WmGetDynamicDefault (widget, WmTSC, 0,
2413         _pCD->matteBackground, value);
2414
2415 } /* END OF FUNCTION _WmMatteTSCDefault */
2416
2417
2418 void 
2419 _WmMatteTSPDefault (Widget widget, int offset, XrmValue *value)
2420 {
2421
2422     value->addr = (char *)_pCD->pSD->clientAppearance.topShadowPStr;
2423     value->size = sizeof (String);
2424
2425 } /* END OF FUNCTION _WmMatteTSCDefault */
2426
2427
2428 \f
2429 /*************************************<->*************************************
2430  *
2431  *  _WmBackgroundDefault (widget, offset, value)
2432  *  _WmForegroundDefault (widget, offset, value)
2433  *  _WmBackgroundPixmapDefault (widget, offset, value)
2434  *  _WmBottomShadowColorDefault (widget, offset, value)
2435  *  _WmTopShadowColorDefault (widget, offset, value)
2436  *  _WmTopShadowPixmapDefault (widget, offset, value)
2437  *  _WmABackgroundDefault (widget, offset, value)
2438  *  _WmAForegroundDefault (widget, offset, value)
2439  *  _WmABackgroundPixmapDefault (widget, offset, value)
2440  *  _WmABottomShadowColorDefault (widget, offset, value)
2441  *  _WmRFBackgroundDefault (widget, offset, value)
2442  *  _WmRFForegroundDefault (widget, offset, value)
2443  *  _WmATopShadowColorDefault (widget, offset, value)
2444  *  _WmATopShadowPixmapDefault (widget, offset, value)
2445  *
2446  *
2447  *  Description:
2448  *  -----------
2449  *  These functions are used to generate dynamic defaults for various
2450  *  component appearance related resources (not client-specific).
2451  *
2452  *
2453  *  Inputs:
2454  *  ------
2455  *  widget = this is the parent widget for the wm subpart
2456  *
2457  *  offset = this is the resource offset
2458  *
2459  *  value = this is a pointer to a XrmValue in which to store the result
2460  *
2461  *  _defaultBackground = (static global) default background color (inactive)
2462  *
2463  *  _defaultActiveBackground = (static global) default bg color (active)
2464  *
2465  *  _pAppearanceData = (static global) pointer to resouce set structure
2466  *
2467  * 
2468  *  Outputs:
2469  *  -------
2470  *  value = default resource value and size
2471  * 
2472  *************************************<->***********************************/
2473
2474 void 
2475 _WmBackgroundDefault (Widget widget, int offset, XrmValue *value)
2476 {
2477     _WmGetDynamicDefault (widget, WmBGC, _defaultBackground, 0, value);
2478
2479 } /* END OF FUNCTION _WmBackgroundDefault */
2480
2481
2482 void 
2483 _WmForegroundDefault (Widget widget, int offset, XrmValue *value)
2484 {
2485     _WmGetDynamicDefault (widget, WmFGC, 0, _pAppearanceData->background,
2486         value);
2487
2488 } /* END OF FUNCTION _WmForegroundDefault */
2489
2490
2491 void 
2492 _WmBackgroundPixmapDefault (Widget widget, int offset, XrmValue *value)
2493 {
2494     static String string;
2495
2496
2497     if ((Monochrome (XtScreen (widget))) ||
2498         (_pAppearanceData->topShadowColor == _pAppearanceData->background))
2499     {
2500         string = (String) _25_foreground;
2501     }
2502     else
2503     {
2504         string = NULL;
2505     }
2506
2507     value->addr = (char *)string;
2508     value->size = sizeof (String);
2509
2510 } /* END OF FUNCTION _WmBackgroundPixmapDefault */
2511
2512
2513 void 
2514 _WmBottomShadowColorDefault (Widget widget, int offset, XrmValue *value)
2515 {
2516     _WmGetDynamicDefault (widget, WmBSC, 0, _pAppearanceData->background,
2517         value);
2518
2519 } /* END OF FUNCTION _WmBottomShadowColorDefault */
2520
2521
2522 void 
2523 _WmTopShadowColorDefault (Widget widget, int offset, XrmValue *value)
2524 {
2525     _WmGetDynamicDefault (widget, WmTSC, 0, _pAppearanceData->background,
2526         value);
2527
2528 } /* END OF FUNCTION _WmTopShadowColorDefault */
2529
2530
2531 void 
2532 _WmTopShadowPixmapDefault (Widget widget, int offset, XrmValue *value)
2533 {
2534     static String string;
2535
2536
2537     if ((Monochrome (XtScreen (widget))) ||
2538         (_pAppearanceData->topShadowColor == _pAppearanceData->background))
2539     {
2540         /* Fix monochrome 3D appearance */
2541         string = (String) _50_foreground;
2542         if (_pAppearanceData->backgroundPStr != NULL)
2543             if (!strcmp(_pAppearanceData->backgroundPStr, _25_foreground) ||
2544                 !strcmp(_pAppearanceData->backgroundPStr, _50_foreground))
2545             {
2546                 string = (String) _foreground;
2547             }
2548     }
2549     else
2550     {
2551         string = NULL;
2552     }
2553
2554     value->addr = (char *)string;
2555     value->size = sizeof (String);
2556
2557 } /* END OF FUNCTION _WmTopShadowPixmapDefault */
2558
2559
2560 void 
2561 _WmABackgroundDefault (Widget widget, int offset, XrmValue *value)
2562 {
2563     _WmGetDynamicDefault (widget, WmBGC, _defaultActiveBackground, 0, value);
2564
2565 } /* END OF FUNCTION _WmABackgroundDefault */
2566
2567
2568 void 
2569 _WmAForegroundDefault (Widget widget, int offset, XrmValue *value)
2570 {
2571     _WmGetDynamicDefault (widget, WmFGC, 0, _pAppearanceData->activeBackground,
2572         value);
2573
2574 } /* END OF FUNCTION _WmAForegroundDefault */
2575
2576 void 
2577 _WmABackgroundPixmapDefault (Widget widget, int offset, XrmValue *value)
2578 {
2579     static String string;
2580
2581
2582     if ((Monochrome (XtScreen (widget))) ||
2583         (_pAppearanceData->activeTopShadowColor ==
2584                                         _pAppearanceData->activeBackground))
2585     {
2586         string = (String) _50_foreground;
2587     }
2588     else
2589     {
2590         string = NULL;
2591     }
2592
2593     value->addr = (char *)string;
2594     value->size = sizeof (String);
2595
2596 } /* END OF FUNCTION _WmABackgroundPixmapDefault */
2597
2598 void 
2599 _WmABottomShadowColorDefault (Widget widget, int offset, XrmValue *value)
2600 {
2601     _WmGetDynamicDefault (widget, WmBSC, 0, _pAppearanceData->activeBackground,
2602         value);
2603
2604 } /* END OF FUNCTION _WmABottomShadowColorDefault */
2605
2606
2607 void 
2608 _WmATopShadowColorDefault (Widget widget, int offset, XrmValue *value)
2609 {
2610     _WmGetDynamicDefault (widget, WmTSC, 0, _pAppearanceData->activeBackground,
2611         value);
2612
2613 } /* END OF FUNCTION _WmATopShadowColorDefault */
2614
2615
2616 void 
2617 _WmATopShadowPixmapDefault (Widget widget, int offset, XrmValue *value)
2618 {
2619     static String string;
2620
2621     if ((Monochrome (XtScreen (widget))) ||
2622         (_pAppearanceData->activeTopShadowColor ==
2623                                      _pAppearanceData->activeBackground))
2624     {
2625         /* Fix monochrome 3D appearance */
2626         string = (String) _50_foreground;
2627         if (_pAppearanceData->activeBackgroundPStr != NULL)
2628             if (!strcmp
2629                     (_pAppearanceData->activeBackgroundPStr, _25_foreground) ||
2630                 !strcmp
2631                     (_pAppearanceData->activeBackgroundPStr, _50_foreground))
2632             {
2633                 string = (String) _foreground;
2634             }
2635     }
2636     else
2637     {
2638         string = NULL;
2639     }
2640     
2641     value->addr = (char *)string;
2642     value->size = sizeof (String);
2643     
2644 } /* END OF FUNCTION _WmATopShadowPixmapDefault */
2645
2646
2647 void 
2648 _WmBackdropBgDefault (Widget widget, int offset, XrmValue *value)
2649 {
2650     static Pixel pixValue;
2651     unsigned int colorSetId = (unsigned int) pResWS->backdrop.colorSet;
2652
2653     if (wmGD.statusColorServer == CSERVE_NORMAL)
2654     {
2655         if ((colorSetId == 0) || (colorSetId > XmCO_MAX_NUM_COLORS))
2656         {
2657             colorSetId = (unsigned int) DefaultWsColorSetId (pResWS);
2658         }
2659
2660         switch (pResWS->pSD->colorUse)
2661         {
2662             case XmCO_BLACK_WHITE:
2663                 pixValue = pResWS->pSD->pPixelData[colorSetId-1].bg;
2664                 break;
2665
2666             default:
2667             case XmCO_LOW_COLOR:
2668             case XmCO_MEDIUM_COLOR:
2669             case XmCO_HIGH_COLOR:
2670                 pixValue = pResWS->pSD->pPixelData[colorSetId-1].bs;
2671                 break;
2672         }
2673     }
2674     else
2675     {
2676         /*
2677          *  Color server is unavailable.  Has user specified a colorset?
2678          *
2679          *  If not, go monochrome.
2680          *
2681          */
2682             pixValue = WhitePixel (DISPLAY, pResWS->pSD->screen);
2683     }
2684
2685     /* return the dynamic default */
2686
2687     value->addr = (char *) &pixValue;
2688     value->size = sizeof (Pixel);
2689
2690 } /* END OF FUNCTION _WmBackdropBgDefault */
2691
2692 void 
2693 _WmBackdropFgDefault (Widget widget, int offset, XrmValue *value)
2694 {
2695     static Pixel pixValue;
2696     unsigned int colorSetId = (unsigned int) pResWS->backdrop.colorSet;
2697
2698     if (wmGD.statusColorServer == CSERVE_NORMAL)
2699     {
2700         if ((colorSetId == 0) || (colorSetId > XmCO_MAX_NUM_COLORS))
2701         {
2702             colorSetId = (unsigned int) DefaultWsColorSetId (pResWS);
2703         }
2704
2705         switch (pResWS->pSD->colorUse)
2706         {
2707             case XmCO_BLACK_WHITE:
2708                 pixValue = pResWS->pSD->pPixelData[colorSetId-1].fg;
2709                 break;
2710
2711             default:
2712             case XmCO_LOW_COLOR:
2713             case XmCO_MEDIUM_COLOR:
2714             case XmCO_HIGH_COLOR:
2715                 pixValue = pResWS->pSD->pPixelData[colorSetId-1].bg;
2716                 break;
2717         }
2718     }
2719     else
2720     {
2721         /*
2722          *  Color server is unavailable.  Has user specified a colorset?
2723          *
2724          *  If not, go monochrome.
2725          *
2726          */
2727             pixValue = BlackPixel (DISPLAY, pResWS->pSD->screen);
2728     }
2729     value->addr = (char *) &pixValue;
2730     value->size = sizeof (Pixel);
2731
2732 } /* END OF FUNCTION _WmBackdropFgDefault */
2733
2734 void 
2735 _WmBackdropColorSetDefault (Widget widget, int offset, XrmValue *value)
2736 {
2737     static unsigned int colorSetId;
2738
2739     if (wmGD.statusColorServer == CSERVE_NORMAL)
2740     {
2741         colorSetId = (unsigned int) DefaultWsColorSetId (pResWS);
2742     }
2743     else
2744     {
2745         colorSetId = 0; /* invalid color set */
2746     }
2747
2748     value->addr = (char *) &colorSetId;
2749     value->size = sizeof (Pixel);
2750
2751 } /* END OF FUNCTION _WmBackdropColorSetIdDefault */
2752
2753 void 
2754 _WmIconImageMaximumDefault (Widget widget, int offset, XrmValue *value)
2755 {
2756     static WHSize cval;
2757
2758     if ((pResSD->displayResolutionType == LOW_RES_DISPLAY) ||
2759         (pResSD->displayResolutionType == VGA_RES_DISPLAY))
2760     {
2761         cval.width = 32;
2762         cval.height = 32;
2763     }
2764     else
2765     {
2766         cval.width = 48;
2767         cval.height = 48;
2768     }
2769
2770     value->addr = (char *)  &cval;
2771     value->size = sizeof (WHSize);
2772
2773 } /* END OF FUNCTION _WmIconImageMaximumDefault */
2774
2775 \f
2776 /*************************************<->*************************************
2777  *
2778  *  DefaultWsColorSetId (pWS)
2779  *
2780  *
2781  *  Description:
2782  *  -----------
2783  *  This function returns the default colorSetId for a given workspace
2784  *
2785  *
2786  *  Inputs:
2787  *  ------
2788  *  pWS = ptr to workspace data
2789  * 
2790  *  Outputs:
2791  *  -------
2792  *  return = default color set ID.
2793  *
2794  *  "active" and "inactive" color sets are not used.
2795  * 
2796  *************************************<->***********************************/
2797
2798 int 
2799 DefaultWsColorSetId (WmWorkspaceData *pWS)
2800 {
2801     static int _ws_high_color_map[] = { 3, 5, 6, 7 };
2802 #define        _WS_HIGH_COLOR_COUNT     4    
2803     int i;
2804     WmScreenData *pSD;
2805     int iIndex;
2806     int rval = 8;
2807
2808     if (pWS)
2809     {
2810         pSD = pWS->pSD;
2811
2812         iIndex = (int) ((unsigned long)(pWS) - 
2813                           (unsigned long)(pSD->pWS))/sizeof(WmWorkspaceData);
2814         if (iIndex < 0) 
2815             iIndex = 0; /* bad pWS or pSD, shouldn't get here */
2816
2817         switch (pSD->colorUse)
2818         {
2819             case XmCO_BLACK_WHITE:
2820             case XmCO_LOW_COLOR:
2821                 rval = 1 +
2822                   (pSD->pInactivePixelSet-pSD->pPixelData)/sizeof(XmPixelSet);
2823                 break;
2824
2825             case XmCO_MEDIUM_COLOR:
2826                 rval = HARD_CODED_PRIMARY;
2827                 break;
2828
2829             case XmCO_HIGH_COLOR:
2830                 i = iIndex % _WS_HIGH_COLOR_COUNT;
2831                 rval = _ws_high_color_map[i];
2832                 break;
2833         }
2834     }
2835
2836     return (rval);
2837
2838 } /* END OF FUNCTION DefaultWsColorSetId */
2839
2840
2841
2842 \f
2843 /*************************************<->*************************************
2844  *
2845  *  _WmFocusAutoRaiseDefault (widget, offset, value)
2846  *
2847  *
2848  *  Description:
2849  *  -----------
2850  *  This function generates a default value for the focusAutoRaise resource.
2851  *
2852  *
2853  *  Inputs:
2854  *  ------
2855  *  widget = this is the parent widget for the wm subpart
2856  *
2857  *  offset = this is the resource offset
2858  *
2859  *  value = this is a pointer to a XrmValue in which to store the result
2860  *
2861  * 
2862  *  Outputs:
2863  *  -------
2864  *  value = default resource value and size
2865  * 
2866  *************************************<->***********************************/
2867
2868 void 
2869 _WmFocusAutoRaiseDefault (Widget widget, int offset, XrmValue *value)
2870 {
2871     static Boolean focusAutoRaise;
2872
2873     if (wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_EXPLICIT)
2874     {
2875         focusAutoRaise = True;
2876     }
2877     else
2878     {
2879         focusAutoRaise = False;
2880     }
2881
2882     value->addr = (char *)&focusAutoRaise;
2883     value->size = sizeof (Boolean);
2884
2885 } /* END OF FUNCTION _WmFocusAutoRaiseDefault */
2886
2887 \f
2888 /*************************************<->*************************************
2889  *
2890  *  _WmMultiClickTimeDefault (widget, offset, value)
2891  *
2892  *
2893  *  Description:
2894  *  -----------
2895  *  This function generates a default value for the doubleClickTime resource.
2896  *  We dynamically default to the XtR4 multiClickTime value.
2897  *
2898  *  Inputs:
2899  *  ------
2900  *  widget = this is the parent widget for the wm subpart
2901  *
2902  *  offset = this is the resource offset
2903  *
2904  *  value = this is a pointer to a XrmValue in which to store the result
2905  *
2906  *  Outputs:
2907  *  -------
2908  *  value = default resource value and size
2909  * 
2910  *************************************<->***********************************/
2911
2912 void 
2913 _WmMultiClickTimeDefault (Widget widget, int offset, XrmValue *value)
2914 {
2915     static int multiClickTime;
2916
2917     multiClickTime = XtGetMultiClickTime(XtDisplay(widget));
2918
2919     value->addr = (char *)&multiClickTime;
2920     value->size = sizeof (int);
2921
2922 } /* END OF FUNCTION _WmMultiClickTimeDefault */
2923
2924
2925 /*************************************<->*************************************
2926  *
2927  *  _WmSecondariesOnTopDefault (widget, offset, value)
2928  *
2929  *
2930  *  Description:
2931  *  -----------
2932  *  This function generates a default value for the secondariesOnTop 
2933  *  resource.
2934  *
2935  *  Inputs:
2936  *  ------
2937  *  widget = this is the parent widget for the wm subpart
2938  *
2939  *  offset = this is the resource offset
2940  *
2941  *  value = this is a pointer to a XrmValue in which to store the result
2942  *
2943  *  Outputs:
2944  *  -------
2945  *  value = default resource value and size
2946  * 
2947  *************************************<->***********************************/
2948
2949 void 
2950 _WmSecondariesOnTopDefault (Widget widget, int offset, XrmValue *value)
2951 {
2952     static Boolean secondariesOnTop;
2953
2954     /*
2955      * Inherit setting from primary window if this window is 
2956      * secondary. 
2957      */
2958
2959     if (_pCD->transientLeader != NULL)
2960         secondariesOnTop = _pCD->transientLeader->secondariesOnTop;
2961     else
2962         secondariesOnTop = True;
2963
2964     value->addr = (char *)&secondariesOnTop;
2965     value->size = sizeof (Boolean);
2966
2967 } /* END OF FUNCTION _WmSecondariesOnTopDefault */
2968
2969
2970 \f
2971 /******************************<->*************************************
2972  *
2973  *  ProcessWmResources ()
2974  *
2975  *
2976  *  Description:
2977  *  -----------
2978  *  This function is used to retrieve and process window manager resources
2979  *  that are not client-specific.
2980  *
2981  *
2982  *  Inputs:
2983  *  ------
2984  *  wmGlobalResources = pointer to wm resource list
2985  *
2986  * 
2987  *  Outputs:
2988  *  -------
2989  *  wmGD = (global data filled out with resource values)
2990  * 
2991  *************************************<->***********************************/
2992
2993 void 
2994 ProcessWmResources (void)
2995 {
2996
2997     /*
2998      * Process the mwm general appearance and behavior resources.  Retrieve
2999      * a limited set of resource values if the window manager is starting
3000      * up with the standard behavior.
3001      */
3002
3003     if (wmGD.useStandardBehavior)
3004     {
3005         XtGetApplicationResources (wmGD.topLevelW, (XtPointer) &wmGD,
3006             wmStdGlobalResources, XtNumber (wmStdGlobalResources), NULL, 0);
3007
3008         /*
3009          * Fill in the standard resource values.
3010          */
3011
3012         SetStdGlobalResourceValues ();
3013     }
3014     else
3015     {
3016         XtGetApplicationResources (wmGD.topLevelW, (XtPointer) &wmGD,
3017             wmGlobalResources, XtNumber (wmGlobalResources), NULL, 0);
3018     }
3019
3020     if (wmGD.autoRaiseDelay < 0)
3021     {
3022        wmGD.autoRaiseDelay = 500;
3023        Warning (((char *)GETMESSAGE(62, 66, "Out of range autoRaiseDelay resource value. Must be non-negative")));
3024     }
3025
3026 } /* END OF FUNCTION ProcessWmResources */
3027
3028
3029 \f
3030 /******************************<->*************************************
3031  *
3032  *  ProcessGlobalScreenResources ()
3033  *
3034  *
3035  *  Description:
3036  *  -----------
3037  *  This function is used to retrieve window manager resources to 
3038  *  determine the screens to manage.
3039  *
3040  *
3041  *  Inputs:
3042  *  ------
3043  *  wmGlobalScreenResources = pointer to wm resource list
3044  *
3045  * 
3046  *  Outputs:
3047  *  -------
3048  *  wmGD = (global data filled out with resource values)
3049  * 
3050  *************************************<->***********************************/
3051
3052 void 
3053 ProcessGlobalScreenResources (void)
3054 {
3055     XtGetApplicationResources (wmGD.topLevelW, &wmGD,
3056         wmGlobalScreenResources, 
3057         XtNumber (wmGlobalScreenResources), NULL, 0);
3058
3059     if (wmGD.multiScreen)
3060     {
3061         wmGD.numScreens = ScreenCount(DISPLAY);
3062     }
3063     else
3064     {
3065         wmGD.numScreens = 1;
3066     }
3067
3068     if (wmGD.screenList != NULL)
3069     {
3070         ProcessScreenListResource();
3071     }
3072 }
3073
3074
3075 \f
3076 /*************************************<->*************************************
3077  *
3078  *  SetStdGlobalResourceValues ()
3079  *
3080  *
3081  *  Description:
3082  *  -----------
3083  *  This function sets resource data to standard values.  This setting
3084  *  is done in place of getting the values from the user settings in
3085  *  the resource database.
3086  *
3087  * 
3088  *  Outputs:
3089  *  -------
3090  *  wmGD = (global data filled out with resource values)
3091  * 
3092  *************************************<->***********************************/
3093
3094 void 
3095 SetStdGlobalResourceValues (void)
3096 {
3097     wmGD.autoKeyFocus = True;
3098     wmGD.clientAutoPlace = True;
3099     wmGD.colormapFocusPolicy = CMAP_FOCUS_KEYBOARD;
3100     wmGD.deiconifyKeyFocus = True;
3101     wmGD.doubleClickTime = 500;
3102     wmGD.freezeOnConfig = True;
3103     wmGD.iconAutoPlace = True;
3104     wmGD.iconClick = True;
3105     wmGD.interactivePlacement = False;
3106     wmGD.keyboardFocusPolicy = KEYBOARD_FOCUS_EXPLICIT;
3107     wmGD.lowerOnIconify = True;
3108     wmGD.passSelectButton = True;
3109     wmGD.startupKeyFocus = True;
3110     wmGD.systemButtonClick = True;
3111     wmGD.systemButtonClick2 = True;
3112     wmGD.useFrontPanel=False;
3113
3114 } /* END OF FUNCTION SetStdGlobalResourceValues */
3115
3116
3117 \f
3118 /*************************************<->*************************************
3119  *
3120  *  ProcessScreenListResource ()
3121  *
3122  *
3123  *  Description:
3124  *  -----------
3125  *  This processes the names in the screenList resource.
3126  *
3127  *
3128  *  Inputs:
3129  *  ------
3130  *  wmGlobalResources = pointer to wmGD.screenList 
3131  *
3132  * 
3133  *  Outputs:
3134  *  -------
3135  *  wmGD.screenNames
3136  * 
3137  *************************************<->***********************************/
3138
3139 void 
3140 ProcessScreenListResource (void)
3141 {
3142     unsigned char *lineP;
3143     unsigned char *string;
3144     int sNum = 0;
3145     int nameCount = 0;
3146
3147     lineP = (unsigned char *)wmGD.screenList;
3148
3149     /*
3150      *  Parse screenList. 
3151      */
3152     while (((string = GetString(&lineP)) != NULL) && 
3153            (sNum < ScreenCount(DISPLAY)))
3154     {
3155         if (!(wmGD.screenNames[sNum] = (unsigned char *) 
3156             WmRealloc ((char*)wmGD.screenNames[sNum], strlen((char*)string)+1)))
3157         {
3158             ExitWM(WM_ERROR_EXIT_VALUE);
3159         }
3160         else 
3161         {
3162             strcpy((char *)wmGD.screenNames[sNum], (char *)string);
3163             nameCount++;
3164             sNum++;
3165         }
3166     }
3167
3168     /*
3169      * If the number of listed screens (sNum) is < screen count, fill in the 
3170      * remaining screen names with the name of the first screen specified,
3171      * if such exists.
3172      */
3173     if (nameCount > 0)
3174     {
3175         string = wmGD.screenNames[0];    /* name of the first screen */
3176         while (sNum < ScreenCount(DISPLAY))
3177         {
3178             if (!(wmGD.screenNames[sNum] = (unsigned char *) 
3179                 WmRealloc ((char*)wmGD.screenNames[sNum], 
3180                                 strlen((char *)string)+1)))
3181             {
3182                 ExitWM(WM_ERROR_EXIT_VALUE);
3183             }
3184             else 
3185             {
3186                 strcpy((char *)wmGD.screenNames[sNum], (char *)string);
3187                 sNum++;
3188             }
3189         }
3190     }
3191
3192         
3193 } /* END OF FUNCTION ProcessScreenListResource */
3194
3195
3196 /******************************<->*************************************
3197  *
3198  *  ProcessWmColors ()
3199  *
3200  *
3201  *  Description:
3202  *  -----------
3203  *  Retrieve the color sets from the colorserver.
3204  *
3205  *  Inputs:
3206  *  ------
3207  *  none
3208  * 
3209  *  Outputs:
3210  *  -------
3211  *  modifies parts of global pixel sets
3212  *
3213  *  Comments:
3214  *  --------
3215  * 
3216  ******************************<->***********************************/
3217
3218 void 
3219 ProcessWmColors (WmScreenData *pSD)
3220 {
3221     short active, inactive, primary, secondary;
3222
3223     if ((pSD->pPixelData = (XmPixelSet *) 
3224             XtMalloc (XmCO_NUM_COLORS * sizeof(XmPixelSet)))) 
3225     {
3226         /*
3227          *
3228          *
3229          *  ASSUMPTION:  If XmeGetPixelData() returns true,
3230          *  we have a good color server at our disposal.
3231          *
3232          *
3233          */
3234         if (XmeGetPixelData (pSD->screen, &pSD->colorUse,
3235                                 pSD->pPixelData, &active, &inactive,
3236                                 &primary, &secondary))
3237         {
3238             pSD->pActivePixelSet = &(pSD->pPixelData[active]);
3239             pSD->pInactivePixelSet = &(pSD->pPixelData[inactive]);
3240             pSD->pPrimaryPixelSet = &(pSD->pPixelData[primary]);
3241             pSD->pSecondaryPixelSet = &(pSD->pPixelData[secondary]);
3242
3243             /*  Hack here.  The index "4" is the proper array reference.   */
3244             /*  This is used because XmGetPixelData has not been properly  */
3245             /*  updated.                                                   */
3246             
3247             pSD->pTextPixelSet = &(pSD->pPixelData[3]);
3248
3249             wmGD.statusColorServer = CSERVE_NORMAL;
3250
3251         }
3252         else
3253         {
3254             XtFree((char *)pSD->pPixelData);
3255             pSD->pPixelData = NULL;
3256             pSD->pActivePixelSet = NULL;
3257             pSD->pInactivePixelSet = NULL;
3258             pSD->pPrimaryPixelSet = NULL;
3259             pSD->pSecondaryPixelSet = NULL;
3260             pSD->pTextPixelSet = NULL;
3261         }
3262     }
3263     else 
3264     {
3265         Warning (((char *)GETMESSAGE(62, 22, "Insufficient memory for color data")));
3266         ExitWM (WM_ERROR_EXIT_VALUE);
3267     }
3268
3269 } /* END OF FUNCTION ProcessWmColors */
3270
3271 \f
3272 /******************************<->*************************************
3273  *
3274  *  WriteOutXrmColors ()
3275  *
3276  *
3277  *  Description:
3278  *  -----------
3279  *  Update the XRM database with pixel values from the color server.
3280  *
3281  *  Inputs:
3282  *  ------
3283  *  pSD    = contains pixel sets
3284  * 
3285  *  Outputs:
3286  *  -------
3287  *  updated resource database
3288  *  
3289  *  Comments:
3290  *  --------
3291  *  N.B.  Must change to write out data on a PER-SCREEN basis.
3292  *        e.g., "Dtwm*0*background"
3293  ******************************<->***********************************/
3294
3295 static void 
3296 WriteOutXrmColors (WmScreenData *pSD)
3297 {
3298     XrmDatabase     db;
3299     XrmValue        value;
3300     int             thisScreen = pSD->screen;
3301     XmPixelSet     *tpixset;
3302     XmPixelSet     *spixset;
3303
3304     char *res_class;
3305     String screen_name;
3306
3307     if (MwmBehavior)
3308     {
3309         res_class = WM_RESOURCE_CLASS;
3310     }
3311     else 
3312     {
3313         res_class = DT_WM_RESOURCE_CLASS;
3314     }
3315
3316     screen_name = (String) wmGD.screenNames[pSD->screen];
3317
3318     db = XtScreenDatabase(XScreenOfDisplay(DISPLAY, thisScreen));
3319
3320     /** update the clients database with new colors **/
3321     value.size = sizeof(Pixel);
3322
3323     /*
3324      *
3325      *    WM ACTIVE RESOURCES--e.g., for the active frame 
3326      *
3327      */
3328     if (pSD->pActivePixelSet)
3329     {
3330         tpixset = pSD->pActivePixelSet;
3331         spixset = pSD->pSecondaryPixelSet;
3332
3333         if (pSD->colorUse == XmCO_BLACK_WHITE)
3334         {
3335             /*
3336              *
3337              *  Limit ourselves here to the client (frame)
3338              *  visuals
3339              *
3340              */
3341
3342             /* activeForeground */
3343             value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
3344
3345             XrmPutResource (&db, 
3346                 ResCat (res_class, screen_name, WmNactiveForeground, 
3347                         NULL), XtRPixel, &value);
3348
3349             /* activeBackground */
3350             value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
3351
3352             XrmPutResource (&db, 
3353                 ResCat (res_class, screen_name, WmNactiveBackground,
3354                         NULL), XtRPixel, &value);
3355
3356             XrmPutStringResource (&db, ResCat (res_class, screen_name, 
3357                      WmNactiveBackgroundPixmap, NULL),
3358                     _foreground);
3359
3360             /* activeTopShadow */
3361             XrmPutStringResource (&db, ResCat (res_class, screen_name, 
3362                     WmNactiveTopShadowPixmap, NULL),
3363                 _Dither);
3364
3365             value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
3366             XrmPutResource (&db,
3367                 ResCat (res_class, screen_name, WmNactiveTopShadowColor,
3368                         NULL), XtRPixel, &value);
3369
3370             /* activeBottomShadow */
3371             value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
3372             XrmPutResource (&db,
3373                 ResCat (res_class, screen_name, 
3374                         WmNactiveBottomShadowColor, NULL), XtRPixel, &value);
3375
3376             XrmPutStringResource (&db, ResCat (res_class, screen_name, 
3377                     WmNactiveBottomShadowPixmap, NULL),
3378                     _foreground);
3379         }
3380
3381         else /* active colors for non-BW systems */
3382         {
3383             value.addr = (XtPointer) &(tpixset->bg);
3384             XrmPutResource (&db, 
3385                 ResCat (res_class, screen_name, WmNactiveBackground, NULL),
3386                 XtRPixel, &value);
3387
3388             value.addr = (XtPointer) &(tpixset->fg);
3389             XrmPutResource (&db, 
3390                 ResCat (res_class, screen_name, WmNactiveForeground, NULL),
3391                 XtRPixel, &value);
3392
3393                 value.addr = (XtPointer) &(tpixset->ts);
3394                 XrmPutResource (&db, 
3395                     ResCat (res_class, screen_name, WmNactiveTopShadowColor, NULL),
3396                     XtRPixel, &value);
3397
3398                 value.addr = (XtPointer) &(tpixset->bs);
3399                 XrmPutResource (&db,
3400                     ResCat (res_class, screen_name, WmNactiveBottomShadowColor, NULL),
3401                     XtRPixel, &value);
3402
3403                 if (XmCO_DitherTopShadow(DISPLAY, thisScreen, tpixset)) 
3404                 {
3405                     XrmPutStringResource (&db, 
3406                         ResCat (res_class, screen_name, WmNactiveTopShadowPixmap, NULL),
3407                         _Dither);
3408
3409                 }
3410
3411                 if (XmCO_DitherBottomShadow(DISPLAY, thisScreen, tpixset)) 
3412                 {
3413                     XrmPutStringResource (&db,
3414                         ResCat (res_class, screen_name, WmNactiveBottomShadowPixmap, 
3415                                 NULL),
3416                         _Dither);
3417
3418                 }
3419         }
3420     }
3421     /*
3422      *
3423      *    WM INACTIVE colors--e.g., for dialogues
3424      *
3425      */
3426     if (pSD->pInactivePixelSet)
3427     {
3428         tpixset = pSD->pInactivePixelSet;
3429         spixset = pSD->pSecondaryPixelSet;
3430
3431         if (pSD->colorUse == XmCO_BLACK_WHITE)
3432         {
3433
3434            /*
3435             *
3436             *  Set colors/pixmaps for the frames--leave the
3437             *  menus out of it so that their text won't look
3438             *  unsatisfactory against a dithered background.
3439             *
3440             */
3441
3442             /* foreground */
3443             value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
3444
3445             XrmPutResource (&db, 
3446                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3447                         WmNforeground), XtRPixel, &value);
3448
3449             XrmPutResource (&db, 
3450                 ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3451                         WmNforeground), XtRPixel, &value);
3452
3453
3454             /* background */
3455             XrmPutStringResource (&db, 
3456                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3457                         WmNbackgroundPixmap), _Dither);
3458
3459             XrmPutStringResource (&db, 
3460                 ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3461                         WmNbackgroundPixmap), _Dither);
3462
3463             value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
3464             XrmPutResource (&db,
3465                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3466                         WmNbackground), XtRPixel, &value);
3467
3468             XrmPutResource (&db,
3469                 ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3470                         WmNbackground), XtRPixel, &value);
3471
3472             /* topshadow */
3473             XrmPutStringResource (&db, 
3474                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3475                         WmNtopShadowPixmap), _foreground);
3476
3477             XrmPutStringResource (&db, 
3478                 ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3479                         WmNtopShadowPixmap), _foreground);
3480
3481             value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
3482             XrmPutResource (&db,
3483                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3484                         WmNtopShadowColor), XtRPixel, &value);
3485
3486             XrmPutResource (&db,
3487                 ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3488                         WmNtopShadowColor), XtRPixel, &value);
3489
3490
3491             /* bottomshadow */
3492             XrmPutStringResource (&db, 
3493                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3494                         WmNbottomShadowPixmap), _foreground);
3495
3496             XrmPutStringResource (&db, 
3497                 ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3498                         WmNbottomShadowPixmap), _foreground);
3499
3500             value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
3501
3502             XrmPutResource (&db, 
3503                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3504                         WmNbottomShadowColor), XtRPixel, &value);
3505
3506             XrmPutResource (&db, 
3507                 ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3508                         WmNbottomShadowColor), XtRPixel, &value);
3509
3510                 /*
3511                  *
3512                  *  Ensure that the icon images have a black foreground and
3513                  *  a white background.
3514                  *
3515                  */
3516                     value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
3517
3518                     XrmPutResource (&db, 
3519                         ResCat (res_class, screen_name, WmNiconImageForeground,
3520                                 NULL), XtRPixel, &value);
3521
3522                     value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
3523
3524                     XrmPutResource (&db, 
3525                         ResCat (res_class, screen_name, WmNiconImageBackground,
3526                                 NULL), XtRPixel, &value);
3527
3528             /* Now deal with XmCO_BLACK_WHITE Menus */
3529
3530             /* XmCO_BLACK_WHITE menu foreground */
3531             value.addr = (XtPointer) &(tpixset->fg);
3532
3533             XrmPutResource (&db, 
3534                 ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3535                         WmNforeground), XtRPixel, &value);
3536
3537             /* XmCO_BLACK_WHITE menu background */
3538             value.addr = (XtPointer) &(tpixset->bg);
3539
3540             XrmPutResource (&db, 
3541                 ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3542                         WmNbackground), XtRPixel, &value);
3543
3544             /* XmCO_BLACK_WHITE menu top shadow */
3545
3546             XrmPutStringResource (&db, 
3547                 ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3548                         WmNtopShadowPixmap), _50_foreground);
3549
3550             /* use foreground color for this pixmap */
3551             value.addr = (XtPointer) &(tpixset->fg);
3552
3553             XrmPutResource (&db,
3554                 ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3555                         WmNtopShadowColor), XtRPixel, &value);
3556
3557             /* XmCO_BLACK_WHITE menu bottom shadow */
3558
3559             XrmPutStringResource (&db, 
3560                 ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3561                         WmNbottomShadowPixmap), _75_foreground);
3562
3563             /* use foreground color for this pixmap */
3564             value.addr = (XtPointer) &(tpixset->fg);
3565
3566             XrmPutResource (&db, 
3567                 ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3568                         WmNbottomShadowColor), XtRPixel, &value);
3569
3570             /* Finally, deal with XmCO_BLACK_WHITE Confirm Boxes */
3571
3572             /* XmCO_BLACK_WHITE confirm box foreground */
3573             value.addr = (XtPointer) &(spixset->fg);
3574
3575             XrmPutResource (&db, 
3576                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3577                         WmNforeground), XtRPixel, &value);
3578
3579             /* XmCO_BLACK_WHITE confirm box background */
3580             value.addr = (XtPointer) &(spixset->bg);
3581
3582             XrmPutResource (&db, 
3583                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3584                         WmNbackground), XtRPixel, &value);
3585
3586             /* XmCO_BLACK_WHITE confirm box top shadow */
3587
3588             XrmPutStringResource (&db, 
3589                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3590                         WmNtopShadowPixmap), _50_foreground);
3591
3592             /* use foreground color */
3593             value.addr = (XtPointer) &(spixset->fg);
3594
3595             XrmPutResource (&db,
3596                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3597                         WmNtopShadowColor), XtRPixel, &value);
3598
3599             /* XmCO_BLACK_WHITE confirm box bottom shadow */
3600
3601             XrmPutStringResource (&db, 
3602                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3603                         WmNbottomShadowPixmap), _75_foreground);
3604
3605             /* use foreground color */
3606             value.addr = (XtPointer) &(spixset->fg);
3607
3608             XrmPutResource (&db, 
3609                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3610                         WmNbottomShadowColor), XtRPixel, &value);
3611
3612             /* use select color for icon box trough color */    
3613
3614             value.addr = (XtPointer) &(tpixset->sc);
3615
3616             XrmPutResource (&db,
3617                 ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART, 
3618                         XmNtroughColor), XtRPixel, &value);
3619
3620             /* use select color for arm and select colors in dialogs */ 
3621
3622             value.addr = (XtPointer) &(spixset->sc);
3623
3624             XrmPutResource (&db,
3625                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART, 
3626                         XmNarmColor), XtRPixel, &value);
3627
3628             XrmPutResource (&db,
3629                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART, 
3630                         XmNselectColor), XtRPixel, &value);
3631
3632             XrmPutResource (&db,
3633                 ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART, 
3634                         XmNtroughColor), XtRPixel, &value);
3635         }
3636         else /* inactive colors for non-BW systems */
3637         {
3638                 XmPixelSet     *fpixset;
3639
3640                 /*
3641                  * Set mwm component colors 
3642                  */
3643                 value.addr = (XtPointer) &(tpixset->bg);
3644                 XrmPutResource (&db,
3645                     ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3646                             WmNbackground), XtRPixel, &value);
3647
3648                 XrmPutResource (&db,
3649                     ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3650                             WmNbackground), XtRPixel, &value);
3651
3652                 XrmPutResource (&db, 
3653                     ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3654                             WmNbackground), XtRPixel, &value);
3655
3656                 value.addr = (XtPointer) &(spixset->bg);
3657                 XrmPutResource (&db, 
3658                     ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3659                             WmNbackground), XtRPixel, &value);
3660
3661                 value.addr = (XtPointer) &(tpixset->ts);
3662                 XrmPutResource (&db,
3663                     ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3664                             WmNtopShadowColor), XtRPixel, &value);
3665
3666                 XrmPutResource (&db,
3667                     ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3668                             WmNtopShadowColor), XtRPixel, &value);
3669
3670                 XrmPutResource (&db, 
3671                     ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3672                             WmNtopShadowColor), XtRPixel, &value);
3673
3674                 value.addr = (XtPointer) &(spixset->ts);
3675                 XrmPutResource (&db, 
3676                     ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3677                             WmNtopShadowColor), XtRPixel, &value);
3678
3679                 value.addr = (XtPointer) &(tpixset->bs);
3680                 XrmPutResource (&db,
3681                     ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3682                             WmNbottomShadowColor), XtRPixel, &value);
3683
3684                 XrmPutResource (&db,
3685                     ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3686                             WmNbottomShadowColor), XtRPixel, &value);
3687
3688                 XrmPutResource (&db, 
3689                     ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3690                             WmNbottomShadowColor), XtRPixel, &value);
3691
3692                 value.addr = (XtPointer) &(spixset->bs);
3693                 XrmPutResource (&db, 
3694                     ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3695                             WmNbottomShadowColor), XtRPixel, &value);
3696
3697                 value.addr = (XtPointer) &(tpixset->fg);
3698                 XrmPutResource (&db,
3699                     ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
3700                             WmNforeground), XtRPixel, &value);
3701
3702                 XrmPutResource (&db,
3703                     ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
3704                             WmNforeground), XtRPixel, &value);
3705
3706                 XrmPutResource (&db, 
3707                     ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
3708                             WmNforeground), XtRPixel, &value);
3709
3710                 value.addr = (XtPointer) &(spixset->fg);
3711                 XrmPutResource (&db, 
3712                     ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
3713                             WmNforeground), XtRPixel, &value);
3714
3715                 /*
3716                  * Set select color only for menus and feedback mwm
3717                  * parts. Client and Icon parts aren't real widgets.
3718                  * Set client trough color for icon box.
3719                  */
3720                 value.addr = (XtPointer) &(tpixset->sc);
3721                 XrmPutResource (&db,
3722                    ResCat (res_class, screen_name, (char *)MENU_ITEM_PART, 
3723                             XmNselectColor), XtRPixel, &value);
3724          
3725                 XrmPutResource (&db,
3726                    ResCat (res_class, screen_name, (char *)MENU_ITEM_PART, 
3727                             XmNarmColor), XtRPixel, &value);
3728
3729                 XrmPutResource (&db,
3730                    ResCat (res_class, screen_name, (char *)MENU_ITEM_PART, 
3731                             XmNtroughColor), XtRPixel, &value);
3732
3733                 XrmPutResource (&db,
3734                    ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART, 
3735                             XmNtroughColor), XtRPixel, &value);
3736
3737                 XrmPutResource (&db,
3738                    ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART, 
3739                             XmNselectColor), XtRPixel, &value);
3740          
3741                 value.addr = (XtPointer) &(spixset->sc);
3742                 XrmPutResource (&db,
3743                    ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART, 
3744                             XmNarmColor), XtRPixel, &value);
3745
3746                 XrmPutResource (&db,
3747                    ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART, 
3748                             XmNtroughColor), XtRPixel, &value);
3749
3750                 /*
3751                  * Set Dtwm dialog colors
3752                  */
3753                 fpixset = pSD->pSecondaryPixelSet;
3754
3755                 value.addr = (XtPointer) &(fpixset->bg);
3756                 XrmPutResource (&db, 
3757                     ResCat (res_class, screen_name, XmNbackground, NULL),
3758                     XtRPixel, &value);
3759
3760                 value.addr = (XtPointer) &(fpixset->fg);
3761                 XrmPutResource (&db,
3762                     ResCat (res_class, screen_name, XmNforeground, NULL),
3763                     XtRPixel, &value);
3764
3765                 value.addr = (XtPointer) &(fpixset->ts);
3766                 XrmPutResource (&db, 
3767                     ResCat (res_class, screen_name, XmNtopShadowColor, NULL),
3768                     XtRPixel, &value);
3769
3770                 value.addr = (XtPointer) &(fpixset->bs);
3771                 XrmPutResource (&db, 
3772                     ResCat (res_class, screen_name, XmNbottomShadowColor, NULL),
3773                     XtRPixel, &value);
3774
3775                 /*
3776                  *
3777                  *  Set up the select color, as for buttons in the dialogue
3778                  *  boxes.
3779                  *
3780                  */
3781                  value.addr = (XtPointer) &(fpixset->sc);
3782                  XrmPutResource (&db,
3783                     ResCat (res_class, screen_name, XmNselectColor, NULL),
3784                         XtRPixel, &value);
3785          
3786                  /* value.addr = (XtPointer) &(fpixset->sc); */
3787                  XrmPutResource (&db,
3788                     ResCat (res_class, screen_name, XmNarmColor, NULL),
3789                         XtRPixel, &value);
3790
3791                  /* value.addr = (XtPointer) &(fpixset->sc); */
3792                  XrmPutResource (&db,
3793                     ResCat (res_class, screen_name, XmNtroughColor, NULL),
3794                         XtRPixel, &value);
3795
3796                 if (XmCO_DitherTopShadow(DISPLAY, thisScreen, fpixset)) 
3797                 {
3798                     XrmPutStringResource (&db, 
3799                         ResCat (res_class, screen_name, WmNtopShadowPixmap, NULL),
3800                         _Dither);
3801
3802                     if (pSD->colorUse == XmCO_BLACK_WHITE)
3803                     {
3804                         XrmPutStringResource (&db, 
3805                             ResCat (res_class, screen_name, 
3806                                 WmNbottomShadowPixmap, NULL),
3807                             _NoDither);
3808
3809                     }
3810                 }
3811
3812                 if (XmCO_DitherBottomShadow(DISPLAY, thisScreen, fpixset)) 
3813                 {
3814                     XrmPutStringResource (&db, 
3815                         ResCat (res_class, screen_name, WmNbottomShadowPixmap, NULL),
3816                         _Dither);
3817
3818                     if (pSD->colorUse == XmCO_BLACK_WHITE)
3819                     {
3820                         XrmPutStringResource (&db, 
3821                             ResCat (res_class, screen_name, 
3822                                 WmNtopShadowPixmap, NULL),
3823                             _NoDither);
3824
3825                     }
3826                 }
3827
3828                 if (tpixset->bs != tpixset->ts)
3829                 /*
3830                  *
3831                  *   If the inactive bottomshadow and topshadow are
3832                  *   different (i.e., valid), then make the icon image
3833                  *   use those colors.
3834                  */
3835                 {
3836                     value.addr = (XtPointer) &(tpixset->bs);
3837
3838                     XrmPutResource (&db, 
3839                         ResCat (res_class, screen_name, WmNiconImageForeground,
3840                                 NULL), XtRPixel, &value);
3841
3842                     value.addr = (XtPointer) &(tpixset->ts);
3843
3844                     XrmPutResource (&db, 
3845                         ResCat (res_class, screen_name, WmNiconImageBackground,
3846                                 NULL), XtRPixel, &value);
3847
3848                     value.addr = (XtPointer) &(tpixset->bs);
3849
3850                     XrmPutResource (&db, 
3851                         ResCat (res_class, screen_name, 
3852                                 WmNiconImageBottomShadowColor,
3853                                 NULL), XtRPixel, &value);
3854
3855                     value.addr = (XtPointer) &(tpixset->ts);
3856
3857                     XrmPutResource (&db, 
3858                         ResCat (res_class, screen_name, 
3859                                 WmNiconImageTopShadowColor,
3860                                 NULL), XtRPixel, &value);
3861                 }
3862                 else
3863                 /*
3864                  *
3865                  *  Ensure that the icon images have a black foreground and
3866                  *  a white background.
3867                  *
3868                  */
3869                 {
3870                     value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
3871
3872                     XrmPutResource (&db, 
3873                         ResCat (res_class, screen_name, WmNiconImageForeground,
3874                                 NULL), XtRPixel, &value);
3875
3876                     value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
3877
3878                     XrmPutResource (&db, 
3879                         ResCat (res_class, screen_name, WmNiconImageBackground,
3880                                 NULL), XtRPixel, &value);
3881                 }
3882         }
3883     }
3884
3885
3886     if (pSD->pTextPixelSet)
3887     {
3888        value.addr = (XtPointer) &(pSD->pTextPixelSet->bg);
3889
3890        XrmPutResource (&db,
3891           ResCat (res_class, screen_name, "XmTextField",
3892                   WmNbackground), XtRPixel, &value);
3893
3894        XrmPutResource (&db,
3895           ResCat (res_class, screen_name, "XmText",
3896                   WmNbackground), XtRPixel, &value);
3897     }
3898 }
3899
3900 \f
3901 /******************************<->*************************************
3902  *
3903  *  ResCat (s1,s2,s3,s4)
3904  *
3905  *
3906  *  Description:
3907  *  -----------
3908  *  Cats up to four strings together with '*' in between.
3909  *
3910  *
3911  *  Inputs:
3912  *  ------
3913  *  s1...s4 = pointers to Strings or NULL pointers (no string)
3914  * 
3915  *  Outputs:
3916  *  -------
3917  *  Return = pointer to statically allocated string that has 
3918  *           the passed in string cat'ed together with '*'s 
3919  *           in between.
3920  *
3921  *  Comments:
3922  *  --------
3923  *  Does no limit checking on the static buffer 
3924  * 
3925  *************************************<->***********************************/
3926
3927 String
3928 ResCat (String s1, String s2, String s3, String s4)
3929 {
3930
3931
3932     int count;
3933
3934     Boolean useResourceClass = True;
3935
3936     wmGD.tmpBuffer[0] = '\0';
3937
3938     count = MAXBUF - 1;
3939
3940     if (s1)
3941     {
3942         if ((MwmBehavior) &&
3943             !strcmp (s1, WM_RESOURCE_CLASS))
3944         /*
3945          *
3946          *  if this routine is called with a class name
3947          *  ("Mwm" or "Dtwm"), then DON'T use it.
3948          *  We want our resources to be written out
3949          *  as:  *iconImageForeground:   <pixel_val>
3950          *
3951          *  as opposed to:  Dtwm*iconImageForeground:   <pixel_val>
3952          *
3953          */
3954         {
3955                 useResourceClass = False;
3956         }
3957         else if (!strcmp (s1, DT_WM_RESOURCE_CLASS))
3958         {
3959                 useResourceClass = False;
3960         }
3961         else
3962         {
3963             strncat((char *)wmGD.tmpBuffer, s1, count);
3964             count -= strlen(s1);
3965         }
3966
3967         if (s2 && (count > 0))
3968         {
3969             strncat ((char *)wmGD.tmpBuffer, "*", count);
3970             count -= 1;
3971             strncat ((char *)wmGD.tmpBuffer, s2, count);
3972             count -= strlen (s2);
3973
3974             if (s3 && (count > 0))
3975             {
3976                 strncat ((char *)wmGD.tmpBuffer, "*", count);
3977                 count -= 1;
3978                 strncat ((char *)wmGD.tmpBuffer, s3, count);
3979                 count -= strlen (s3);
3980
3981                 if (s4)
3982                 {
3983                     strncat ((char *)wmGD.tmpBuffer, "*", count);
3984                     count -= 1;
3985                     strncat ((char *)wmGD.tmpBuffer, s4, count);
3986                 }
3987             }
3988         }
3989     }
3990     return ((String) wmGD.tmpBuffer);
3991
3992 } /* END OF FUNCTION ResCat */
3993
3994
3995 \f
3996 /******************************<->*************************************
3997  *
3998  *  CheckForNoDither (pAD)
3999  *
4000  *
4001  *  Description:
4002  *  -----------
4003  *  Checks for reserved string as pixmap name of dither that indicates
4004  *  no dithering and replaces the string with a NULL.
4005  *
4006  *
4007  *  Inputs:
4008  *  ------
4009  *  pAD   = pointer to appearance data
4010  * 
4011  *  Outputs:
4012  *  -------
4013  *  pAD   = pointer to appearance data (may be modified)
4014  *
4015  *  Comments:
4016  *  ---------
4017  *  This check is done to avoid repeated calls to XmGetPixmap when
4018  *  managing windows. XmGetPixmap doesn't cache failures, and the
4019  *  NoDither string should fail every time. We want to prevent 
4020  *  XmGetPixmap from call XtResolvePathName to rummage through
4021  *  the file system.
4022  *
4023  *************************************<->***********************************/
4024
4025 void 
4026 CheckForNoDither (AppearanceData *pAD)
4027 {
4028     if (pAD->backgroundPStr && 
4029         !strcmp(pAD->backgroundPStr, _NoDither))
4030     {
4031         pAD->backgroundPStr = NULL;
4032     }
4033     if (pAD->bottomShadowPStr && 
4034         !strcmp(pAD->bottomShadowPStr, _NoDither))
4035     {
4036         pAD->bottomShadowPStr = NULL;
4037     }
4038     if (pAD->topShadowPStr && 
4039         !strcmp(pAD->topShadowPStr, _NoDither))
4040     {
4041         pAD->topShadowPStr = NULL;
4042     }
4043     if (pAD->activeBackgroundPStr && 
4044         !strcmp(pAD->activeBackgroundPStr, _NoDither))
4045     {
4046         pAD->activeBackgroundPStr = NULL;
4047     }
4048     if (pAD->activeBottomShadowPStr && 
4049         !strcmp(pAD->activeBottomShadowPStr, _NoDither))
4050     {
4051         pAD->activeBottomShadowPStr = NULL;
4052     }
4053     if (pAD->activeTopShadowPStr &&
4054         !strcmp(pAD->activeTopShadowPStr, _NoDither))
4055     {
4056         pAD->activeTopShadowPStr = NULL;
4057     }
4058
4059 } /* END OF FUNCTION CheckForNoDither */
4060
4061
4062
4063 \f
4064 /******************************<->*************************************
4065  *
4066  *  ProcessAppearanceResources (pSD)
4067  *
4068  *
4069  *  Description:
4070  *  -----------
4071  *  Retrieve and process the general appearance resources for the mwm
4072  *  subparts: "client", "icon", and "feedback"
4073  *
4074  *
4075  *  Inputs:
4076  *  ------
4077  *  pSD   = pointer to screen data
4078  * 
4079  *  Outputs:
4080  *  -------
4081  *  modifies parts of global data wmGD.
4082  *
4083  *  Comments:
4084  *  --------
4085  *  o Changeable GCs are created with XCreateGC. The base GCs used for
4086  *    text output will have clip_masks defined for them later.
4087  *  
4088  * 
4089  *************************************<->***********************************/
4090
4091 void 
4092 ProcessAppearanceResources (WmScreenData *pSD)
4093 {
4094     Widget clientW;             /* dummy widget for resource fetching */
4095     int i;
4096     Arg args[10];
4097
4098
4099     /*
4100      * Get the client subpart resources:
4101      */
4102
4103     /* save info in static globals for dynamic default processing */
4104     _defaultBackground = _defaultColor1;
4105     _defaultActiveBackground = _defaultColor2;
4106     _pAppearanceData = &(pSD->clientAppearance);
4107
4108     (void)XtGetSubresources (pSD->screenTopLevelW, 
4109               (XtPointer) &(pSD->clientAppearance),
4110               WmNclient, WmCClient, wmAppearanceResources, 
4111               XtNumber (wmAppearanceResources), NULL, 0);
4112     CheckForNoDither (&(pSD->clientAppearance));
4113
4114
4115     /*
4116      * Process the client resource values:
4117      */
4118
4119     /* make background, top and bottom shadow pixmaps */
4120
4121     MakeAppearanceResources (pSD, &(pSD->clientAppearance), True);
4122
4123
4124     /*
4125      * Get the client.title subpart resources:
4126      */
4127
4128         /* insert "client" widget in hierarchy */
4129
4130     i = 0;
4131     clientW = XtCreateWidget (WmNclient, xmRowColumnWidgetClass, 
4132                         pSD->screenTopLevelW, (ArgList) args, i);
4133
4134
4135         /* fetch "client.title" subpart appearance resources */
4136
4137     _pAppearanceData = &(pSD->clientTitleAppearance);
4138
4139     (void)XtGetSubresources (clientW, (XtPointer) &(pSD->clientTitleAppearance),
4140               WmNtitle, WmCTitle, wmAppearanceResources, 
4141               XtNumber (wmAppearanceResources), NULL, 0);
4142     CheckForNoDither (&(pSD->clientTitleAppearance));
4143
4144
4145     /*
4146      * Process the client.title resource values:
4147      */
4148
4149
4150     /* 
4151      * check if client title appearance is different from the rest of frame.
4152      */
4153     if (SimilarAppearanceData (&(pSD->clientAppearance), 
4154                                &(pSD->clientTitleAppearance)))
4155     {
4156         /* title bar doesn't need special graphic processing */
4157         pSD->decoupleTitleAppearance = False;
4158     }
4159     else 
4160     {
4161         /* make background, top and bottom shadow pixmaps */
4162         MakeAppearanceResources (pSD, &(pSD->clientTitleAppearance), True);
4163         pSD->decoupleTitleAppearance = True;
4164     }
4165
4166     XtDestroyWidget (clientW);  /* all done with dummy widget */
4167
4168
4169     /*
4170      * Get the icon subpart resources:
4171      */
4172
4173     _pAppearanceData = &(pSD->iconAppearance);
4174
4175     (void)XtGetSubresources (pSD->screenTopLevelW, 
4176               (XtPointer) &(pSD->iconAppearance),
4177               WmNicon, WmCIcon, wmAppearanceResources, 
4178               XtNumber (wmAppearanceResources), NULL, 0);
4179     CheckForNoDither (&(pSD->iconAppearance));
4180
4181
4182     /*
4183      * Process the icon resource values:
4184      */
4185
4186     /* make background, top and bottom shadow pixmaps */
4187
4188     MakeAppearanceResources (pSD, &(pSD->iconAppearance), True);
4189
4190
4191     /*
4192      * Get the feedback subpart resources:
4193      * !!! only get "inactive" resources !!!
4194      */
4195
4196     _defaultBackground = _defaultColor2;
4197     _defaultActiveBackground = _defaultColor2;
4198     _pAppearanceData = &(pSD->feedbackAppearance);
4199
4200     (void)XtGetSubresources (pSD->screenTopLevelW, 
4201               (XtPointer) &(pSD->feedbackAppearance),
4202               WmNfeedback, WmCFeedback, wmAppearanceResources, 
4203               XtNumber (wmAppearanceResources), NULL, 0);
4204     CheckForNoDither (&(pSD->feedbackAppearance));
4205
4206     /*
4207      * Process the feedback resource values:
4208      */
4209
4210     /* make background, top and bottom shadow pixmaps */
4211
4212     MakeAppearanceResources (pSD, &(pSD->feedbackAppearance), False);
4213
4214
4215 } /* END OF FUNCTION ProcessAppearanceResources */
4216
4217
4218 \f
4219 /*************************************<->*************************************
4220  *
4221  *  FallbackMakeTitleHeight (pAData)
4222  *
4223  *
4224  *  Description:
4225  *  -----------
4226  *  This function makes title hight for AppearanceData
4227  *  (using XExtentsOfFontSet on pAData->fontList)
4228  *
4229  *  Inputs:
4230  *  ------
4231  *
4232  *  pAData = pointer to appearance data structure containing resource info
4233  *
4234  *
4235  *  Outputs:
4236  *  -------
4237  *  *pAData - pAData->titleHeight is updated
4238  *  return = 1 on success, 0 on failure (pAData->titleHeight is intact)
4239  *
4240  *************************************<->***********************************/
4241
4242 int
4243 FallbackMakeTitleHeight (AppearanceData *pAData) {
4244   XmFontContext       fc;
4245   XmFontType          type;
4246   XmFontListEntry     entry;
4247   XtPointer           pFont;
4248   XFontSetExtents     *pExtents;
4249   int                 result = 0;
4250
4251   XmFontListInitFontContext ( &fc, pAData->fontList);
4252   pAData->titleHeight = 0;
4253   entry = XmFontListNextEntry (fc);
4254   while (entry)
4255   {
4256     pFont = XmFontListEntryGetFont (entry, &type);
4257     switch (type)
4258     {
4259     case XmFONT_IS_FONT:
4260       /* does not really happen since XmeRenderTableGetDefaultFont
4261          seems to fail only on fontsets */
4262       break;
4263     case XmFONT_IS_FONTSET:
4264       if (!(pExtents = XExtentsOfFontSet ((XFontSet) pFont))) {
4265         break;
4266       }
4267       if (WM_TITLE_BAR_PADDING + pExtents->max_logical_extent.height > pAData->titleHeight) {
4268         pAData->titleHeight = WM_TITLE_BAR_PADDING + pExtents->max_logical_extent.height;
4269         result = 1;
4270       }
4271       break;
4272     default:
4273       break;
4274     }
4275     entry = XmFontListNextEntry (fc);
4276   }
4277   XmFontListFreeFontContext (fc);
4278   return result;
4279 }
4280
4281 \f
4282 /*************************************<->*************************************
4283  *
4284  *  MakeAppearanceResources (pSD, pAData, makeActiveResources)
4285  *
4286  *
4287  *  Description:
4288  *  -----------
4289  *  This function makes top, bottom and background pixmaps for a window
4290  *  manager component.  Inactive and active (if specified) GC's are
4291  *  also made.
4292  *
4293  *
4294  *  Inputs:
4295  *  ------
4296  *  pSD = pointer to screen data
4297  *
4298  *  pAData = pointer to appearance data structure containing resource info
4299  *
4300  *  makeActiveResources = if True then make active resources
4301  * 
4302  *  Outputs:
4303  *  -------
4304  *  *pAData = pixmap and GC fields filled out
4305  *
4306  *************************************<->***********************************/
4307
4308 void 
4309 MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean makeActiveResources)
4310 {
4311     Pixel foreground;
4312
4313     /*
4314      * Extract a font from the font list.
4315      */
4316
4317     if (! XmeRenderTableGetDefaultFont(pAData->fontList, &(pAData->font)))
4318     {
4319         sprintf((char *)wmGD.tmpBuffer, ((char *)GETMESSAGE(62, 23, "failed to load font: %.100s\0")), (char*) pAData->fontList);
4320         Warning((char *)wmGD.tmpBuffer);
4321 #if defined(CSRG_BASED) || defined(__linux__)
4322         /* HACK to try get _some_ font anyway (fontList seems to end up as an empty list on
4323          * some modern systems; investigate) */
4324         pAData->font = XLoadQueryFont(wmGD.display, "fixed");
4325         if (pAData->font == NULL)
4326         {
4327           ExitWM(WM_ERROR_EXIT_VALUE);
4328         }
4329         /* try to get right title hight using XExtentsOfFontSet: on UTF-8
4330          * locales XmeRenderTableGetDefaultFont does not return anything
4331          * when font is a compound fontset*/
4332         if (!FallbackMakeTitleHeight(pAData))
4333         {
4334           /* failed to get height from fontList - falling back to fixed */
4335           pAData->titleHeight = (pAData->font)->ascent + (pAData->font)->descent
4336             + WM_TITLE_BAR_PADDING;
4337         }
4338 #else
4339         ExitWM(WM_ERROR_EXIT_VALUE);
4340 #endif
4341     } else {
4342         /* got default font successfully, hack was not needed */
4343         /*
4344          *  Calculate title bar's height (using selected font) and store it in pAData.
4345          */
4346         pAData->titleHeight = (pAData->font)->ascent + (pAData->font)->descent
4347         + WM_TITLE_BAR_PADDING;
4348     }
4349
4350
4351
4352     /*
4353      * Make standard (inactive) appearance resources.
4354      */
4355
4356     /* background pixmap */
4357
4358     if (pAData->backgroundPStr)
4359     {
4360         pAData->backgroundPixmap = XmGetPixmap (
4361                                        ScreenOfDisplay (DISPLAY, 
4362                                            pSD->screen),
4363                                        pAData->backgroundPStr,
4364                                        pAData->foreground,
4365                                        pAData->background);
4366
4367         if (pAData->backgroundPixmap == XmUNSPECIFIED_PIXMAP)
4368         {
4369             pAData->backgroundPixmap = (Pixmap)NULL;
4370         }
4371     }
4372     else
4373     {
4374         pAData->backgroundPixmap = (Pixmap)NULL;
4375     }
4376
4377     /* top shadow pixmap */
4378
4379     if (pAData->topShadowPStr)
4380     {
4381         /*
4382          * Make sure top shadow color is not the same as background
4383          * otherwise the wrong pixmap will be generated.
4384          */
4385         if (pAData->topShadowColor != pAData->background)
4386             foreground = pAData->topShadowColor;
4387         else
4388             foreground = pAData->foreground;
4389         pAData->topShadowPixmap = XmGetPixmap (
4390                                        ScreenOfDisplay (DISPLAY,
4391                                            pSD->screen),
4392                                        pAData->topShadowPStr,
4393                                        foreground,
4394                                        pAData->background);
4395
4396         if (pAData->topShadowPixmap == XmUNSPECIFIED_PIXMAP)
4397         {
4398             pAData->topShadowPixmap = (Pixmap)NULL;
4399         }
4400     }
4401     else
4402     {
4403         pAData->topShadowPixmap = (Pixmap)NULL;
4404     }
4405
4406
4407     /* bottom shadow pixmap */
4408
4409     if (pAData->bottomShadowPStr)
4410     {
4411         /*
4412          * Make sure bottom shadow color is not the same as background
4413          * otherwise the wrong pixmap will be generated.
4414          */
4415         if (pAData->bottomShadowColor != pAData->background)
4416             foreground = pAData->bottomShadowColor;
4417         else
4418             foreground = pAData->foreground;
4419         pAData->bottomShadowPixmap = XmGetPixmap (
4420                                        ScreenOfDisplay (DISPLAY,
4421                                            pSD->screen),
4422                                        pAData->bottomShadowPStr,
4423                                        foreground,
4424                                        pAData->background);
4425
4426         if (pAData->bottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
4427         {
4428             pAData->bottomShadowPixmap = (Pixmap)NULL;
4429         }
4430     }
4431     else
4432     {
4433         pAData->bottomShadowPixmap = (Pixmap)NULL;
4434     }
4435
4436     /* inactive appearance GC */
4437
4438     GetAppearanceGCs (pSD,
4439                       pAData->foreground,
4440                       pAData->background,
4441                       pAData->font,
4442                       pAData->backgroundPixmap,
4443                       pAData->topShadowColor,
4444                       pAData->topShadowPixmap,
4445                       pAData->bottomShadowColor,
4446                       pAData->bottomShadowPixmap,
4447                       &(pAData->inactiveGC),
4448                       &(pAData->inactiveTopShadowGC),
4449                       &(pAData->inactiveBottomShadowGC));
4450
4451
4452
4453     /*
4454      * Make active apppearance resources if specified.
4455      */
4456
4457     if (!makeActiveResources)
4458     {
4459         return;
4460     }
4461
4462     /* active background pixmap */
4463
4464     if (pAData->activeBackgroundPStr)
4465     {
4466         pAData->activeBackgroundPixmap = XmGetPixmap (
4467                                              ScreenOfDisplay (DISPLAY,
4468                                                  pSD->screen),
4469                                              pAData->activeBackgroundPStr,
4470                                              pAData->activeForeground,
4471                                              pAData->activeBackground);
4472
4473         if (pAData->activeBackgroundPixmap == XmUNSPECIFIED_PIXMAP)
4474         {
4475             pAData->activeBackgroundPixmap = (Pixmap)NULL;
4476         }
4477     }
4478     else
4479     {
4480         pAData->activeBackgroundPixmap = (Pixmap)NULL;
4481     }
4482
4483     /* active top shadow pixmap */
4484
4485     if (pAData->activeTopShadowPStr)
4486     {
4487         pAData->activeTopShadowPixmap = XmGetPixmap (
4488                                             ScreenOfDisplay (DISPLAY,
4489                                                 pSD->screen),
4490                                             pAData->activeTopShadowPStr,
4491                                             pAData->activeTopShadowColor,
4492                                             pAData->activeBackground);
4493
4494         if (pAData->activeTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
4495         {
4496             pAData->activeTopShadowPixmap = (Pixmap)NULL;
4497         }
4498     }
4499     else
4500     {
4501         pAData->activeTopShadowPixmap = (Pixmap)NULL;
4502     }
4503
4504
4505     /* active bottom shadow pixmap */
4506
4507     if (pAData->activeBottomShadowPStr)
4508     {
4509         pAData->activeBottomShadowPixmap = XmGetPixmap (
4510                                                ScreenOfDisplay (DISPLAY,
4511                                                    pSD->screen),
4512                                                pAData->activeBottomShadowPStr,
4513                                                pAData->activeBottomShadowColor,
4514                                                pAData->activeBackground);
4515
4516         if (pAData->activeBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
4517         {
4518             pAData->activeBottomShadowPixmap = (Pixmap)NULL;
4519         }
4520     }
4521     else
4522     {
4523         pAData->activeBottomShadowPixmap = (Pixmap)NULL;
4524     }
4525
4526     /* inactive appearance GC */
4527
4528     GetAppearanceGCs (pSD,
4529                       pAData->activeForeground,
4530                       pAData->activeBackground,
4531                       pAData->font,
4532                       pAData->activeBackgroundPixmap,
4533                       pAData->activeTopShadowColor,
4534                       pAData->activeTopShadowPixmap,
4535                       pAData->activeBottomShadowColor,
4536                       pAData->activeBottomShadowPixmap,
4537                       &(pAData->activeGC),
4538                       &(pAData->activeTopShadowGC),
4539                       &(pAData->activeBottomShadowGC));
4540
4541
4542 } /* END OF FUNCTION MakeAppearanceResources */
4543
4544
4545 \f
4546 /*************************************<->*************************************
4547  *
4548  *  GetAppearanceGCs (pSD, fg, bg, font, bg_pixmap, ts_color, 
4549  *                    ts_pixmap, bs_color, bs_pixmap, pGC, ptsGC, pbsGC)
4550  *
4551  *
4552  *  Description:
4553  *  -----------
4554  *  Creates the appearance GCs for any of the icon, client, or feedback 
4555  *  resources.
4556  *
4557  *
4558  *  Inputs:
4559  *  ------
4560  *  pSD         - pointer to screen data
4561  *  fg          - base foreground color
4562  *  bg          - base background color
4563  *  font        - font
4564  *  bg_pixmap   - background pixmap
4565  *  ts_color    - top shadow color
4566  *  ts_pixmap   - top shadow pixmap
4567  *  bs_color    - bottom shadow color
4568  *  bs_pixmap   - bottom shadow pixmap
4569  *  pGC         - pointer to location to receive base GC
4570  *  ptsGC       - pointer to location to receive top shadow GC
4571  *  pbsGC       - pointer to location to receive bottom shadow GC
4572  * 
4573  *  Outputs:
4574  *  -------
4575  *  *pGC        - base GC
4576  *  *ptsGC      - top shadow GC
4577  *  *pbsGC      - bottom shadow GC
4578  *  
4579  *
4580  *  Comments:
4581  *  --------
4582  * 
4583  * 
4584  *************************************<->***********************************/
4585
4586 void 
4587 GetAppearanceGCs (WmScreenData *pSD, Pixel fg, Pixel bg, XFontStruct *font, Pixmap bg_pixmap, Pixel ts_color, Pixmap ts_pixmap, Pixel bs_color, Pixmap bs_pixmap, GC *pGC, GC *ptsGC, GC *pbsGC)
4588 {
4589     XGCValues gcv;
4590     XtGCMask  mask;
4591
4592
4593     /*
4594      * Get base GC
4595      */
4596
4597     mask = GCForeground | GCBackground | GCFont;
4598     gcv.foreground = fg;
4599     gcv.background = bg;
4600     gcv.font = font->fid;
4601
4602     if (bg_pixmap)
4603     {
4604         mask |= GCTile;
4605         gcv.tile = bg_pixmap;
4606     }
4607
4608     *pGC = XCreateGC (DISPLAY, pSD->rootWindow, mask, &gcv);
4609
4610     /*
4611      * !!! Need GC error detection !!!
4612      */
4613
4614     *ptsGC = GetHighlightGC (pSD, ts_color, bg, ts_pixmap);
4615
4616     *pbsGC = GetHighlightGC (pSD, bs_color, bg, bs_pixmap);
4617
4618 } /* END OF FUNCTION GetAppearanceGCs */
4619
4620
4621
4622 \f
4623 /*************************************<->*************************************
4624  *
4625  *  ProcessScreenResources (pSD, screenName)
4626  *
4627  *
4628  *  Description:
4629  *  -----------
4630  *  This function retrieves resources that are screen specific.  If the
4631  *  window manager is providing standard behavior then retrieve the limited
4632  *  set of resources that don't affect standard behavior and set the
4633  *  values of the other resources to the standard values.
4634  *
4635  *
4636  *  Inputs:
4637  *  ------
4638  *  pSD = pointer to screen data
4639  *  screenName = name of screen
4640  *
4641  * 
4642  *  Outputs:
4643  *  -------
4644  *  pSD = resource data for screen is set
4645  *
4646  *
4647  *  Comments:
4648  *  --------
4649  *  o Gets subresources based on workspace name
4650  * 
4651  *************************************<->***********************************/
4652
4653 void 
4654 ProcessScreenResources (WmScreenData *pSD, unsigned char *screenName)
4655 {
4656     pResSD = pSD;       /* save current screen data for default processing */
4657     /*
4658      * Use the screen name (e.g., "0") as the default resource name.
4659      */
4660
4661     if (wmGD.useStandardBehavior)
4662     {
4663         XtGetSubresources (wmGD.topLevelW, (XtPointer) pSD, 
4664             (String) screenName, 
4665             (String) screenName,
4666             wmStdScreenResources, 
4667             XtNumber (wmStdScreenResources), NULL, 0);
4668
4669         /*
4670          * Fill in the standard resource values.
4671          */
4672
4673         SetStdScreenResourceValues (pSD);
4674     }
4675     else
4676     {
4677         XtGetSubresources (wmGD.topLevelW, (XtPointer) pSD, 
4678             (String)screenName, (String) screenName,
4679             wmScreenResources, 
4680             XtNumber (wmScreenResources), NULL, 0);
4681
4682         pSD->moveOpaque = (((XmScreen) XmGetXmScreen(XtScreen(pSD->screenTopLevelW)))
4683                            -> screen.moveOpaque);
4684     }
4685
4686
4687     /*
4688      * Do some additional processing on the window manager resource values.
4689      */
4690
4691
4692     if (pSD->iconImageMinimum.width < ICON_IMAGE_MIN_WIDTH)
4693     {
4694         pSD->iconImageMinimum.width = ICON_IMAGE_MIN_WIDTH;
4695     }
4696     else if (pSD->iconImageMinimum.width > ICON_IMAGE_MAX_WIDTH)
4697     {
4698         pSD->iconImageMinimum.width = ICON_IMAGE_MAX_WIDTH;
4699     }
4700
4701     if (pSD->iconImageMinimum.height < ICON_IMAGE_MIN_HEIGHT)
4702     {
4703         pSD->iconImageMinimum.height = ICON_IMAGE_MIN_HEIGHT;
4704     }
4705     else if (pSD->iconImageMinimum.height > ICON_IMAGE_MAX_HEIGHT)
4706     {
4707         pSD->iconImageMinimum.height = ICON_IMAGE_MAX_HEIGHT;
4708     }
4709
4710     if (pSD->iconImageMaximum.width < pSD->iconImageMinimum.width)
4711     {
4712         pSD->iconImageMaximum.width = pSD->iconImageMinimum.width;
4713     }
4714     else if (pSD->iconImageMaximum.width > ICON_IMAGE_MAX_WIDTH)
4715     {
4716         pSD->iconImageMaximum.width = ICON_IMAGE_MAX_WIDTH;
4717     }
4718
4719     if (pSD->iconImageMaximum.height < pSD->iconImageMinimum.height)
4720     {
4721         pSD->iconImageMaximum.height = pSD->iconImageMinimum.height;
4722     }
4723     else if (pSD->iconImageMaximum.height > ICON_IMAGE_MAX_HEIGHT)
4724     {
4725         pSD->iconImageMaximum.height = ICON_IMAGE_MAX_HEIGHT;
4726     }
4727
4728     if (pSD->iconPlacementMargin > MAXIMUM_ICON_MARGIN)
4729     {
4730         pSD->iconPlacementMargin = MAXIMUM_ICON_MARGIN;
4731     }
4732
4733     if (pSD->maximumMaximumSize.width <= 0)
4734     {
4735         pSD->maximumMaximumSize.width =
4736                         2 * DisplayWidth (DISPLAY, pSD->screen);
4737     }
4738
4739     if (pSD->maximumMaximumSize.height <= 0)
4740     {
4741         pSD->maximumMaximumSize.height =
4742                         2 * DisplayHeight (DISPLAY, pSD->screen);
4743     }
4744
4745     /*
4746      * Set the icon appearance default based on whether or not the icon box
4747      * is being used.
4748      */
4749
4750     if (pSD->iconDecoration & USE_ICON_DEFAULT_APPEARANCE)
4751     {
4752         if (pSD->useIconBox)
4753         {
4754             pSD->iconDecoration = ICON_APPEARANCE_ICONBOX;
4755         }
4756         else
4757         {
4758             pSD->iconDecoration = ICON_APPEARANCE_STANDALONE;
4759         }
4760     }
4761
4762     /*
4763      * If resizeBorderWidth or frameBorderWidth is unset then initialize
4764      * to dynamic defaults.
4765      */
4766
4767     if ((pSD->resizeBorderWidth == (Dimension)BIGSIZE) ||
4768         (pSD->frameBorderWidth == (Dimension)BIGSIZE))
4769     {
4770         double xres, yres, avg_res;
4771
4772         xres = (((double) DisplayWidth(DISPLAY, pSD->screen)) / 
4773                 ((double) DisplayWidthMM(DISPLAY, pSD->screen)));
4774         yres = (((double) DisplayHeight(DISPLAY, pSD->screen)) / 
4775                 ((double) DisplayHeightMM(DISPLAY, pSD->screen)));
4776
4777         avg_res = (xres + yres) / 2.0;
4778
4779         /* Multiply times width in mm (avg. 7-8 pixels) */
4780         if (pSD->resizeBorderWidth == (Dimension)BIGSIZE)
4781         {
4782             pSD->resizeBorderWidth = (int) (avg_res * 2.2);
4783
4784             /* limit size because big borders look ugly */
4785                 if (pSD->resizeBorderWidth > 6) pSD->resizeBorderWidth = 6;
4786         }
4787
4788         /* Multiply times width in mm (avg. 5-6 pixels) */
4789         if (pSD->frameBorderWidth == (Dimension)BIGSIZE)
4790         {
4791             pSD->frameBorderWidth = (int) (avg_res * 1.7);
4792
4793             /* limit size because big borders look ugly */
4794             if (wmGD.frameStyle == WmSLAB)
4795             {
4796                 if (pSD->frameBorderWidth > 4) pSD->frameBorderWidth = 4;
4797             }
4798             else
4799             {
4800                 if (pSD->frameBorderWidth > 5) pSD->frameBorderWidth = 5;
4801             }
4802         }
4803     }
4804
4805
4806     pSD->externalBevel = FRAME_EXTERNAL_SHADOW_WIDTH;
4807     pSD->joinBevel = FRAME_INTERNAL_SHADOW_WIDTH;
4808     if (pSD->frameBorderWidth < 
4809            (pSD->externalBevel + MIN_INTERNAL_BEVEL))
4810     {
4811         pSD->frameBorderWidth = 
4812             pSD->externalBevel + MIN_INTERNAL_BEVEL;
4813     }
4814     else if (pSD->frameBorderWidth > MAXIMUM_FRAME_BORDER_WIDTH)
4815     {
4816         pSD->frameBorderWidth = MAXIMUM_FRAME_BORDER_WIDTH;
4817     }
4818
4819     if (pSD->resizeBorderWidth < 
4820            (pSD->externalBevel + MIN_INTERNAL_BEVEL))
4821     {
4822         pSD->resizeBorderWidth = 
4823             (pSD->externalBevel + MIN_INTERNAL_BEVEL);
4824     }
4825     else if (pSD->resizeBorderWidth > MAXIMUM_FRAME_BORDER_WIDTH)
4826     {
4827         pSD->resizeBorderWidth = MAXIMUM_FRAME_BORDER_WIDTH;
4828     }
4829
4830     /*
4831      * Update the resource database.
4832      */
4833     WriteOutXrmColors (pSD);
4834
4835     /*
4836      * Process the component appearance resources for client, 
4837      * icon and feedback parts of mwm.
4838      */
4839
4840      ProcessAppearanceResources (pSD);
4841
4842     /* 
4843      * Process the workspace list and name the initial
4844      * workspaces
4845      */
4846
4847      ProcessWorkspaceList (pSD);
4848
4849      /*
4850       * Process default backdrop images to be used in low-color
4851       * situations
4852       */
4853      ProcessDefaultBackdropImages (pSD);
4854     
4855     /*
4856      * Save the default icon pixmap in global data. We'll use it only
4857      * as a last resort.
4858      */
4859
4860     pSD->builtinIconPixmap = 
4861         XCreateBitmapFromData (DISPLAY, pSD->rootWindow, (char *)iImage_bits, 
4862                                        iImage_width, iImage_height);
4863
4864 } /* END OF FUNCTION ProcessScreenResources */
4865
4866 /*************************************<->*************************************
4867  *
4868  *  ProcessDefaultBackdropImages (pSD)
4869  *
4870  *
4871  *  Description:
4872  *  -----------
4873  *  This function processes the default backdrop images to be used
4874  *  in low color or black and white workspaces.
4875  *
4876  *
4877  *  Inputs:
4878  *  ------
4879  *  pSD = pointer to screen data
4880  *
4881  * 
4882  *  Outputs:
4883  *  -------
4884  *  pSD = resource data for screen is set
4885  *
4886  *
4887  *  Comments:
4888  *  --------
4889  * 
4890  *************************************<->***********************************/
4891
4892 void 
4893 ProcessDefaultBackdropImages (WmScreenData *pSD)
4894 {
4895 } /* END OF FUNCTION ProcessDefaultBackdropImages */
4896
4897
4898 \f
4899 /*************************************<->*************************************
4900  *
4901  *  ProcessWorkspaceList (pSD)
4902  *
4903  *
4904  *  Description:
4905  *  -----------
4906  *  This function processes the workspaceCount and workspaceList 
4907  *  resources for a particular screen. It creates space for the initial 
4908  *  workspace data structures and adds in names for workspaces.
4909  *
4910  *
4911  *  Inputs:
4912  *  ------
4913  *  pSD = pointer to screen data
4914  *
4915  * 
4916  *  Outputs:
4917  *  -------
4918  *  pSD = resource data for screen is set
4919  *
4920  *
4921  *  Comments:
4922  *  --------
4923  *  NOTE: The workspaceCount resource has precedence over the
4924  *  workspaceList resource. workspaceCount determines the number of
4925  *  workspaces to create for the screen. Once the number is determined,
4926  *  workspaceList is used to fill in the "names." If workspaceList is
4927  *  not present or doesn't have enough names, then missing names are
4928  *  generated automatically. If workspaceList is present and
4929  *  workspaceCount is not present, then the workspaceCount is determined
4930  *  by the number of names in workspaceList.
4931  * 
4932  *************************************<->***********************************/
4933
4934 void 
4935 ProcessWorkspaceList (WmScreenData *pSD)
4936 {
4937     int i, wsNameCount, wsNamesAlloced;
4938     WmWorkspaceData *pwsI;
4939     unsigned char *lineP = NULL;
4940     unsigned char *string;
4941     Boolean bHaveWorkspaceList;
4942     Boolean bHaveWorkspaceCount;
4943     char **ppchWsNames = NULL;
4944
4945     /*
4946      * Validate initial resource settings
4947      */
4948     bHaveWorkspaceCount = (pSD->numWorkspaces >= 1);
4949     bHaveWorkspaceList = (pSD->workspaceList != NULL);
4950
4951     if (bHaveWorkspaceList)
4952     {
4953         /*
4954          * Parse out array of workspace names
4955          */
4956         wsNamesAlloced = WS_ALLOC_AMOUNT;
4957         ppchWsNames = (char **) XtMalloc (wsNamesAlloced * sizeof (char *));
4958         if (pSD->workspaceList)
4959         {
4960             lineP = (unsigned char *) pSD->workspaceList;
4961         }
4962         else
4963         {
4964             lineP = (unsigned char *)NULL;
4965         }
4966         wsNameCount = 0;
4967
4968         while (((string = GetString(&lineP)) != NULL))
4969         {
4970             ppchWsNames[wsNameCount] = (char *) string;
4971
4972             if (++wsNameCount >= wsNamesAlloced)
4973             {
4974                /*
4975                 *  Need to add more workspaces
4976                 */
4977                 wsNamesAlloced += WS_ALLOC_AMOUNT;
4978                 if (!(ppchWsNames = (char **) XtRealloc 
4979                           ((char *)ppchWsNames,
4980                             wsNamesAlloced * sizeof(char *))))
4981                 {
4982                     ExitWM (WM_ERROR_EXIT_VALUE);
4983                 }
4984             }
4985         }
4986
4987         if (!bHaveWorkspaceCount)
4988         {
4989             pSD->numWorkspaces = wsNameCount;
4990         }
4991     }
4992     else if (!bHaveWorkspaceCount)
4993     {
4994         /*
4995          * Neither workspaceCount nor workspaceList specified!!
4996          * Assume one workspace.
4997          */
4998         pSD->numWorkspaces = 1;
4999     }
5000
5001     if (pSD->numWorkspaces > MAX_WORKSPACE_COUNT)
5002             pSD->numWorkspaces = MAX_WORKSPACE_COUNT;
5003
5004     /*
5005      *  Allocate the array of workspace data
5006      */
5007     pSD->numWsDataAllocated = (pSD->numWorkspaces + WS_ALLOC_AMOUNT);
5008     pSD->numWsDataAllocated -= pSD->numWsDataAllocated % WS_ALLOC_AMOUNT;
5009     if (!(pSD->pWS = (WmWorkspaceData *) 
5010             XtMalloc (pSD->numWsDataAllocated * sizeof(WmWorkspaceData))))
5011     {
5012         ExitWM (WM_ERROR_EXIT_VALUE);
5013     }
5014
5015     pwsI = pSD->pWS;
5016
5017     for (i = 0; i < pSD->numWorkspaces; i++, pwsI++)
5018     {
5019         if (bHaveWorkspaceList && i < wsNameCount)
5020         {
5021             string = (unsigned char *) ppchWsNames[i];
5022         }
5023         else
5024         {
5025             string = GenerateWorkspaceName (pSD, i);
5026         }
5027         if (!(pwsI->name = (String) XtMalloc (1+strlen((char *)string))))
5028         {
5029             Warning (((char *)GETMESSAGE(62, 27, "Insufficient memory for workspace data")));
5030             ExitWM(WM_ERROR_EXIT_VALUE);
5031         }
5032         else 
5033         {
5034             strcpy(pwsI->name, (char *)string);
5035         }
5036     }
5037
5038     if (ppchWsNames) XtFree ((char *) ppchWsNames);
5039
5040 } /* END OF FUNCTION ProcessWorkspaceList */
5041
5042
5043 \f
5044 /******************************<->*************************************
5045  *
5046  *  ProcessWorkspaceResources (pWS)
5047  *
5048  *
5049  *  Description:
5050  *  -----------
5051  *  This function retrieves resources that are workspace specific.  If the
5052  *  window manager is providing standard behavior then retrieve the limited
5053  *  set of resources that don't affect standard behavior and set the
5054  *  values of the other resources to the standard values.
5055  *
5056  *
5057  *  Inputs:
5058  *  ------
5059  *  pWS = pointer to workspace data
5060  *
5061  * 
5062  *  Outputs:
5063  *  -------
5064  *  pWS = resource data for workspace is set
5065  *
5066  *
5067  *  Comments:
5068  *  --------
5069  *  o Gets subresources based on workspace name
5070  * 
5071  ******************************<->***********************************/
5072
5073 void 
5074 ProcessWorkspaceResources (WmWorkspaceData *pWS)
5075 {
5076
5077     /*
5078      * Retrieve workspace specific resources.
5079      */
5080     pResWS = pWS;       /* save current ws for default processing */
5081
5082     if (wmGD.useStandardBehavior)
5083     {
5084         XtGetSubresources (pWS->pSD->screenTopLevelW, (XtPointer) pWS, 
5085             pWS->name, pWS->name, wmStdWorkspaceResources, 
5086             XtNumber (wmStdWorkspaceResources), NULL, 0);
5087
5088         /*
5089          * Fill in the standard resource values.
5090          *
5091          * (no code for this right now)
5092          */
5093         pWS->iconBoxGeometry = NULL;
5094     }
5095     else
5096     {
5097         XtGetSubresources (pWS->pSD->screenTopLevelW, (XtPointer) pWS, 
5098             pWS->name, pWS->name, wmWorkspaceResources, 
5099             XtNumber (wmWorkspaceResources), NULL, 0);
5100
5101         /*  Dup iconbox geometry, it may be free'd later on.  */
5102
5103         if (pWS->iconBoxGeometry)
5104         {
5105             pWS->iconBoxGeometry = XtNewString (pWS->iconBoxGeometry);
5106         }
5107     }
5108
5109     if (pWS->title == NULL)
5110     {
5111         /*
5112          * Setup default workspace title 
5113          */
5114         pWS->title = XmStringCreateLocalized(pWS->name);
5115     }
5116     else
5117     {
5118        /*
5119         * Copy resource just in case there's a duplicate
5120         * Duplicates point to the same data, freeing on 
5121         * rename can cause a crash.
5122         */
5123         pWS->title = XmStringCopy(pWS->title);
5124
5125     }
5126
5127     /*
5128      * Dup iconbox geometry, it may be free'd later on.
5129      */
5130     if (pWS->iconBoxGeometry)
5131     {
5132         pWS->iconBoxGeometry = XtNewString (pWS->iconBoxGeometry);
5133     }
5134
5135     /*
5136      * Get backdrop resources
5137      */
5138     XtGetSubresources (pWS->workspaceTopLevelW, 
5139         (XtPointer) &(pWS->backdrop), 
5140         WmNbackdrop, WmCBackdrop, wmBackdropResources, 
5141         XtNumber (wmBackdropResources), NULL, 0);
5142
5143     ProcessBackdropResources (pWS, 0);
5144
5145 } /* END OF FUNCTION ProcessWorkspaceResources */
5146
5147 /******************************<->*************************************
5148  *
5149  *  ProcessPresenceResources (pSD)
5150  *
5151  *
5152  *  Description:
5153  *  -----------
5154  *  This function retrieves resources for the workspace presence
5155  *  dialog.
5156  *
5157  *  Inputs:
5158  *  ------
5159  *  pSD = pointer to screen data
5160  *
5161  * 
5162  *  Outputs:
5163  *  -------
5164  *  pSD = resource data for workspace presence dialog are set
5165  *
5166  *
5167  *  Comments:
5168  *  --------
5169  *  o Gets subresources 
5170  * 
5171  ******************************<->***********************************/
5172
5173 void 
5174 ProcessPresenceResources (WmScreenData *pSD)
5175 {
5176 #ifndef NO_MESSAGE_CATALOG
5177     static char *default_ws_pres_title = NULL;
5178 #else
5179     static char *default_ws_pres_title = "Workspace Presence";
5180 #endif
5181     Arg args[5];
5182     int n;
5183     unsigned char *pch1, *pch2;
5184
5185 #ifndef NO_MESSAGE_CATALOG
5186     /* 
5187      * Set up localized default title string on initial time through
5188      */
5189     if (default_ws_pres_title == NULL)
5190     {
5191         char * tmpString; 
5192         /*
5193          * catgets returns a pointer to an area that is over written 
5194          * on each call to catgets.  
5195          */
5196
5197         tmpString = ((char *)GETMESSAGE(62, 59, "Occupy Workspace"));
5198         if ((default_ws_pres_title =
5199              (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
5200         {
5201             Warning (((char *)GETMESSAGE(62, 31, "Insufficient memory for local message string")));
5202             default_ws_pres_title = "Occupy Workspace";
5203         }
5204         else
5205         {
5206             strcpy(default_ws_pres_title, tmpString);
5207         }
5208     }
5209 #endif
5210
5211     if (pSD->presence.shellW)
5212     {
5213         XtGetSubresources (pSD->presence.shellW, (XtPointer) &pSD->presence, 
5214                 WmNworkspacePresence, WmCWorkspacePresence, 
5215                 wmWsPresenceResources, 
5216                 XtNumber (wmWsPresenceResources), NULL, 0);
5217
5218         pch2 = NULL;
5219
5220         if (pSD->presence.title)
5221         {
5222             pch1 = (unsigned char *) 
5223                     WmXmStringToString (pSD->presence.title);
5224
5225             if (pch1 && (pch2 = (unsigned char *) 
5226                                 XtMalloc (1+strlen((char *)pch1))))
5227             {
5228                 strcpy ((char *)pch2, (char *)pch1);
5229             }
5230         }
5231
5232         if (!pch2)
5233         {
5234             pch2 = (unsigned char *) default_ws_pres_title;
5235         }
5236
5237         n = 0;
5238         XtSetArg (args[n], XmNtitle, pch2);             n++;
5239         XtSetValues (pSD->presence.shellW, args, n);
5240     }
5241
5242 } /* END OF FUNCTION ProcessPresenceResources */
5243
5244 \f
5245 /*************************************<->*************************************
5246  *
5247  *  ProcessClientResources (pCD)
5248  *
5249  *
5250  *  Description:
5251  *  -----------
5252  *  This function retrieves resources that are client specific.  If the
5253  *  window manager is providing standard behavior then retrieve the limited
5254  *  set of resources that don't affect standard behavior and set the
5255  *  values of the other resources to the standard values.
5256  *
5257  *
5258  *  Inputs:
5259  *  ------
5260  *  pCD = pointer to client data
5261  *
5262  * 
5263  *  Outputs:
5264  *  -------
5265  *  pCD = resource data for client is set
5266  *
5267  *
5268  *  Comments:
5269  *  --------
5270  *  o Gets subresources based on client name and class.
5271  *  o Creates GC for the client Matte, if there is one.
5272  * 
5273  *************************************<->***********************************/
5274
5275 void 
5276 ProcessClientResources (ClientData *pCD)
5277 {
5278     String clientName;
5279     String clientClass;
5280     WmScreenData *pSD = pCD->pSD;
5281
5282     /*
5283      * Retrieve basic client specific resources.
5284      */
5285
5286     _pCD = pCD; /* save in static global for dynamic default processing */
5287     clientName = (pCD->clientName) ? pCD->clientName : WmNdefaults;
5288     clientClass = (pCD->clientClass) ? pCD->clientClass : WmNdefaults;
5289
5290     if (wmGD.useStandardBehavior)
5291     {
5292         XtGetSubresources (pSD->screenTopLevelW, (XtPointer) pCD, clientName,
5293             clientClass, wmStdClientResources, XtNumber (wmStdClientResources),
5294             NULL, 0);
5295
5296         /*
5297          * Fill in the standard resource values.
5298          */
5299
5300         SetStdClientResourceValues (pCD);
5301     }
5302     else
5303     {
5304         XtGetSubresources (pSD->screenTopLevelW, (XtPointer) pCD, clientName,
5305             clientClass, wmClientResources, XtNumber (wmClientResources), NULL,
5306             0);
5307     }
5308
5309 #ifdef NO_MESSAGE_CATALOG
5310     /*
5311      * If (window menu spec is not found) then use the builtin
5312      * system menu.
5313      */
5314
5315     if ((pCD->systemMenu == defaultSystemMenuName) &&
5316         (pSD->defaultSystemMenuUseBuiltin == TRUE))
5317     {
5318         pCD->systemMenu = builtinSystemMenuName;
5319     }
5320 #endif
5321
5322     /*
5323      * If the client decorations or client functions have been defaulted
5324      * fix up the fields in the ProcessMwmHints function.
5325      */
5326
5327
5328     /* make top and bottom shadow pixmaps */
5329
5330     if (pCD->iconImageBottomShadowPStr)
5331     {
5332         if ((pCD->iconImageBottomShadowPStr ==
5333                     pSD->iconAppearance.bottomShadowPStr) &&
5334             (pCD->iconImageBottomShadowColor ==
5335                     pSD->iconAppearance.bottomShadowColor) &&
5336             (pCD->iconImageBackground == 
5337                     pSD->iconAppearance.background))
5338         {
5339             pCD->iconImageBottomShadowPixmap =
5340                     pSD->iconAppearance.bottomShadowPixmap;
5341         }
5342         else
5343         {
5344             pCD->iconImageBottomShadowPixmap =
5345                             XmGetPixmap ( ScreenOfDisplay (DISPLAY,
5346                                               pSD->screen),
5347                                           pCD->iconImageBottomShadowPStr,
5348                                           pCD->iconImageBottomShadowColor,
5349                                           pCD->iconImageBackground);
5350
5351             if (pCD->iconImageBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
5352             {
5353                 pCD->iconImageBottomShadowPixmap = (Pixmap)NULL;
5354             }
5355         }
5356     }
5357     else
5358     {
5359         pCD->iconImageBottomShadowPixmap = (Pixmap)NULL;
5360     }
5361
5362     if (pCD->iconImageTopShadowPStr)
5363     {
5364         if ((pCD->iconImageTopShadowPStr ==
5365                                 pSD->iconAppearance.topShadowPStr) &&
5366             (pCD->iconImageTopShadowColor ==
5367                                 pSD->iconAppearance.topShadowColor) &&
5368             (pCD->iconImageBackground == pSD->iconAppearance.background))
5369         {
5370             pCD->iconImageTopShadowPixmap =
5371                                         pSD->iconAppearance.topShadowPixmap;
5372         }
5373         else
5374         {
5375             pCD->iconImageTopShadowPixmap =
5376                             XmGetPixmap ( ScreenOfDisplay (DISPLAY,
5377                                               pSD->screen),
5378                                           pCD->iconImageTopShadowPStr,
5379                                           pCD->iconImageTopShadowColor,
5380                                           pCD->iconImageBackground);
5381
5382             if (pCD->iconImageTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
5383             {
5384                 pCD->iconImageTopShadowPixmap = (Pixmap)NULL;
5385             }
5386         }
5387     }
5388     else
5389     {
5390         pCD->iconImageTopShadowPixmap = (Pixmap)NULL;
5391     }
5392
5393     if ((pCD->internalBevel < MIN_INTERNAL_BEVEL)  || 
5394         (pCD->internalBevel > MAX_INTERNAL_BEVEL))
5395     {
5396         pCD->internalBevel = MAX_INTERNAL_BEVEL;
5397     }
5398
5399
5400     /*
5401      * Retrieve matte resources and make internal matte resources.
5402      */
5403
5404     if (pCD->matteWidth > 0)
5405     {
5406         XtGetSubresources (pSD->screenTopLevelW, (XtPointer) pCD, clientName,
5407             clientClass, wmClientResourcesM, XtNumber (wmClientResourcesM),
5408             NULL, 0);
5409
5410         /* make top and bottom shadow pixmaps */
5411
5412         if (pCD->matteBottomShadowPStr &&
5413             (!strcmp(pCD->matteBottomShadowPStr, _NoDither)))
5414         {
5415             pCD->matteBottomShadowPStr = NULL;
5416         }
5417
5418         if (pCD->matteBottomShadowPStr)
5419         {
5420             if ((pCD->matteBottomShadowPStr ==
5421                                     pSD->clientAppearance.bottomShadowPStr) &&
5422                 (pCD->matteBottomShadowColor ==
5423                                     pSD->clientAppearance.bottomShadowColor) &&
5424                 (pCD->matteBackground == pSD->clientAppearance.background))
5425             {
5426                 pCD->matteBottomShadowPixmap =
5427                                 pSD->clientAppearance.bottomShadowPixmap;
5428             }
5429             else
5430             {
5431                 pCD->matteBottomShadowPixmap =
5432                                 XmGetPixmap (ScreenOfDisplay (DISPLAY,
5433                                                  pSD->screen),
5434                                              pCD->matteBottomShadowPStr,
5435                                              pCD->matteBottomShadowColor,
5436                                              pCD->matteBackground);
5437
5438                 if (pCD->matteBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
5439                 {
5440                     pCD->matteBottomShadowPixmap = (Pixmap)NULL;
5441                 }
5442             }
5443         }
5444         else
5445         {
5446             pCD->matteBottomShadowPixmap = (Pixmap)NULL;
5447         }
5448
5449         if (pCD->matteTopShadowPStr &&
5450             (!strcmp(pCD->matteTopShadowPStr, _NoDither)))
5451         {
5452             pCD->matteTopShadowPStr = NULL;
5453         }
5454
5455         if (pCD->matteTopShadowPStr)
5456         {
5457             if ((pCD->matteTopShadowPStr ==
5458                                     pSD->clientAppearance.topShadowPStr) &&
5459                 (pCD->matteTopShadowColor ==
5460                                     pSD->clientAppearance.topShadowColor) &&
5461                 (pCD->matteBackground == pSD->clientAppearance.background))
5462             {
5463                 pCD->matteTopShadowPixmap =
5464                                         pSD->clientAppearance.topShadowPixmap;
5465             }
5466             else
5467             {
5468                 pCD->matteTopShadowPixmap =
5469                                 XmGetPixmap (ScreenOfDisplay (DISPLAY,
5470                                                  pSD->screen),
5471                                              pCD->matteTopShadowPStr,
5472                                              pCD->matteTopShadowColor,
5473                                              pCD->matteBackground);
5474
5475                 if (pCD->matteTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
5476                 {
5477                     pCD->matteTopShadowPixmap = (Pixmap)NULL;
5478                 }
5479             }
5480         }
5481         else
5482         {
5483             pCD->matteTopShadowPixmap = (Pixmap)NULL;
5484         }
5485
5486
5487         /* make top and bottom shadow GC's */
5488
5489         pCD->clientMatteTopShadowGC = GetHighlightGC (pCD->pSD,
5490                                           pCD->matteTopShadowColor,
5491                                           pCD->matteBackground,
5492                                           pCD->matteTopShadowPixmap);
5493
5494         pCD->clientMatteBottomShadowGC = GetHighlightGC (pCD->pSD,
5495                                           pCD->matteBottomShadowColor,
5496                                           pCD->matteBackground,
5497                                           pCD->matteBottomShadowPixmap);
5498     }
5499
5500 } /* END OF FUNCTION ProcessClientResources */
5501
5502
5503 \f
5504 /*************************************<->*************************************
5505  *
5506  *  SetStdClientResourceValues (pCD)
5507  *
5508  *
5509  *  Description:
5510  *  -----------
5511  *  This function sets client resource data to standard values.  This setting
5512  *  is done in place of getting the values from the user settings in
5513  *  the resource database.
5514  *
5515  *  Input:
5516  *  -----
5517  *  pCD = pointer to the client data
5518  *
5519  * 
5520  *  Output:
5521  *  ------
5522  *  pCD = (client data filled out with resource values)
5523  * 
5524  *************************************<->***********************************/
5525
5526 void 
5527 SetStdClientResourceValues (ClientData *pCD)
5528 {
5529     pCD->clientDecoration = WM_DECOR_DEFAULT;
5530     pCD->clientFunctions = WM_FUNC_DEFAULT;
5531     pCD->focusAutoRaise = True;
5532     pCD->systemMenu = builtinSystemMenuName;
5533     pCD->usePPosition = USE_PPOSITION_NONZERO;
5534     pCD->ignoreWMSaveHints = True;
5535
5536 } /* END OF FUNCTION SetStdClientResourceValues */
5537
5538
5539 \f
5540 /******************************<->*************************************
5541  *
5542  *  SetStdScreenResourceValues (pSD)
5543  *
5544  *
5545  *  Description:
5546  *  -----------
5547  *  This function sets screen resource data to standard values.  This setting
5548  *  is done in place of getting the values from the user settings in
5549  *  the resource database.
5550  *
5551  *  Input:
5552  *  -----
5553  *  pSD = pointer to the screen data
5554  *
5555  * 
5556  *  Output:
5557  *  ------
5558  *  pSD = (screen data filled out with resource values)
5559  * 
5560  ******************************<->***********************************/
5561
5562 void 
5563 SetStdScreenResourceValues (WmScreenData *pSD)
5564 {
5565     pSD->buttonBindings = builtinButtonBindingsName;
5566     pSD->cleanText = True;
5567     pSD->iconDecoration =
5568                 (ICON_LABEL_PART | ICON_IMAGE_PART | ICON_ACTIVE_LABEL_PART);
5569     pSD->iconPlacement =
5570                 (ICON_PLACE_LEFT_PRIMARY | ICON_PLACE_BOTTOM_SECONDARY);
5571     pSD->keyBindings = builtinKeyBindingsName;
5572     pSD->limitResize = True;
5573     pSD->resizeCursors = True;
5574     pSD->transientDecoration = (WM_DECOR_SYSTEM | WM_DECOR_RESIZEH);
5575     pSD->transientFunctions =
5576                 (WM_FUNC_ALL & ~(MWM_FUNC_MAXIMIZE | MWM_FUNC_MINIMIZE |
5577                                  MWM_FUNC_RESIZE));
5578     pSD->useIconBox = False;
5579
5580     pSD->feedbackGeometry = NULL;
5581     pSD->moveOpaque = False;
5582
5583 } /* END OF FUNCTION SetStdScreenResourceValues */
5584
5585 \f
5586 /*************************************<->*************************************
5587  *
5588  *  GetHighlightGC (pSD, fg, bg, pixmap)
5589  *
5590  *
5591  *  Description:
5592  *  -----------
5593  *  Get a graphic context for either drawing top- or bottom-shadow 
5594  *  highlights.
5595  *
5596  *
5597  *  Inputs:
5598  *  ------
5599  *  pSD = pointer to screen data
5600  *  fg = foreground color
5601  *  bg = background color
5602  *  pixmap = pixmap for highlight
5603  * 
5604  *  Outputs:
5605  *  -------
5606  *  RETRUN = GC with the input parameters incorporated.
5607  *
5608  *************************************<->***********************************/
5609
5610 GC GetHighlightGC (WmScreenData *pSD, Pixel fg, Pixel bg, Pixmap pixmap)
5611 {
5612     XGCValues gcv;
5613     XtGCMask  mask;
5614
5615
5616     mask = GCForeground | GCBackground | GCLineWidth | GCFillStyle;
5617     gcv.background = bg;
5618     gcv.foreground = fg;
5619     gcv.line_width = 1;
5620
5621     if (pixmap)
5622     {
5623         mask |= GCFillStyle | GCTile;
5624         gcv.fill_style = FillTiled;
5625         gcv.tile = pixmap;
5626     }
5627     else
5628     {
5629         gcv.fill_style = FillSolid;
5630     }
5631
5632 #ifdef OLD_CODE
5633     /*
5634      * NOTE: If additional mask bits are added, modify WmGetGC()
5635      * in WmGraphics.c to check those values for matches.
5636      */
5637
5638     return (WmGetGC (pSD, mask, &gcv));
5639 #endif /* OLD_CODE */
5640
5641     return (XtGetGC (pSD->screenTopLevelW, mask, &gcv));
5642
5643 } /* END OF FUNCTION GetHighlightGC */
5644
5645
5646 \f
5647 /*************************************<->*************************************
5648  *
5649  *  _WmGetDynamicDefault (widget, type, defaultColor, newBackground, value)
5650  *
5651  *
5652  *  Description:
5653  *  -----------
5654  *  This function is used to generate a default color of the requested 
5655  *  type.  Default colors are generated for a 3-D appearance.
5656  *
5657  *
5658  *  Inputs:
5659  *  ------
5660  *  widget = this is the widget that is associated with the resource or
5661  *           that is the reference widget for the wm subpart.
5662  *
5663  *  type = this is the type of color resource (e.g., top shadow color).
5664  *
5665  *  defaultColor = pointer to default color name/specification.
5666  *
5667  *  newBackground = background pixel for generating 3-D colors.
5668  *
5669  * 
5670  *  Outputs:
5671  *  -------
5672  *  value = pointer to the XrmValue in which to store the color
5673  * 
5674  *************************************<->***********************************/
5675
5676 void 
5677 _WmGetDynamicDefault (Widget widget, unsigned char type, String defaultColor, Pixel newBackground, XrmValue *value)
5678 {
5679     static Screen *oldScreen = NULL;
5680     static Screen *newScreen;
5681     static Colormap oldColormap;
5682     static Colormap newColormap;
5683     static Pixel newValue;
5684     static Pixel background;
5685     static String oldDefaultColor = DEFAULT_COLOR_NONE;
5686     static XmColorData colorData;
5687
5688     /* initialize the return value */
5689
5690     value->size = sizeof (newValue);
5691     value->addr = (char *)&newValue;
5692
5693
5694     /*
5695      * Process monochrome defaults first.
5696      */
5697
5698     newScreen = XtScreen (widget);
5699
5700     if (Monochrome (newScreen))
5701     {
5702     Boolean ok = False;
5703     /*
5704      * Check color server sets for this screen.
5705      */
5706     if (wmGD.statusColorServer == CSERVE_NORMAL)
5707     {
5708         WmScreenData *pSD;
5709         int i;
5710
5711         for (i = 0; i < wmGD.numScreens; i++)
5712         {
5713             if (XScreenNumberOfScreen(newScreen) == wmGD.Screens[i].screen)
5714             {
5715                 pSD = &wmGD.Screens[i];
5716                 ok = True;
5717                 break;
5718             }
5719         }
5720
5721         if (ok)
5722         {
5723             ok = False;
5724             for (i = 0; i < XmCO_MAX_NUM_COLORS; i++)
5725             {
5726                 if (pSD->pPixelData[i].bg == newBackground)
5727                 {
5728                     switch (type)
5729                       {
5730                       case WmFGC: newValue = pSD->pPixelData[i].fg; break;
5731                       case WmBGC: newValue = pSD->pPixelData[i].bg; break;
5732                       case WmTSC: newValue = pSD->pPixelData[i].ts; break;
5733                       case WmBSC: newValue = pSD->pPixelData[i].bs; break;
5734                       }
5735
5736                     ok = True;
5737                 }
5738             }
5739         }
5740
5741     }
5742     if (!ok)
5743     {
5744         switch (type)
5745           {
5746           case WmFGC: newValue = BlackPixelOfScreen (newScreen); break;
5747           case WmBGC: newValue = WhitePixelOfScreen (newScreen); break;
5748           case WmTSC: newValue = WhitePixelOfScreen (newScreen); break;
5749           case WmBSC: newValue = BlackPixelOfScreen (newScreen); break;
5750           }
5751     }
5752         return;
5753     }
5754
5755
5756     /*
5757      * Check to see if appropriate colors are available from the
5758      * previous request; if the color is a background color then get
5759      * default colors.  Generate 3-D colors if necessary.  Maintain
5760      * new colors in static variables for later reuse.
5761      */
5762
5763     newColormap = widget->core.colormap;
5764
5765     if ((oldScreen != NULL) && (oldScreen == newScreen) &&
5766         (oldColormap == newColormap) && (type != WmBGC) &&
5767         (background == newBackground))
5768     {
5769     }
5770     else if ((oldScreen == newScreen) && (oldColormap == newColormap) &&
5771              (type == WmBGC) && (oldDefaultColor == defaultColor))
5772     {
5773     }
5774     else if (type == WmBGC)
5775     {
5776         /*
5777          * Find or generate a background color and associated 3-D colors.
5778          */
5779
5780         oldDefaultColor = defaultColor;
5781 /*
5782  * Fix for CR 5152 - Due to the use of Realloc in the color caches,
5783  *                   a static pointer is not acceptable.  Change it
5784  *                   to a static structure to maintain the data
5785  */
5786         colorData = *_WmGetDefaultColors (newScreen, newColormap, defaultColor);
5787     }
5788     else
5789     {
5790         /*
5791          * Find or generate a color based on the associated background color.
5792          */
5793
5794         oldDefaultColor = DEFAULT_COLOR_NONE;
5795         background = newBackground;
5796
5797         XmGetColors(newScreen, newColormap, background,
5798                     &colorData.foreground.pixel,
5799                     &colorData.top_shadow.pixel,
5800                     &colorData.bottom_shadow.pixel,
5801                     &colorData.select.pixel);
5802     }
5803
5804     oldScreen = newScreen;
5805     oldColormap = newColormap;
5806
5807
5808     /*
5809      * Set up the return value.
5810      */
5811
5812     colorData.allocated |= type;
5813     switch (type)
5814       {
5815       case XmBACKGROUND:    newValue = colorData.background.pixel;    break;
5816       case XmFOREGROUND:    newValue = colorData.foreground.pixel;    break;
5817       case XmTOP_SHADOW:    newValue = colorData.top_shadow.pixel;    break;
5818       case XmBOTTOM_SHADOW: newValue = colorData.bottom_shadow.pixel; break;
5819       case XmSELECT:        newValue = colorData.select.pixel;        break;
5820       default:              newValue = colorData.background.pixel;    break;
5821       }
5822
5823 } /* END OF FUNCTION _WmGetDynamicDefault */
5824
5825
5826 \f
5827 /*************************************<->*************************************
5828  *
5829  *  _WmGetDefaultColors (screen, colormap, defaultColor)
5830  *
5831  *
5832  *  Description:
5833  *  -----------
5834  *  This function is used to find or generate default 3-D colors based on a
5835  *  default background color.
5836  *
5837  *
5838  *  Inputs:
5839  *  ------
5840  *  screen = screen for which colors are to be generated.
5841  *
5842  *  colormap = colormap that is to be used to make colors.
5843  *
5844  *  defaultColor = pointer to a default color name/specification.
5845  *
5846  * 
5847  *  Outputs:
5848  *  -------
5849  *  RETURN = pointer to WmColorData structure containing 3-D colors.
5850  * 
5851  *************************************<->***********************************/
5852
5853 XmColorData * _WmGetDefaultColors (Screen *screen, Colormap colormap,
5854                                    String defaultColor)
5855 {
5856     static XmColorData *defaultSet[2] = {NULL, NULL};
5857     static int defaultCount[2] = {0, 0};
5858     static int defaultSize[2] = {0, 0};
5859     int setId;
5860     XmColorData *set;
5861     int count;
5862     int size;
5863     int i;
5864     Display *display = DisplayOfScreen (screen);
5865     XColor colorDef;
5866
5867 /*
5868  * Fix for CR 5152 - Due to the use of Realloc with _XmGetColors, it is
5869  *                   necessary to maintain a separate cache of color
5870  *                   data.  The Realloc may cause the data to be moved,
5871  *                   and the cache would contain pointers into the heap.
5872  */
5873
5874     /*
5875      * Look through the cache to see if the defaults are already in the
5876      * cache.  There is a list of cached defaults for each default color.
5877      */
5878
5879     if (defaultColor == _defaultColor2)
5880     {
5881         setId = 1;
5882     }
5883     else
5884     {
5885         setId = 0;
5886     }
5887
5888     set = defaultSet[setId];
5889     count = defaultCount[setId];
5890     size = defaultSize[setId];
5891     
5892     for (i = 0; i < count; i++)
5893     {
5894         if (((set + i)->screen == screen) && ((set + i)->color_map == colormap))
5895         {
5896             return (set + i);
5897         }
5898     }
5899
5900     /* 
5901      * No match in the cache, make a new entry and generate the colors.
5902      */
5903
5904     if (count == size)
5905     {
5906         size = (defaultSize[setId] += 10);
5907         set = defaultSet[setId] =
5908                 (XmColorData *)WmRealloc ((char *) defaultSet[setId],
5909                                     sizeof (XmColorData) * size);
5910     }
5911
5912     /*
5913      * Make the default background color for the resource set.
5914      */
5915
5916     if(!XParseColor (display, colormap, defaultColor, &colorDef))
5917     {
5918         if(!(strcmp(defaultColor, _defaultColor1)))
5919         {
5920             XParseColor (display, colormap, _defaultColor1HEX, &colorDef);
5921         }
5922         else
5923         {
5924             XParseColor (display, colormap, _defaultColor2HEX, &colorDef);
5925         }
5926     }
5927
5928     XAllocColor (display, colormap, &colorDef);
5929
5930
5931     /*
5932      * Generate the 3-D colors and save them in the defaults cache.
5933      */
5934
5935     XmGetColors(screen, colormap, colorDef.pixel,
5936                 &set[count].foreground.pixel,
5937                 &set[count].top_shadow.pixel,
5938                 &set[count].bottom_shadow.pixel,
5939                 &set[count].select.pixel);
5940     
5941     set[count].background.pixel = colorDef.pixel;
5942     
5943     set[count].screen    = screen;
5944     set[count].color_map = colormap;
5945     set[count].allocated = True;
5946     
5947     XQueryColor(DISPLAY, colormap, &(set[count].background));
5948     XQueryColor(DISPLAY, colormap, &(set[count].foreground));
5949     XQueryColor(DISPLAY, colormap, &(set[count].top_shadow));
5950     XQueryColor(DISPLAY, colormap, &(set[count].bottom_shadow));
5951     XQueryColor(DISPLAY, colormap, &(set[count].select));
5952
5953     (defaultCount[setId])++;
5954
5955     return (set + count);
5956
5957
5958 } /* END OF FUNCTION _WmGetDefaultColors */
5959
5960
5961 \f
5962 /*************************************<->*************************************
5963  *
5964  *  WmRealloc (ptr, size)
5965  *
5966  *
5967  *  Description:
5968  *  -----------
5969  *  This function is used reallocate a block of storage that has been
5970  *  malloc'ed.
5971  *
5972  *
5973  *  Inputs:
5974  *  ------
5975  *  ptr = pointer to storage that is to be realloc'ed; if NULL malloc an
5976  *        initial block of storage.
5977  *
5978  *  size = size of new storage
5979  * 
5980  *  Outputs:
5981  *  -------
5982  *  RETURN = pointer to realloc'ed block of storage
5983  * 
5984  *************************************<->***********************************/
5985
5986 char * WmRealloc (char *ptr, unsigned size)
5987 {
5988     if (ptr)
5989     {
5990         ptr = (char *)XtRealloc (ptr, size);
5991     }
5992     else
5993     {
5994         ptr = (char *)XtMalloc (size);
5995     }
5996
5997     if (ptr == NULL)
5998     {
5999         Warning (((char *)GETMESSAGE(62, 37, "Insufficient memory for window manager data")));
6000     }
6001
6002     return (ptr);
6003
6004 } /* END OF FUNCTION WmRealloc */
6005
6006
6007 \f
6008 /*************************************<->*************************************
6009  *
6010  *  WmMalloc (ptr, size)
6011  *
6012  *
6013  *  Description:
6014  *  -----------
6015  *  This function is used malloc a block of storage.  If a previous block
6016  *  of storage is being replace the old block is free'd.
6017  *
6018  *
6019  *  Inputs:
6020  *  ------
6021  *  ptr = pointer to storage that is to be replaced (free'd).
6022  *
6023  *  size = size of new storage
6024  * 
6025  *  Outputs:
6026  *  -------
6027  *  RETURN = pointer to malloc'ed block of storage
6028  * 
6029  *************************************<->***********************************/
6030
6031 char * WmMalloc (char *ptr, unsigned size)
6032 {
6033     if (ptr)
6034     {
6035         XtFree (ptr);
6036     }
6037
6038     ptr = (char *)XtMalloc (size);
6039
6040     if (ptr == NULL)
6041     {
6042         Warning (((char *)GETMESSAGE(62, 38, "Insufficient memory for window manager data")));
6043     }
6044
6045     return (ptr);
6046
6047 } /* END OF FUNCTION WmMalloc */
6048
6049
6050 \f
6051 /*************************************<->*************************************
6052  *
6053  *  SetupDefaultResources (pSD)
6054  *
6055  *
6056  *  Description:
6057  *  -----------
6058  *  This function is used to setup default (builtin) resources for the
6059  *  key bindings.
6060  *
6061  *
6062  *  Inputs:
6063  *  ------
6064  *  pSD = pointer to screen data
6065  *  wmGD = (defaultKeyBindingsString, ...)
6066  *
6067  *  builtinKeyBindingsName = name of default key bindings set
6068  *
6069  * 
6070  *  Outputs:
6071  *  -------
6072  *   None 
6073  *
6074  *************************************<->***********************************/
6075
6076 void
6077 SetupDefaultResources (WmScreenData *pSD)
6078 {
6079     KeySpec *nextKeySpec;
6080     String keyBindings;
6081     MenuSpec *menuSpec;
6082
6083
6084 /*
6085  * If (using DefaultBindings mechanism and bindings are not found in .mwmrc)
6086  *      then use the builtin bindings.
6087  */
6088     if (!pSD->keySpecs && !wmGD.useStandardBehavior)
6089     {
6090         /*
6091          * Print warning if user is NOT using "DefaultKeyBindings".
6092          */
6093         if (strcmp (pSD->keyBindings, defaultKeyBindingsName))
6094         {
6095            MWarning (((char *)GETMESSAGE(62, 67, "Key bindings %s not found, using builtin key bindings\n")),
6096            pSD->keyBindings);
6097         }
6098         pSD->keyBindings = builtinKeyBindingsName;
6099     }
6100
6101     if (!pSD->buttonSpecs && !wmGD.useStandardBehavior)
6102     {
6103         /*
6104          * Print warning if user is NOT using "DefaultButtonBindings".
6105          */
6106         if (strcmp (pSD->buttonBindings, defaultButtonBindingsName))
6107         {
6108            MWarning (((char *)GETMESSAGE(62, 68, "Button bindings %s not found, using builtin button bindings\n")),
6109                      pSD->buttonBindings);
6110         }
6111         pSD->buttonBindings = builtinButtonBindingsName;
6112     }
6113
6114     if (pSD->keyBindings == builtinKeyBindingsName)
6115     {
6116         /*
6117          * Default key specifications are to be used and no default
6118          * set has been provided by the user.  Make the built-in default
6119          * set.
6120          */
6121
6122         ParseKeyStr (pSD, (unsigned char *)builtinKeyBindings);
6123     }
6124     else
6125     {
6126         /*
6127          * Add the switch behavior key binding to the front of the list
6128          * of user specified key bindings that have been parsed.
6129          */
6130
6131         nextKeySpec = pSD->keySpecs;
6132         keyBindings = pSD->keyBindings;
6133         pSD->keyBindings = behaviorKeyBindingName;
6134         pSD->keySpecs = NULL;
6135
6136         ParseKeyStr (pSD, (unsigned char *)behaviorKeyBindings);
6137
6138         if (pSD->keySpecs)
6139         {
6140             /* Skip past the TWO key definitions (1.2 & 1.1.4) */
6141             pSD->keySpecs->nextKeySpec->nextKeySpec = nextKeySpec;
6142         }
6143         else
6144         {
6145             pSD->keySpecs = nextKeySpec;
6146         }
6147         pSD->keyBindings = keyBindings;
6148     }
6149
6150     if (pSD->buttonBindings == builtinButtonBindingsName)
6151     {
6152         /*
6153          * Default button specifications are to be used and no default
6154          * set has been provided by the user.  Make the built-in default
6155          * set.
6156          */
6157
6158         ParseButtonStr (pSD, (unsigned char *)builtinButtonBindings);
6159     }
6160
6161 #ifdef NO_MESSAGE_CATALOG
6162     /*
6163      * Set defaultSystemMenuUseBuiltin to FALSE if DefaultWindowMenu spec
6164      * is found.
6165      */
6166
6167     menuSpec = pSD->menuSpecs;
6168     while ( menuSpec )
6169     {
6170         if (!strcmp(menuSpec->name, defaultSystemMenuName))
6171         {
6172                 pSD->defaultSystemMenuUseBuiltin = FALSE;
6173                 break;
6174         }
6175         menuSpec = menuSpec->nextMenuSpec;
6176     }
6177 #endif
6178
6179 } /* END OF FUNCTION SetupDefaultResources */
6180
6181
6182 \f
6183 /*************************************<->*************************************
6184  *
6185  *  SimilarAppearanceData (pAD1, pAD2)
6186  *
6187  *
6188  *  Description:
6189  *  -----------
6190  *  This function returns True if the two passed sets of AppearanceData
6191  *  are similar. This is designed to compare appearance data before
6192  *  creation of the GCs.
6193  *
6194  *
6195  *  Inputs:
6196  *  ------
6197  *  pAD1        pointer to AppearanceData 1
6198  *  pAD2        pointer to AppearanceData 2
6199  *
6200  * 
6201  *  Outputs:
6202  *  -------
6203  *  Function returns True if similar, False otherwise.
6204  * 
6205  *  Comments:
6206  *  ---------
6207  *  This function is only used to compare the client
6208  *  and client*title appearance data.
6209  *************************************<->***********************************/
6210
6211 Boolean SimilarAppearanceData (AppearanceData *pAD1, AppearanceData *pAD2)
6212 {
6213     Boolean rval;
6214
6215 #ifdef notdef
6216     if ((pAD1->fontList == pAD2->fontList) &&
6217         (pAD1->background == pAD2->background) &&
6218         (pAD1->foreground == pAD2->foreground) &&
6219         (pAD1->backgroundPStr == pAD2->backgroundPStr) &&
6220         (pAD1->backgroundPixmap == pAD2->backgroundPixmap) &&
6221         (pAD1->bottomShadowColor == pAD2->bottomShadowColor) &&
6222         (pAD1->bottomShadowPStr == pAD2->bottomShadowPStr) &&
6223         (pAD1->bottomShadowPixmap == pAD2->bottomShadowPixmap) &&
6224         (pAD1->topShadowColor == pAD2->topShadowColor) &&
6225         (pAD1->topShadowPStr == pAD2->topShadowPStr) &&
6226         (pAD1->topShadowPixmap == pAD2->topShadowPixmap) &&
6227         (pAD1->activeBackground == pAD2->activeBackground) &&
6228         (pAD1->activeForeground == pAD2->activeForeground) &&
6229         (pAD1->activeBackgroundPStr == pAD2->activeBackgroundPStr) &&
6230         (pAD1->activeBackgroundPixmap == pAD2->activeBackgroundPixmap) &&
6231         (pAD1->activeBottomShadowColor == pAD2->activeBottomShadowColor) &&
6232         (pAD1->activeBottomShadowPStr == pAD2->activeBottomShadowPStr) &&
6233         (pAD1->activeBottomShadowPixmap == pAD2->activeBottomShadowPixmap) &&
6234         (pAD1->activeTopShadowColor == pAD2->activeTopShadowColor) &&
6235         (pAD1->activeTopShadowPStr == pAD2->activeTopShadowPStr) &&
6236         (pAD1->activeTopShadowPixmap == pAD2->activeTopShadowPixmap) )
6237 #else
6238     /*
6239      * !!! Should find out why all the Pixmap resources are unset !!!
6240      */
6241
6242     if ((pAD1->fontList == pAD2->fontList) &&
6243         (pAD1->background == pAD2->background) &&
6244         (pAD1->foreground == pAD2->foreground) &&
6245         (pAD1->backgroundPStr == pAD2->backgroundPStr) &&
6246         (pAD1->bottomShadowColor == pAD2->bottomShadowColor) &&
6247         (pAD1->bottomShadowPStr == pAD2->bottomShadowPStr) &&
6248         (pAD1->topShadowColor == pAD2->topShadowColor) &&
6249         (pAD1->topShadowPStr == pAD2->topShadowPStr) &&
6250         (pAD1->activeBackground == pAD2->activeBackground) &&
6251         (pAD1->activeForeground == pAD2->activeForeground) &&
6252         (pAD1->activeBackgroundPStr == pAD2->activeBackgroundPStr) &&
6253         (pAD1->activeBottomShadowColor == pAD2->activeBottomShadowColor) &&
6254         (pAD1->activeBottomShadowPStr == pAD2->activeBottomShadowPStr) &&
6255         (pAD1->activeTopShadowColor == pAD2->activeTopShadowColor) &&
6256         (pAD1->activeTopShadowPStr == pAD2->activeTopShadowPStr) )
6257 #endif
6258     {
6259         rval = True;
6260     }
6261     else 
6262     {
6263         rval = False;
6264     }
6265
6266     return (rval);
6267
6268 } /* END OF FUNCTION SimilarAppearanceData */
6269
6270 /*************************************<->*************************************
6271  *
6272  *  Monochrome (screen)
6273  *
6274  *
6275  *  Description:
6276  *  -----------
6277  *  This function returns True if the screen passed it to be treated
6278  *  as monochrome for the purpose of assigning default resources.
6279  *
6280  *
6281  *  Inputs:
6282  *  ------
6283  *  screen      pointer to Screen
6284  *
6285  * 
6286  *  Outputs:
6287  *  -------
6288  *  Function returns True if monochrome (or Static Gray), False otherwise.
6289  * 
6290  *************************************<->***********************************/
6291
6292 Boolean 
6293 Monochrome (Screen *screen)
6294 {
6295     WmScreenData *pSD;
6296
6297     int scr;
6298     
6299     if (wmGD.statusColorServer == CSERVE_NORMAL)
6300     {
6301         for (scr = 0; scr < wmGD.numScreens; scr++)
6302         {
6303             pSD = &(wmGD.Screens[scr]);
6304
6305             if (pSD->managed)
6306             {
6307                 if (XScreenOfDisplay (DISPLAY, pSD->screen) == screen)
6308                 {
6309                     if (pSD->colorUse == XmCO_BLACK_WHITE)
6310                     {
6311                         return(True);
6312                     }
6313                     else
6314                     {
6315                         return(False);
6316                     }
6317                 }
6318             }
6319         }
6320     }
6321     /*
6322      *   If we don't know the answer to our question by now,
6323      *   fall back to the old mwm way of determining monochromicity.
6324      *
6325      */
6326
6327     return ((DefaultDepthOfScreen(screen) == 1));
6328 } /* END OF FUNCTION Monochrome */
6329
6330 /****************************   eof    ***************************/