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