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