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