source: trunk/third/mwm/WmResource.c @ 9757

Revision 9757, 97.3 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9756, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
3 * ALL RIGHTS RESERVED
4*/
5/*
6 * Motif Release 1.2.3
7*/
8#ifdef REV_INFO
9#ifndef lint
10static char rcsid[] = "$RCSfile: WmResource.c,v $ $Revision: 1.1.1.1 $ $Date: 1997-03-25 09:12:26 $"
11#endif
12#endif
13/*
14 * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
15
16/*
17 * Included Files:
18 */
19
20#include "WmGlobal.h"
21#include "WmResNames.h"
22
23#define MWM_NEED_IIMAGE
24#include "WmIBitmap.h"
25
26#include <stdio.h>
27
28#include <Xm/XmP.h>
29#include <Xm/RowColumn.h>
30#ifndef MOTIF_ONE_DOT_ONE
31#include <Xm/ScreenP.h>         /* for _XmGetMoveOpaqueByScreen */
32#endif
33
34/*
35 * include extern functions
36 */
37#include "WmResource.h"
38#include "WmError.h"
39#include "WmGraphics.h"
40#include "WmMenu.h"
41#include "WmResParse.h"
42
43/*
44 * Function Declarations:
45 */
46XmColorData *_WmGetDefaultColors ();
47
48#ifdef _NO_PROTO
49void _WmABackgroundDefault ();
50void _WmABackgroundPixmapDefault ();
51void _WmABottomShadowColorDefault ();
52void _WmAForegroundDefault ();
53void _WmATopShadowColorDefault ();
54void _WmATopShadowPixmapDefault ();
55void _WmBackgroundDefault ();
56void _WmBackgroundPixmapDefault ();
57void _WmBottomShadowColorDefault ();
58void _WmFocusAutoRaiseDefault ();
59void _WmForegroundDefault ();
60void _WmGetDynamicDefault ();
61void _WmIconImageBDefault ();
62void _WmIconImageBSCDefault ();
63void _WmIconImageBSPDefault ();
64void _WmIconImageFDefault ();
65void _WmIconImageTSCDefault ();
66void _WmIconImageTSPDefault ();
67void _WmMatteBDefault ();
68void _WmMatteBSCDefault ();
69void _WmMatteBSPDefault ();
70void _WmMatteFDefault ();
71void _WmMatteTSCDefault ();
72void _WmMatteTSPDefault ();
73void _WmMultiClickTimeDefault ();
74void _WmTopShadowColorDefault ();
75void _WmTopShadowPixmapDefault ();
76
77#else /* _NO_PROTO */
78void _WmTopShadowPixmapDefault (Widget widget, int offset, XrmValue *value);
79void _WmIconImageFDefault (Widget widget, int offset, XrmValue *value);
80void _WmIconImageBDefault (Widget widget, int offset, XrmValue *value);
81void _WmIconImageBSCDefault (Widget widget, int offset, XrmValue *value);
82void _WmIconImageBSPDefault (Widget widget, int offset, XrmValue *value);
83void _WmIconImageTSCDefault (Widget widget, int offset, XrmValue *value);
84void _WmIconImageTSPDefault (Widget widget, int offset, XrmValue *value);
85void _WmMatteFDefault (Widget widget, int offset, XrmValue *value);
86void _WmMatteBDefault (Widget widget, int offset, XrmValue *value);
87void _WmMatteBSCDefault (Widget widget, int offset, XrmValue *value);
88void _WmMatteBSPDefault (Widget widget, int offset, XrmValue *value);
89void _WmMatteTSCDefault (Widget widget, int offset, XrmValue *value);
90void _WmMatteTSPDefault (Widget widget, int offset, XrmValue *value);
91void _WmBackgroundDefault (Widget widget, int offset, XrmValue *value);
92void _WmForegroundDefault (Widget widget, int offset, XrmValue *value);
93void _WmBackgroundPixmapDefault (Widget widget, int offset, XrmValue *value);
94void _WmBottomShadowColorDefault (Widget widget, int offset, XrmValue *value);
95void _WmTopShadowColorDefault (Widget widget, int offset, XrmValue *value);
96void _WmABackgroundDefault (Widget widget, int offset, XrmValue *value);
97void _WmAForegroundDefault (Widget widget, int offset, XrmValue *value);
98void _WmABackgroundPixmapDefault (Widget widget, int offset, XrmValue *value);
99void _WmABottomShadowColorDefault (Widget widget, int offset, XrmValue *value);
100void _WmATopShadowColorDefault (Widget widget, int offset, XrmValue *value);
101void _WmATopShadowPixmapDefault (Widget widget, int offset, XrmValue *value);
102void _WmFocusAutoRaiseDefault (Widget widget, int offset, XrmValue *value);
103void _WmMultiClickTimeDefault (Widget widget, int offset, XrmValue *value);
104void ProcessWmResources (void);
105void ProcessGlobalScreenResources (void);
106void SetStdGlobalResourceValues (void);
107void ProcessScreenListResource (void);
108void ProcessAppearanceResources (WmScreenData *pSD);
109void MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean makeActiveResources);
110void 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);
111void ProcessScreenResources (WmScreenData *pSD, unsigned char *screenName);
112void ProcessWorkspaceResources (WmWorkspaceData *pWS);
113void ProcessClientResources (ClientData *pCD);
114void SetStdClientResourceValues (ClientData *pCD);
115void SetStdScreenResourceValues (WmScreenData *pSD);
116GC GetHighlightGC (WmScreenData *pSD, Pixel fg, Pixel bg, Pixmap pixmap);
117void _WmGetDynamicDefault (Widget widget, unsigned char type, String defaultColor, Pixel newBackground, XrmValue *value);
118Boolean SimilarAppearanceData (AppearanceData *pAD1, AppearanceData *pAD2);
119
120#endif /* _NO_PROTO */
121
122
123/*
124 * Global Variables:
125 */
126
127/* builtin window menu specification */
128
129char defaultSystemMenuName[] = "DefaultWindowMenu";
130char builtinSystemMenuName[] = "_MwmWindowMenu_";
131#ifndef MCCABE
132#define BUILTINSYSTEMMENU "_MwmWindowMenu_\n\
133{\n\
134        Restore         _R      Alt<Key>F5      f.restore\n\
135        Move            _M      Alt<Key>F7      f.move\n\
136        Size            _S      Alt<Key>F8      f.resize\n\
137        Minimize        _n      Alt<Key>F9      f.minimize\n\
138        Maximize        _x      Alt<Key>F10     f.maximize\n\
139        Lower           _L      Alt<Key>F3      f.lower\n\
140        no-label                                f.separator\n\
141        Close           _C      Alt<Key>F4      f.kill\n\
142}";
143char builtinSystemMenu[] = BUILTINSYSTEMMENU
144#else /* MCCABE */
145char builtinSystemMenu[];
146#endif /* MCCABE */
147
148char defaultRootMenuName[] = "DefaultRootMenu";
149char builtinRootMenuName[] = "_MwmRootMenu_";
150#ifndef MCCABE
151#define BUILTINROOTMENU "DefaultRootMenu\n\
152{\n\
153        \"Root Menu\"           f.title\n\
154        \"New Window\"          f.exec \"xterm &\"\n\
155        \"Shuffle Up\"          f.circle_up\n\
156        \"Shuffle Down\"        f.circle_down\n\
157        \"Refresh\"             f.refresh\n\
158        \"Pack Icons\"          f.pack_icons\n\
159         no-label               f.separator\n\
160        \"Restart...\"          f.restart\n\
161}";
162char builtinRootMenu[] = BUILTINROOTMENU
163#else /* MCCABE */
164char builtinRootMenu[];
165#endif /* MCCABE */
166
167
168/* builtin key bindings specification */
169
170char defaultKeyBindingsName[] = "DefaultKeyBindings";
171char builtinKeyBindingsName[] = "_MwmKeyBindings_";
172#ifndef MCCABE
173#define BUILTINKEYBINDINGS "_MwmKeyBindings_\n\
174{\n\
175        Shift<Key>Escape        window|icon             f.post_wmenu\n\
176        Alt<Key>space           window|icon             f.post_wmenu\n\
177        Alt<Key>Tab             root|icon|window        f.next_key\n\
178        Alt Shift<Key>Tab       root|icon|window        f.prev_key\n\
179        Alt<Key>Escape          root|icon|window        f.circle_down\n\
180        Alt Shift<Key>Escape    root|icon|window        f.circle_up\n\
181        Alt Shift Ctrl<Key>exclam root|icon|window      f.set_behavior\n\
182        Alt Ctrl<Key>1            root|icon|window      f.set_behavior\n\
183        Alt<Key>F6              window                  f.next_key transient\n\
184        Alt Shift<Key>F6        window                  f.prev_key transient\n\
185        Shift<Key>F10           icon                    f.post_wmenu\n\
186}";
187char builtinKeyBindings[] = BUILTINKEYBINDINGS
188
189#else
190char builtinKeyBindings[];
191#endif
192
193/*
194 * NOTE: Default Toggle Behavior key bindings.  There are TWO key bindings as
195 * of 1.1.4 and 1.2.  Make sure you make any modify builtinKeyBindings (above)
196 * whenever modifying behaviorKeyBindings.
197 */
198
199char behaviorKeyBindingName[] = "_MwmBehaviorKey_";
200#ifndef MCCABE
201#define BEHAVIORKEYBINDINGS "_MwmBehaviorKey_\n\
202{\n\
203        Alt Shift Ctrl<Key>exclam root|icon|window      f.set_behavior\n\
204        Alt Ctrl<Key>1            root|icon|window      f.set_behavior\n\
205}";
206char behaviorKeyBindings[] = BEHAVIORKEYBINDINGS
207
208#else
209char behaviorKeyBindings[];
210#endif
211
212
213/* default button bindings specification */
214
215char defaultButtonBindingsName[] = "DefaultButtonBindings";
216char builtinButtonBindingsName[] = "_MwmButtonBindings_";
217#ifndef MCCABE
218#define BUILTINBUTTONBINDINGS "_MwmButtonBindings_\n\
219{\n\
220        <Btn1Down>      icon|frame      f.raise\n\
221        <Btn3Down>      icon|frame      f.post_wmenu\n\
222        <Btn3Down>      root            f.menu DefaultRootMenu\n\
223}";
224char builtinButtonBindings[] = BUILTINBUTTONBINDINGS
225
226#else
227char builtinButtonBindings[];
228#endif
229
230
231static ClientData *_pCD;
232static String _defaultBackground;
233static String _defaultActiveBackground;
234static AppearanceData *_pAppearanceData;
235
236static char _defaultColor1HEX[] = "#A8A8A8A8A8A8";
237static char _defaultColor2HEX[] = "#5F5F92929E9E";
238
239static char _defaultColor1[] = "LightGrey";
240static char _defaultColor2[] = "CadetBlue";
241#define DEFAULT_COLOR_NONE      NULL
242
243static char _foreground[]    = "foreground";
244static char _50_foreground[] = "50_foreground";
245static char _25_foreground[] = "25_foreground";
246
247#define WmBGC          XmBACKGROUND
248#define WmFGC          XmFOREGROUND
249#define WmTSC          XmTOP_SHADOW
250#define WmBSC          XmBOTTOM_SHADOW
251
252#define MAX_SHORT       0xffff
253
254#ifndef BITMAPDIR
255#define BITMAPDIR "/usr/include/X11/bitmaps/"
256#endif
257
258
259/*************************************<->*************************************
260 *
261 *  wmGlobalResources
262 *
263 *
264 *  Description:
265 *  -----------
266 *  This data structure is used in the processing of mwm general
267 *  appearance and behavior resources.  These resources are specified
268 *  with the following syntax:
269 *
270 *      "Mwm*<resource_identifier>".
271 *
272 *************************************<->***********************************/
273
274
275XtResource wmGlobalResources[] =
276{
277
278    {
279        WmNautoKeyFocus,
280        WmCAutoKeyFocus,
281        XtRBoolean,
282        sizeof (Boolean),
283        XtOffsetOf(WmGlobalData, autoKeyFocus),
284        XtRImmediate,
285        (caddr_t)True
286    },
287
288    {
289        WmNautoRaiseDelay,
290        WmCAutoRaiseDelay,
291        XtRInt,
292        sizeof (int),
293        XtOffsetOf(WmGlobalData, autoRaiseDelay),
294        XtRImmediate,
295        (caddr_t)500
296    },
297
298    {
299        WmNbitmapDirectory,
300        WmCBitmapDirectory,
301        XtRString,
302        sizeof (String),
303        XtOffsetOf(WmGlobalData, bitmapDirectory),
304        XtRString,
305        (caddr_t)BITMAPDIR
306    },
307
308    {
309        WmNclientAutoPlace,
310        WmCClientAutoPlace,
311        XtRBoolean,
312        sizeof (Boolean),
313        XtOffsetOf(WmGlobalData, clientAutoPlace),
314        XtRImmediate,
315        (caddr_t)True
316    },
317
318    {
319        WmNcolormapFocusPolicy,
320        WmCColormapFocusPolicy,
321        WmRCFocusPolicy,
322        sizeof (int),
323        XtOffsetOf(WmGlobalData, colormapFocusPolicy),
324        XtRImmediate,
325        (caddr_t)CMAP_FOCUS_KEYBOARD
326    },
327
328    {
329        WmNconfigFile,
330        WmCConfigFile,
331        XtRString,
332        sizeof (String),
333        XtOffsetOf(WmGlobalData, configFile),
334        XtRImmediate,
335        (caddr_t)NULL
336    },
337
338    {
339        WmNdeiconifyKeyFocus,
340        WmCDeiconifyKeyFocus,
341        XtRBoolean,
342        sizeof (Boolean),
343        XtOffsetOf(WmGlobalData, deiconifyKeyFocus),
344        XtRImmediate,
345        (caddr_t)True
346    },
347
348    {
349        WmNdoubleClickTime,
350        WmCDoubleClickTime,
351        XtRInt,
352        sizeof (int),
353        XtOffsetOf(WmGlobalData, doubleClickTime),
354        XtRCallProc,
355        (caddr_t)_WmMultiClickTimeDefault
356    },
357
358    {
359        WmNenableWarp,
360        WmCEnableWarp,
361        XtRBoolean,
362        sizeof (Boolean),
363        XtOffsetOf(WmGlobalData, enableWarp),
364        XtRImmediate,
365        (caddr_t)True
366    },
367
368    {
369        WmNenforceKeyFocus,
370        WmCEnforceKeyFocus,
371        XtRBoolean,
372        sizeof (Boolean),
373        XtOffsetOf(WmGlobalData, enforceKeyFocus),
374        XtRImmediate,
375        (caddr_t)True
376    },
377
378    {
379        WmNfreezeOnConfig,
380        WmCFreezeOnConfig,
381        XtRBoolean,
382        sizeof (Boolean),
383        XtOffsetOf(WmGlobalData, freezeOnConfig),
384        XtRImmediate,
385        (caddr_t)True
386    },
387
388    {
389        WmNiconAutoPlace,
390        WmCIconAutoPlace,
391        XtRBoolean,
392        sizeof (Boolean),
393        XtOffsetOf(WmGlobalData, iconAutoPlace),
394        XtRImmediate,
395        (caddr_t)True
396    },
397
398    {
399        WmNiconClick,
400        WmCIconClick,
401        XtRBoolean,
402        sizeof (Boolean),
403        XtOffsetOf(WmGlobalData, iconClick),
404        XtRImmediate,
405        (caddr_t)True
406    },
407
408    {
409        WmNinteractivePlacement,
410        WmCInteractivePlacement,
411        XtRBoolean,
412        sizeof (Boolean),
413        XtOffsetOf(WmGlobalData, interactivePlacement),
414        XtRImmediate,
415        (caddr_t)False
416    },
417
418    {
419        WmNkeyboardFocusPolicy,
420        WmCKeyboardFocusPolicy,
421        WmRKFocusPolicy,
422        sizeof (int),
423        XtOffsetOf(WmGlobalData, keyboardFocusPolicy),
424        XtRImmediate,
425        (caddr_t)KEYBOARD_FOCUS_EXPLICIT
426    },
427
428    {
429        WmNlowerOnIconify,
430        WmCLowerOnIconify,
431        XtRBoolean,
432        sizeof (Boolean),
433        XtOffsetOf(WmGlobalData, lowerOnIconify),
434        XtRImmediate,
435        (caddr_t)True
436    },
437
438    {
439        WmNmoveThreshold,
440        WmCMoveThreshold,
441        XtRInt,
442        sizeof (int),
443        XtOffsetOf(WmGlobalData, moveThreshold),
444        XtRImmediate,
445        (caddr_t)4
446    },
447
448    {
449        WmNpassButtons,
450        WmCPassButtons,
451        XtRBoolean,
452        sizeof (Boolean),
453        XtOffsetOf(WmGlobalData, passButtons),
454        XtRImmediate,
455        (caddr_t)False
456    },
457
458    {
459        WmNpassSelectButton,
460        WmCPassSelectButton,
461        XtRBoolean,
462        sizeof (Boolean),
463        XtOffsetOf(WmGlobalData, passSelectButton),
464        XtRImmediate,
465        (caddr_t)True
466    },
467
468    {
469        WmNpositionIsFrame,
470        WmCPositionIsFrame,
471        XtRBoolean,
472        sizeof (Boolean),
473        XtOffsetOf(WmGlobalData, positionIsFrame),
474        XtRImmediate,
475        (caddr_t)True
476    },
477
478    {
479        WmNpositionOnScreen,
480        WmCPositionOnScreen,
481        XtRBoolean,
482        sizeof (Boolean),
483        XtOffsetOf(WmGlobalData, positionOnScreen),
484        XtRImmediate,
485        (caddr_t)True
486    },
487
488    {
489        WmNquitTimeout,
490        WmCQuitTimeout,
491        XtRInt,
492        sizeof (int),
493        XtOffsetOf(WmGlobalData, quitTimeout),
494        XtRImmediate,
495        (caddr_t)1000
496    },
497
498    {
499        WmNraiseKeyFocus,
500        WmCRaiseKeyFocus,
501        XtRBoolean,
502        sizeof (Boolean),
503        XtOffsetOf(WmGlobalData, raiseKeyFocus),
504        XtRImmediate,
505        (caddr_t)False
506    },
507
508    {
509        WmNshowFeedback,
510        WmCShowFeedback,
511        WmRShowFeedback,
512        sizeof (int),
513        XtOffsetOf(WmGlobalData, showFeedback),
514        XtRImmediate,
515        (caddr_t)(WM_SHOW_FB_DEFAULT)
516    },
517
518    {
519        WmNstartupKeyFocus,
520        WmCStartupKeyFocus,
521        XtRBoolean,
522        sizeof (Boolean),
523        XtOffsetOf(WmGlobalData, startupKeyFocus),
524        XtRImmediate,
525        (caddr_t)True
526    },
527
528    {
529        WmNsystemButtonClick,
530        WmCSystemButtonClick,
531        XtRBoolean,
532        sizeof (Boolean),
533        XtOffsetOf(WmGlobalData, systemButtonClick),
534        XtRImmediate,
535        (caddr_t)True
536    },
537
538    {
539        WmNsystemButtonClick2,
540        WmCSystemButtonClick2,
541        XtRBoolean,
542        sizeof (Boolean),
543        XtOffsetOf(WmGlobalData, systemButtonClick2),
544        XtRImmediate,
545        (caddr_t)True
546    },
547}; /* END OF wmGlobalResources[] */
548
549
550/*
551 * These determine the screens to manage at startup.
552 * These are broken out to enhance startup performance.
553 */
554XtResource wmGlobalScreenResources[] =
555{
556    {
557        WmNmultiScreen,
558        WmCMultiScreen,
559        XtRBoolean,
560        sizeof (Boolean),
561        XtOffsetOf(WmGlobalData, multiScreen),
562        XtRImmediate,
563        (caddr_t)False
564    },
565
566    {
567        WmNscreens,
568        WmCScreens,
569        XtRString,
570        sizeof (String),
571        XtOffsetOf(WmGlobalData, screenList),
572        XtRImmediate,
573        (caddr_t)NULL
574    },
575};
576
577
578
579/******************************<->*************************************
580 *
581 *  wmStdGlobalResources
582 *
583 *
584 *  Description:
585 *  -----------
586 *  This data structure is used in the processing of mwm general appearance
587 *  and behavior resources that are not automatically set for the standard
588 *  (default) behavior.  These resources are specified with the following
589 *  syntax:
590 *
591 *      "Mwm*<resource_identifier>".
592 *
593 ******************************<->***********************************/
594
595XtResource wmStdGlobalResources[] =
596{
597
598    {
599        WmNbitmapDirectory,
600        WmCBitmapDirectory,
601        XtRString,
602        sizeof (String),
603        XtOffsetOf(WmGlobalData, bitmapDirectory),
604        XtRString,
605        (caddr_t)BITMAPDIR
606    },
607
608    {
609        WmNconfigFile,
610        WmCConfigFile,
611        XtRString,
612        sizeof (String),
613        XtOffsetOf(WmGlobalData, configFile),
614        XtRImmediate,
615        (caddr_t)NULL
616    },
617
618    {
619        WmNiconAutoPlace,
620        WmCIconAutoPlace,
621        XtRBoolean,
622        sizeof (Boolean),
623        XtOffsetOf(WmGlobalData, iconAutoPlace),
624        XtRImmediate,
625        (caddr_t)True
626    },
627
628    {
629        WmNmoveThreshold,
630        WmCMoveThreshold,
631        XtRInt,
632        sizeof (int),
633        XtOffsetOf(WmGlobalData, moveThreshold),
634        XtRImmediate,
635        (caddr_t)4
636    },
637
638    {
639        WmNpositionIsFrame,
640        WmCPositionIsFrame,
641        XtRBoolean,
642        sizeof (Boolean),
643        XtOffsetOf(WmGlobalData, positionIsFrame),
644        XtRImmediate,
645        (caddr_t)True
646    },
647
648    {
649        WmNpositionOnScreen,
650        WmCPositionOnScreen,
651        XtRBoolean,
652        sizeof (Boolean),
653        XtOffsetOf(WmGlobalData, positionOnScreen),
654        XtRImmediate,
655        (caddr_t)True
656    },
657
658    {
659        WmNquitTimeout,
660        WmCQuitTimeout,
661        XtRInt,
662        sizeof (int),
663        XtOffsetOf(WmGlobalData, quitTimeout),
664        XtRImmediate,
665        (caddr_t)1000
666    },
667
668    {
669        WmNshowFeedback,
670        WmCShowFeedback,
671        WmRShowFeedback,
672        sizeof (int),
673        XtOffsetOf(WmGlobalData, showFeedback),
674        XtRImmediate,
675        (caddr_t)(WM_SHOW_FB_DEFAULT)
676    },
677
678};
679
680
681/******************************<->*************************************
682 *
683 *  wmScreenResources
684 *
685 *
686 *  Description:
687 *  -----------
688 *  This data structure is used in the processing of mwm screen specific
689 *  appearance and behavior resources.  These resources are specified
690 *  with the following syntax:
691 *
692 *      "Mwm*screen<#>*<resource_identifier>".
693 *
694 ******************************<->***********************************/
695
696XtResource wmScreenResources[] =
697{
698    {
699        WmNbuttonBindings,
700        WmCButtonBindings,
701        XtRString,
702        sizeof (String),
703        XtOffsetOf (WmScreenData, buttonBindings),
704        XtRString,
705        (caddr_t)defaultButtonBindingsName
706    },
707
708    {
709        WmNcleanText,
710        WmCCleanText,
711        XtRBoolean,
712        sizeof (Boolean),
713        XtOffsetOf (WmScreenData, cleanText),
714        XtRImmediate,
715        (caddr_t)True
716    },
717
718    {
719        WmNfeedbackGeometry,
720        WmCFeedbackGeometry,
721        XtRString,
722        sizeof (String),
723        XtOffsetOf (WmScreenData, feedbackGeometry),
724        XtRString,
725        (caddr_t)NULL
726    },
727
728    {
729        WmNfadeNormalIcon,
730        WmCFadeNormalIcon,
731        XtRBoolean,
732        sizeof (Boolean),
733        XtOffsetOf (WmScreenData, fadeNormalIcon),
734        XtRImmediate,
735        (caddr_t)False
736    },
737
738    {
739        WmNiconDecoration,
740        WmCIconDecoration,
741        WmRIconDecor,
742        sizeof (int),
743        XtOffsetOf (WmScreenData, iconDecoration),
744        XtRImmediate,
745        (caddr_t)USE_ICON_DEFAULT_APPEARANCE
746    },
747
748    {
749        WmNiconImageMaximum,
750        WmCIconImageMaximum,
751        WmRSize,
752        sizeof (WHSize),
753        XtOffsetOf (WmScreenData, iconImageMaximum),
754        XtRString,
755        "50x50"
756    },
757
758    {
759        WmNiconImageMinimum,
760        WmCIconImageMinimum,
761        WmRSize,
762        sizeof (WHSize),
763        XtOffsetOf (WmScreenData, iconImageMinimum),
764        XtRString,
765        "16x16"
766    },
767
768    {
769        WmNiconPlacement,
770        WmCIconPlacement,
771        WmRIconPlacement,
772        sizeof (int),
773        XtOffsetOf (WmScreenData, iconPlacement),
774        XtRImmediate,
775        (caddr_t)(ICON_PLACE_LEFT_PRIMARY | ICON_PLACE_BOTTOM_SECONDARY)
776    },
777
778    {
779        WmNiconPlacementMargin,
780        WmCIconPlacementMargin,
781        XtRInt,
782        sizeof (int),
783        XtOffsetOf (WmScreenData, iconPlacementMargin),
784        XtRImmediate,
785        (caddr_t)-1
786    },
787
788    {
789        WmNkeyBindings,
790        WmCKeyBindings,
791        XtRString,
792        sizeof (String),
793        XtOffsetOf (WmScreenData, keyBindings),
794        XtRString,
795        (caddr_t)defaultKeyBindingsName
796    },
797
798    {
799        WmNframeBorderWidth,
800        WmCFrameBorderWidth,
801        XtRInt,
802        sizeof (int),
803        XtOffsetOf (WmScreenData, frameBorderWidth),
804        XtRImmediate,
805        (caddr_t) BIGSIZE
806    },
807
808    {
809        WmNiconBoxGeometry,
810        WmCIconBoxGeometry,
811        XtRString,
812        sizeof (String),
813        XtOffsetOf (WmScreenData, iconBoxGeometry),
814        XtRString,
815        (caddr_t)NULL
816    },
817
818    {
819        WmNiconBoxName,
820        WmCIconBoxName,
821        XtRString,
822        sizeof (String),
823        XtOffsetOf (WmScreenData, iconBoxName),
824        XtRString,
825        (caddr_t)"iconbox"
826    },
827
828    {
829        WmNiconBoxSBDisplayPolicy,
830        WmCIconBoxSBDisplayPolicy,
831        XtRString,
832        sizeof (String),
833        XtOffsetOf (WmScreenData, iconBoxSBDisplayPolicy),
834        XtRString,
835        (caddr_t)"all"
836    },
837
838    {
839        WmNiconBoxScheme,
840        WmCIconBoxScheme,
841        XtRInt,
842        sizeof (int),
843        XtOffsetOf (WmScreenData, iconBoxScheme),
844        XtRImmediate,
845        (caddr_t)0
846    },
847
848    {
849        WmNiconBoxTitle,
850        WmCIconBoxTitle,
851        XmRXmString,
852        sizeof (XmString),
853        XtOffsetOf (WmScreenData, iconBoxTitle),
854        XmRXmString,
855        (caddr_t)NULL
856    },
857
858    {
859        WmNlimitResize,
860        WmCLimitResize,
861        XtRBoolean,
862        sizeof (Boolean),
863        XtOffsetOf (WmScreenData, limitResize),
864        XtRImmediate,
865        (caddr_t)True
866    },
867
868    {
869        WmNmaximumMaximumSize,
870        WmCMaximumMaximumSize,
871        WmRSize,
872        sizeof (WHSize),
873        XtOffsetOf (WmScreenData, maximumMaximumSize),
874        XtRString,
875        "0x0"
876    },
877
878    {
879        WmNresizeBorderWidth,
880        WmCFrameBorderWidth,
881        XtRInt,
882        sizeof (int),
883        XtOffsetOf (WmScreenData, resizeBorderWidth),
884        XtRImmediate,
885        (caddr_t) BIGSIZE
886    },
887
888    {
889        WmNresizeCursors,
890        WmCResizeCursors,
891        XtRBoolean,
892        sizeof (Boolean),
893        XtOffsetOf (WmScreenData, resizeCursors),
894        XtRImmediate,
895        (caddr_t)True
896    },
897
898    {
899        WmNtransientDecoration,
900        WmCTransientDecoration,
901        WmRClientDecor,
902        sizeof (int),
903        XtOffsetOf (WmScreenData, transientDecoration),
904        XtRImmediate,
905        (caddr_t)(WM_DECOR_SYSTEM | WM_DECOR_RESIZEH)
906    },
907
908    {
909        WmNtransientFunctions,
910        WmCTransientFunctions,
911        WmRClientFunction,
912        sizeof (int),
913        XtOffsetOf (WmScreenData, transientFunctions),
914        XtRImmediate,
915        (caddr_t)(WM_FUNC_ALL & ~(MWM_FUNC_MAXIMIZE | MWM_FUNC_MINIMIZE))
916    },
917
918
919    {
920        WmNuseIconBox,
921        WmCUseIconBox,
922        XtRBoolean,
923        sizeof (Boolean),
924        XtOffsetOf (WmScreenData, useIconBox),
925        XtRImmediate,
926        (caddr_t)False
927    },
928
929    {
930        WmNmoveOpaque,
931        WmCMoveOpaque,
932        XtRBoolean,
933        sizeof (Boolean),
934        XtOffsetOf (WmScreenData, moveOpaque),
935        XtRImmediate,
936        (caddr_t)False
937
938    }
939
940};
941
942
943/******************************<->*************************************
944 *
945 *  wmStdScreenResources
946 *
947 *
948 *  Description:
949 *  -----------
950 *  This data structure is used in the processing of mwm screen specific
951 *  appearance and behavior resources that are not automatically set for
952 *  the standard (default) behavior.  These resources are specified with
953 *  the following syntax:
954 *
955 *      "Mwm*screen<#>*<resource_identifier>".
956 *
957 ******************************<->***********************************/
958
959XtResource wmStdScreenResources[] =
960{
961    {
962        WmNframeBorderWidth,
963        WmCFrameBorderWidth,
964        XtRInt,
965        sizeof (int),
966        XtOffsetOf (WmScreenData, frameBorderWidth),
967        XtRImmediate,
968        (caddr_t) BIGSIZE
969    },
970
971    {
972        WmNiconImageMaximum,
973        WmCIconImageMaximum,
974        WmRSize,
975        sizeof (WHSize),
976        XtOffsetOf (WmScreenData, iconImageMaximum),
977        XtRString,
978        "50x50"
979    },
980
981    {
982        WmNiconImageMinimum,
983        WmCIconImageMinimum,
984        WmRSize,
985        sizeof (WHSize),
986        XtOffsetOf (WmScreenData, iconImageMinimum),
987        XtRString,
988        "32x32"
989    },
990
991    {
992        WmNiconPlacementMargin,
993        WmCIconPlacementMargin,
994        XtRInt,
995        sizeof (int),
996        XtOffsetOf (WmScreenData, iconPlacementMargin),
997        XtRImmediate,
998        (caddr_t)-1
999    },
1000
1001    {
1002        WmNmaximumMaximumSize,
1003        WmCMaximumMaximumSize,
1004        WmRSize,
1005        sizeof (WHSize),
1006        XtOffsetOf (WmScreenData, maximumMaximumSize),
1007        XtRString,
1008        "0x0"
1009    },
1010
1011    {
1012        WmNresizeBorderWidth,
1013        WmCFrameBorderWidth,
1014        XtRInt,
1015        sizeof (int),
1016        XtOffsetOf (WmScreenData, resizeBorderWidth),
1017        XtRImmediate,
1018        (caddr_t) BIGSIZE
1019    }
1020};
1021
1022
1023
1024/******************************<->*************************************
1025 *
1026 *  wmWorkspaceResources
1027 *
1028 *
1029 *  Description:
1030 *  -----------
1031 *  This data structure is used in the processing of mwm workspace
1032 *  specific appearance and behavior resources.  These resources are
1033 *  specified with the following syntax:
1034 *
1035 *      "Mwm*[screen<#>*]<workspace>*<resource_identifier>".
1036 *
1037 ******************************<->***********************************/
1038XtResource *wmWorkspaceResources = NULL;
1039
1040
1041
1042/******************************<->*************************************
1043 *
1044 *  wmStdWorkspaceResources
1045 *
1046 *
1047 *  Description:
1048 *  -----------
1049 *  This data structure is used in the processing of mwm workspace specific
1050 *  appearance and behavior resources that are not automatically set for
1051 *  the standard (default) behavior.  These resources are specified with
1052 *  the following syntax:
1053 *
1054 *      "Mwm*[screen<#>*]<workspace>*<resource_identifier>".
1055 *
1056 *************************************<->***********************************/
1057
1058XtResource *wmStdWorkspaceResources = NULL;
1059
1060
1061
1062/*************************************<->*************************************
1063 *
1064 *  wmClientResources
1065 *
1066 *
1067 *  Description:
1068 *  -----------
1069 *  This data structure is used in the processing of client specific
1070 *  window manager resources.  These resources are specified with the
1071 *  following syntax:
1072 *
1073 *      "Mwm*<client_name_or_class>*<resource_identifier>"
1074 *
1075 *************************************<->***********************************/
1076
1077XtResource wmClientResources[] =
1078{
1079
1080    {
1081        WmNclientDecoration,
1082        WmCClientDecoration,
1083        WmRClientDecor,
1084        sizeof (int),
1085        XtOffsetOf (ClientData, clientDecoration),
1086        XtRImmediate,
1087        (caddr_t)(WM_DECOR_DEFAULT)
1088    },
1089
1090    {
1091        WmNclientFunctions,
1092        WmCClientFunctions,
1093        WmRClientFunction,
1094        sizeof (int),
1095        XtOffsetOf (ClientData, clientFunctions),
1096        XtRImmediate,
1097        (caddr_t)(WM_FUNC_DEFAULT)
1098    },
1099
1100    {
1101        WmNfocusAutoRaise,
1102        WmCFocusAutoRaise,
1103        XtRBoolean,
1104        sizeof (Boolean),
1105        XtOffsetOf (ClientData, focusAutoRaise),
1106        XtRCallProc,
1107        (caddr_t)_WmFocusAutoRaiseDefault
1108    },
1109
1110    {
1111        WmNiconImage,
1112        WmCIconImage,
1113        XtRString,
1114        sizeof (String),
1115        XtOffsetOf (ClientData, iconImage),
1116        XtRString,
1117        (caddr_t)NULL
1118    },
1119
1120    {
1121        WmNiconImageBackground,
1122        WmCIconImageBackground,
1123        XtRPixel,
1124        sizeof (Pixel),
1125        XtOffsetOf (ClientData, iconImageBackground),
1126        XtRCallProc,
1127        (caddr_t)_WmIconImageBDefault
1128    },
1129
1130    {
1131        WmNiconImageForeground,
1132        WmCIconImageForeground,
1133        XtRPixel,
1134        sizeof (Pixel),
1135        XtOffsetOf (ClientData, iconImageForeground),
1136        XtRCallProc,
1137        (caddr_t)_WmIconImageFDefault
1138    },
1139
1140    {
1141        WmNiconImageBottomShadowColor,
1142        WmCIconImageBottomShadowColor,
1143        XtRPixel,
1144        sizeof (Pixel),
1145        XtOffsetOf (ClientData, iconImageBottomShadowColor),
1146        XtRCallProc,
1147        (caddr_t)_WmIconImageBSCDefault
1148    },
1149
1150    {
1151        WmNiconImageBottomShadowPixmap,
1152        WmCIconImageBottomShadowPixmap,
1153        XtRString,
1154        sizeof (String),
1155        XtOffsetOf (ClientData, iconImageBottomShadowPStr),
1156        XtRCallProc,
1157        (caddr_t)_WmIconImageBSPDefault
1158    },
1159
1160    {
1161        WmNiconImageTopShadowColor,
1162        WmCIconImageTopShadowColor,
1163        XtRPixel,
1164        sizeof (Pixel),
1165        XtOffsetOf (ClientData, iconImageTopShadowColor),
1166        XtRCallProc,
1167        (caddr_t)_WmIconImageTSCDefault
1168    },
1169
1170    {
1171        WmNiconImageTopShadowPixmap,
1172        WmCIconImageTopShadowPixmap,
1173        XtRString,
1174        sizeof (String),
1175        XtOffsetOf (ClientData, iconImageTopShadowPStr),
1176        XtRCallProc,
1177        (caddr_t)_WmIconImageTSPDefault
1178    },
1179
1180    {
1181        WmNmatteWidth,
1182        WmCMatteWidth,
1183        XtRInt,
1184        sizeof (int),
1185        XtOffsetOf (ClientData, matteWidth),
1186        XtRImmediate,
1187        (caddr_t)0
1188    },
1189
1190    {
1191        WmNmaximumClientSize,
1192        WmCMaximumClientSize,
1193        WmRSize,
1194        sizeof (WHSize),
1195        XtOffsetOf (ClientData, maximumClientSize),
1196        XtRString,
1197        "0x0"
1198    },
1199
1200    {
1201        WmNsystemMenu,
1202        WmCSystemMenu,
1203        XtRString,
1204        sizeof (String),
1205        XtOffsetOf (ClientData, systemMenu),
1206        XtRString,
1207        (caddr_t)defaultSystemMenuName
1208    },
1209
1210    {
1211        WmNuseClientIcon,
1212        WmCUseClientIcon,
1213        XtRBoolean,
1214        sizeof (Boolean),
1215        XtOffsetOf (ClientData, useClientIcon),
1216        XtRImmediate,
1217        (caddr_t)False
1218    },
1219
1220    {
1221        WmNusePPosition,
1222        WmCUsePPosition,
1223        WmRUsePPosition,
1224        sizeof (int),
1225        XtOffsetOf (ClientData, usePPosition),
1226        XtRImmediate,
1227        (caddr_t)(USE_PPOSITION_NONZERO)
1228    }
1229
1230}; /* END OF STRUCTURE wmClientResources */
1231
1232
1233
1234/*************************************<->*************************************
1235 *
1236 *  wmStdClientResources
1237 *
1238 *
1239 *  Description:
1240 *  -----------
1241 *  This data structure is used in the processing of client specific
1242 *  window manager resources that are not automatically set for the standard
1243 *  (default) behavior.  These resources are specified with the
1244 *  following syntax:
1245 *
1246 *      "Mwm*<client_name_or_class>*<resource_identifier>"
1247 *
1248 *************************************<->***********************************/
1249
1250XtResource wmStdClientResources[] =
1251{
1252
1253    {
1254        WmNiconImage,
1255        WmCIconImage,
1256        XtRString,
1257        sizeof (String),
1258        XtOffsetOf (ClientData, iconImage),
1259        XtRString,
1260        (caddr_t)NULL
1261    },
1262
1263    {
1264        WmNiconImageBackground,
1265        WmCIconImageBackground,
1266        XtRPixel,
1267        sizeof (Pixel),
1268        XtOffsetOf (ClientData, iconImageBackground),
1269        XtRCallProc,
1270        (caddr_t)_WmIconImageBDefault
1271    },
1272
1273    {
1274        WmNiconImageForeground,
1275        WmCIconImageForeground,
1276        XtRPixel,
1277        sizeof (Pixel),
1278        XtOffsetOf (ClientData, iconImageForeground),
1279        XtRCallProc,
1280        (caddr_t)_WmIconImageFDefault
1281    },
1282
1283    {
1284        WmNiconImageBottomShadowColor,
1285        WmCIconImageBottomShadowColor,
1286        XtRPixel,
1287        sizeof (Pixel),
1288        XtOffsetOf (ClientData, iconImageBottomShadowColor),
1289        XtRCallProc,
1290        (caddr_t)_WmIconImageBSCDefault
1291    },
1292
1293    {
1294        WmNiconImageBottomShadowPixmap,
1295        WmCIconImageBottomShadowPixmap,
1296        XtRString,
1297        sizeof (String),
1298        XtOffsetOf (ClientData, iconImageBottomShadowPStr),
1299        XtRCallProc,
1300        (caddr_t)_WmIconImageBSPDefault
1301    },
1302
1303    {
1304        WmNiconImageTopShadowColor,
1305        WmCIconImageTopShadowColor,
1306        XtRPixel,
1307        sizeof (Pixel),
1308        XtOffsetOf (ClientData, iconImageTopShadowColor),
1309        XtRCallProc,
1310        (caddr_t)_WmIconImageTSCDefault
1311    },
1312
1313    {
1314        WmNiconImageTopShadowPixmap,
1315        WmCIconImageTopShadowPixmap,
1316        XtRString,
1317        sizeof (String),
1318        XtOffsetOf (ClientData, iconImageTopShadowPStr),
1319        XtRCallProc,
1320        (caddr_t)_WmIconImageTSPDefault
1321    },
1322
1323    {
1324        WmNmatteWidth,
1325        WmCMatteWidth,
1326        XtRInt,
1327        sizeof (int),
1328        XtOffsetOf (ClientData, matteWidth),
1329        XtRImmediate,
1330        (caddr_t)0
1331    },
1332
1333    {
1334        WmNmaximumClientSize,
1335        WmCMaximumClientSize,
1336        WmRSize,
1337        sizeof (WHSize),
1338        XtOffsetOf (ClientData, maximumClientSize),
1339        XtRString,
1340        "0x0"
1341    },
1342
1343    {
1344        WmNuseClientIcon,
1345        WmCUseClientIcon,
1346        XtRBoolean,
1347        sizeof (Boolean),
1348        XtOffsetOf (ClientData, useClientIcon),
1349        XtRImmediate,
1350        (caddr_t)False
1351    }
1352
1353};
1354
1355
1356
1357/*************************************<->*************************************
1358 *
1359 *  wmClientResourcesM
1360 *
1361 *
1362 *  Description:
1363 *  -----------
1364 *  This data structure is used in the processing of client specific
1365 *  window manager resources that affect the appearance of the client
1366 *  matte.  These resources are specified with the following syntax:
1367 *
1368 *      "Mwm*<client_name_or_class>*<resource_identifier>"
1369 *
1370 *************************************<->***********************************/
1371
1372XtResource wmClientResourcesM[] =
1373{
1374    {
1375        WmNmatteBackground,
1376        WmCMatteBackground,
1377        XtRPixel,
1378        sizeof (Pixel),
1379        XtOffsetOf (ClientData, matteBackground),
1380        XtRCallProc,
1381        (caddr_t)_WmMatteBDefault
1382    },
1383
1384    {
1385        WmNmatteForeground,
1386        WmCMatteForeground,
1387        XtRPixel,
1388        sizeof (Pixel),
1389        XtOffsetOf (ClientData, matteForeground),
1390        XtRCallProc,
1391        (caddr_t)_WmMatteFDefault
1392    },
1393
1394    {
1395        WmNmatteBottomShadowColor,
1396        WmCMatteBottomShadowColor,
1397        XtRPixel,
1398        sizeof (Pixel),
1399        XtOffsetOf (ClientData, matteBottomShadowColor),
1400        XtRCallProc,
1401        (caddr_t)_WmMatteBSCDefault
1402    },
1403
1404    {
1405        WmNmatteBottomShadowPixmap,
1406        WmCMatteBottomShadowPixmap,
1407        XtRString,
1408        sizeof (String),
1409        XtOffsetOf (ClientData, matteBottomShadowPStr),
1410        XtRCallProc,
1411        (caddr_t)_WmMatteBSPDefault
1412    },
1413
1414    {
1415        WmNmatteTopShadowColor,
1416        WmCMatteTopShadowColor,
1417        XtRPixel,
1418        sizeof (Pixel),
1419        XtOffsetOf (ClientData, matteTopShadowColor),
1420        XtRCallProc,
1421        (caddr_t)_WmMatteTSCDefault
1422    },
1423
1424    {
1425        WmNmatteTopShadowPixmap,
1426        WmCMatteTopShadowPixmap,
1427        XtRString,
1428        sizeof (String),
1429        XtOffsetOf (ClientData, matteTopShadowPStr),
1430        XtRCallProc,
1431        (caddr_t)_WmMatteTSPDefault
1432    }
1433};
1434
1435
1436
1437/*************************************<->*************************************
1438 *
1439 *  wmAppearanceResources
1440 *
1441 *
1442 *  Description:
1443 *  -----------
1444 *  This data structure is used in the processing of component appearance
1445 *  resources.  These resources are specified with the following syntax:
1446 *
1447 *      "Mwm*<resource_identifier>"
1448 *      "Mwm*client*<resource_identifier>"
1449 *      "Mwm*icon*<resource_identifier>"
1450 *      "Mwm*feedback*<resource_identifier>"
1451 *
1452 *************************************<->***********************************/
1453
1454XtResource wmAppearanceResources[] =
1455{
1456
1457    {
1458        XmNfontList,
1459        XmCFontList,
1460        XmRFontList,
1461        sizeof (XmFontList),
1462        XtOffsetOf (AppearanceData, fontList),
1463        XtRString,
1464        "fixed"
1465    },
1466
1467    {
1468        WmNsaveUnder,
1469        WmCSaveUnder,
1470        XtRBoolean,
1471        sizeof (Boolean),
1472        XtOffsetOf (AppearanceData, saveUnder),
1473        XtRImmediate,
1474        (caddr_t)False
1475    },
1476
1477    {
1478        XtNbackground,
1479        XtCBackground,
1480        XtRPixel,
1481        sizeof (Pixel),
1482        XtOffsetOf (AppearanceData, background),
1483        XtRCallProc,
1484        (caddr_t)_WmBackgroundDefault
1485    },
1486
1487    {
1488        XtNforeground,
1489        XtCForeground,
1490        XtRPixel,
1491        sizeof (Pixel),
1492        XtOffsetOf (AppearanceData, foreground),
1493        XtRCallProc,
1494        (caddr_t)_WmForegroundDefault
1495    },
1496
1497    {
1498        XmNbottomShadowColor,
1499        XtCForeground,
1500        XtRPixel,
1501        sizeof (Pixel),
1502        XtOffsetOf (AppearanceData, bottomShadowColor),
1503        XtRCallProc,
1504        (caddr_t)_WmBottomShadowColorDefault
1505    },
1506
1507    {
1508        XmNbottomShadowPixmap,
1509        XmCBottomShadowPixmap,
1510        XtRString,
1511        sizeof (String),
1512        XtOffsetOf (AppearanceData, bottomShadowPStr),
1513        XtRString,
1514        (caddr_t)NULL
1515    },
1516
1517    {
1518        XmNtopShadowColor,
1519        XtCForeground,
1520        XtRPixel,
1521        sizeof (Pixel),
1522        XtOffsetOf (AppearanceData, topShadowColor),
1523        XtRCallProc,
1524        (caddr_t)_WmTopShadowColorDefault
1525    },
1526
1527    {
1528        XmNbackgroundPixmap,
1529        XmCBackgroundPixmap,
1530        XtRString,
1531        sizeof (String),
1532        XtOffsetOf (AppearanceData, backgroundPStr),
1533        XtRCallProc,
1534        (caddr_t)_WmBackgroundPixmapDefault
1535    },
1536
1537    {
1538        XmNtopShadowPixmap,
1539        XmCTopShadowPixmap,
1540        XtRString,
1541        sizeof (String),
1542        XtOffsetOf (AppearanceData, topShadowPStr),
1543        XtRCallProc,
1544        (caddr_t)_WmTopShadowPixmapDefault
1545    },
1546
1547    {
1548        WmNactiveBackground,
1549        XtCBackground,
1550        XtRPixel,
1551        sizeof (Pixel),
1552        XtOffsetOf (AppearanceData, activeBackground),
1553        XtRCallProc,
1554        (caddr_t)_WmABackgroundDefault
1555    },
1556
1557    {
1558        WmNactiveForeground,
1559        XtCForeground,
1560        XtRPixel,
1561        sizeof (Pixel),
1562        XtOffsetOf (AppearanceData, activeForeground),
1563        XtRCallProc,
1564        (caddr_t)_WmAForegroundDefault
1565    },
1566
1567    {
1568        WmNactiveBottomShadowColor,
1569        XtCForeground,
1570        XtRPixel,
1571        sizeof (Pixel),
1572        XtOffsetOf (AppearanceData, activeBottomShadowColor),
1573        XtRCallProc,
1574        (caddr_t)_WmABottomShadowColorDefault
1575    },
1576
1577    {
1578        WmNactiveBottomShadowPixmap,
1579        XmCBottomShadowPixmap,
1580        XtRString,
1581        sizeof (String),
1582        XtOffsetOf (AppearanceData, activeBottomShadowPStr),
1583        XtRString,
1584        (caddr_t)NULL
1585    },
1586
1587    {
1588        WmNactiveTopShadowColor,
1589        XtCForeground,
1590        XtRPixel,
1591        sizeof (Pixel),
1592        XtOffsetOf (AppearanceData, activeTopShadowColor),
1593        XtRCallProc,
1594        (caddr_t)_WmATopShadowColorDefault
1595    },
1596
1597    {
1598        WmNactiveBackgroundPixmap,
1599        XmCBackgroundPixmap,
1600        XtRString,
1601        sizeof (String),
1602        XtOffsetOf (AppearanceData, activeBackgroundPStr),
1603        XtRCallProc,
1604        (caddr_t)_WmABackgroundPixmapDefault
1605    },
1606
1607    {
1608        WmNactiveTopShadowPixmap,
1609        XmCTopShadowPixmap,
1610        XtRString,
1611        sizeof (String),
1612        XtOffsetOf (AppearanceData, activeTopShadowPStr),
1613        XtRCallProc,
1614        (caddr_t)_WmATopShadowPixmapDefault
1615    }
1616
1617};
1618
1619
1620
1621/*************************************<->*************************************
1622 *
1623 *  _WmIconImageFDefault (widget, offset, value)
1624 *  _WmIconImageBDefault (widget, offset, value)
1625 *  _WmIconImageBSCDefault (widget, offset, value)
1626 *  _WmIconImageBSPDefault (widget, offset, value)
1627 *  _WmIconImageTSCDefault (widget, offset, value)
1628 *  _WmIconImageTSPDefault (widget, offset, value)
1629 *  _WmMatteFDefault (widget, offset, value)
1630 *  _WmMatteBDefault (widget, offset, value)
1631 *  _WmMatteBSCDefault (widget, offset, value)
1632 *  _WmMatteBSPDefault (widget, offset, value)
1633 *  _WmMatteTSCDefault (widget, offset, value)
1634 *  _WmMatteTSPDefault (widget, offset, value)
1635 *
1636 *
1637 *  Description:
1638 *  -----------
1639 *  These functions are used to generate dynamic defaults for various
1640 *  client-specific appearance related resources.
1641 *
1642 *
1643 *  Inputs:
1644 *  ------
1645 *  widget = this is the parent widget for the wm subpart
1646 *
1647 *  offset = this is the resource offset
1648 *
1649 *  value = this is a pointer to a XrmValue in which to store the result
1650 *
1651 *  _pCD = (static global) pointer to client data associated with resources
1652 *
1653 *
1654 *  Outputs:
1655 *  -------
1656 *  value = default resource value and size
1657 *
1658 *************************************<->***********************************/
1659
1660#ifdef _NO_PROTO
1661void
1662_WmIconImageFDefault (widget, offset, value)
1663        Widget   widget;
1664        int      offset;
1665        XrmValue *value;
1666
1667#else /* _NO_PROTO */
1668void
1669_WmIconImageFDefault (Widget widget, int offset, XrmValue *value)
1670#endif /* _NO_PROTO */
1671{
1672    _WmGetDynamicDefault (widget, WmFGC, 0,
1673        _pCD->iconImageBackground, value);
1674
1675} /* END OF FUNCTION _WmIconImageFDefault */
1676
1677#ifdef _NO_PROTO
1678void
1679_WmIconImageBDefault (widget, offset, value)
1680        Widget   widget;
1681        int      offset;
1682        XrmValue *value;
1683
1684#else /* _NO_PROTO */
1685void
1686_WmIconImageBDefault (Widget widget, int offset, XrmValue *value)
1687#endif /* _NO_PROTO */
1688{
1689    value->addr = (char *)&(_pCD->pSD->iconAppearance.background);
1690    value->size = sizeof (Pixel);
1691
1692} /* END OF FUNCTION _WmIconImageBDefault */
1693
1694
1695#ifdef _NO_PROTO
1696void
1697_WmIconImageBSCDefault (widget, offset, value)
1698        Widget   widget;
1699        int      offset;
1700        XrmValue *value;
1701
1702#else /* _NO_PROTO */
1703void
1704_WmIconImageBSCDefault (Widget widget, int offset, XrmValue *value)
1705#endif /* _NO_PROTO */
1706{
1707    _WmGetDynamicDefault (widget, WmBSC, 0,
1708        _pCD->iconImageBackground, value);
1709
1710} /* END OF FUNCTION _WmIconImageBSCDefault */
1711
1712
1713#ifdef _NO_PROTO
1714void
1715_WmIconImageBSPDefault (widget, offset, value)
1716        Widget   widget;
1717        int      offset;
1718        XrmValue *value;
1719
1720#else /* _NO_PROTO */
1721void
1722_WmIconImageBSPDefault (Widget widget, int offset, XrmValue *value)
1723#endif /* _NO_PROTO */
1724{
1725
1726    value->addr = (char *)_pCD->pSD->iconAppearance.bottomShadowPStr;
1727    value->size = sizeof (String);
1728
1729} /* END OF FUNCTION _WmIconImageBSCDefault */
1730
1731
1732#ifdef _NO_PROTO
1733void
1734_WmIconImageTSCDefault (widget, offset, value)
1735        Widget   widget;
1736        int      offset;
1737        XrmValue *value;
1738
1739#else /* _NO_PROTO */
1740void
1741_WmIconImageTSCDefault (Widget widget, int offset, XrmValue *value)
1742#endif /* _NO_PROTO */
1743{
1744    _WmGetDynamicDefault (widget, WmTSC, 0,
1745        _pCD->iconImageBackground, value);
1746
1747} /* END OF FUNCTION _WmIconImageTSCDefault */
1748
1749
1750#ifdef _NO_PROTO
1751void
1752_WmIconImageTSPDefault (widget, offset, value)
1753        Widget   widget;
1754        int      offset;
1755        XrmValue *value;
1756
1757#else /* _NO_PROTO */
1758void
1759_WmIconImageTSPDefault (Widget widget, int offset, XrmValue *value)
1760#endif /* _NO_PROTO */
1761{
1762
1763    value->addr = (char *)_pCD->pSD->iconAppearance.topShadowPStr;
1764    value->size = sizeof (String);
1765
1766} /* END OF FUNCTION _WmIconImageTSPDefault */
1767
1768
1769#ifdef _NO_PROTO
1770void
1771_WmMatteFDefault (widget, offset, value)
1772        Widget   widget;
1773        int      offset;
1774        XrmValue *value;
1775
1776#else /* _NO_PROTO */
1777void
1778_WmMatteFDefault (Widget widget, int offset, XrmValue *value)
1779#endif /* _NO_PROTO */
1780{
1781    _WmGetDynamicDefault (widget, WmFGC, 0,
1782        _pCD->matteBackground, value);
1783
1784} /* END OF FUNCTION _WmMatteFDefault */
1785
1786
1787#ifdef _NO_PROTO
1788void
1789_WmMatteBDefault (widget, offset, value)
1790        Widget   widget;
1791        int      offset;
1792        XrmValue *value;
1793
1794#else /* _NO_PROTO */
1795void
1796_WmMatteBDefault (Widget widget, int offset, XrmValue *value)
1797#endif /* _NO_PROTO */
1798{
1799    value->addr = (char *)&(_pCD->pSD->clientAppearance.background);
1800    value->size = sizeof (Pixel);
1801
1802} /* END OF FUNCTION _WmMatteBDefault */
1803
1804
1805#ifdef _NO_PROTO
1806void
1807_WmMatteBSCDefault (widget, offset, value)
1808        Widget   widget;
1809        int      offset;
1810        XrmValue *value;
1811
1812#else /* _NO_PROTO */
1813void
1814_WmMatteBSCDefault (Widget widget, int offset, XrmValue *value)
1815#endif /* _NO_PROTO */
1816{
1817    _WmGetDynamicDefault (widget, WmBSC, 0,
1818        _pCD->matteBackground, value);
1819
1820} /* END OF FUNCTION _WmMatteBSCDefault */
1821
1822
1823#ifdef _NO_PROTO
1824void
1825_WmMatteBSPDefault (widget, offset, value)
1826        Widget   widget;
1827        int      offset;
1828        XrmValue *value;
1829
1830#else /* _NO_PROTO */
1831void
1832_WmMatteBSPDefault (Widget widget, int offset, XrmValue *value)
1833#endif /* _NO_PROTO */
1834{
1835
1836    value->addr = (char *)_pCD->pSD->clientAppearance.bottomShadowPStr;
1837    value->size = sizeof (String);
1838
1839} /* END OF FUNCTION _WmMatteBSCDefault */
1840
1841
1842#ifdef _NO_PROTO
1843void
1844_WmMatteTSCDefault (widget, offset, value)
1845        Widget   widget;
1846        int      offset;
1847        XrmValue *value;
1848
1849#else /* _NO_PROTO */
1850void
1851_WmMatteTSCDefault (Widget widget, int offset, XrmValue *value)
1852#endif /* _NO_PROTO */
1853{
1854    _WmGetDynamicDefault (widget, WmTSC, 0,
1855        _pCD->matteBackground, value);
1856
1857} /* END OF FUNCTION _WmMatteTSCDefault */
1858
1859
1860#ifdef _NO_PROTO
1861void
1862_WmMatteTSPDefault (widget, offset, value)
1863        Widget   widget;
1864        int      offset;
1865        XrmValue *value;
1866
1867#else /* _NO_PROTO */
1868void
1869_WmMatteTSPDefault (Widget widget, int offset, XrmValue *value)
1870#endif /* _NO_PROTO */
1871{
1872
1873    value->addr = (char *)_pCD->pSD->clientAppearance.topShadowPStr;
1874    value->size = sizeof (String);
1875
1876} /* END OF FUNCTION _WmMatteTSCDefault */
1877
1878
1879
1880/*************************************<->*************************************
1881 *
1882 *  _WmBackgroundDefault (widget, offset, value)
1883 *  _WmForegroundDefault (widget, offset, value)
1884 *  _WmBackgroundPixmapDefault (widget, offset, value)
1885 *  _WmBottomShadowColorDefault (widget, offset, value)
1886 *  _WmTopShadowColorDefault (widget, offset, value)
1887 *  _WmTopShadowPixmapDefault (widget, offset, value)
1888 *  _WmABackgroundDefault (widget, offset, value)
1889 *  _WmAForegroundDefault (widget, offset, value)
1890 *  _WmABackgroundPixmapDefault (widget, offset, value)
1891 *  _WmABottomShadowColorDefault (widget, offset, value)
1892 *  _WmRFBackgroundDefault (widget, offset, value)
1893 *  _WmRFForegroundDefault (widget, offset, value)
1894 *  _WmATopShadowColorDefault (widget, offset, value)
1895 *  _WmATopShadowPixmapDefault (widget, offset, value)
1896 *
1897 *
1898 *  Description:
1899 *  -----------
1900 *  These functions are used to generate dynamic defaults for various
1901 *  component appearance related resources (not client-specific).
1902 *
1903 *
1904 *  Inputs:
1905 *  ------
1906 *  widget = this is the parent widget for the wm subpart
1907 *
1908 *  offset = this is the resource offset
1909 *
1910 *  value = this is a pointer to a XrmValue in which to store the result
1911 *
1912 *  _defaultBackground = (static global) default background color (inactive)
1913 *
1914 *  _defaultActiveBackground = (static global) default bg color (active)
1915 *
1916 *  _pAppearanceData = (static global) pointer to resouce set structure
1917 *
1918 *
1919 *  Outputs:
1920 *  -------
1921 *  value = default resource value and size
1922 *
1923 *************************************<->***********************************/
1924
1925#ifdef _NO_PROTO
1926void
1927_WmBackgroundDefault (widget, offset, value)
1928        Widget   widget;
1929        int      offset;
1930        XrmValue *value;
1931
1932#else /* _NO_PROTO */
1933void
1934_WmBackgroundDefault (Widget widget, int offset, XrmValue *value)
1935#endif /* _NO_PROTO */
1936{
1937    _WmGetDynamicDefault (widget, WmBGC, _defaultBackground, 0, value);
1938
1939} /* END OF FUNCTION _WmBackgroundDefault */
1940
1941
1942#ifdef _NO_PROTO
1943void
1944_WmForegroundDefault (widget, offset, value)
1945        Widget   widget;
1946        int      offset;
1947        XrmValue *value;
1948
1949#else /* _NO_PROTO */
1950void
1951_WmForegroundDefault (Widget widget, int offset, XrmValue *value)
1952#endif /* _NO_PROTO */
1953{
1954    _WmGetDynamicDefault (widget, WmFGC, 0, _pAppearanceData->background,
1955        value);
1956
1957} /* END OF FUNCTION _WmForegroundDefault */
1958
1959
1960#ifdef _NO_PROTO
1961void
1962_WmBackgroundPixmapDefault (widget, offset, value)
1963        Widget   widget;
1964        int      offset;
1965        XrmValue *value;
1966
1967#else /* _NO_PROTO */
1968void
1969_WmBackgroundPixmapDefault (Widget widget, int offset, XrmValue *value)
1970#endif /* _NO_PROTO */
1971{
1972    static String string;
1973
1974
1975    if ((Monochrome (XtScreen (widget))) ||
1976        (_pAppearanceData->topShadowColor == _pAppearanceData->background))
1977    {
1978        string = _25_foreground;
1979    }
1980    else
1981    {
1982        string = NULL;
1983    }
1984
1985    value->addr = (char *)string;
1986    value->size = sizeof (String);
1987
1988} /* END OF FUNCTION _WmBackgroundPixmapDefault */
1989
1990
1991#ifdef _NO_PROTO
1992void
1993_WmBottomShadowColorDefault (widget, offset, value)
1994        Widget   widget;
1995        int      offset;
1996        XrmValue *value;
1997
1998#else /* _NO_PROTO */
1999void
2000_WmBottomShadowColorDefault (Widget widget, int offset, XrmValue *value)
2001#endif /* _NO_PROTO */
2002{
2003    _WmGetDynamicDefault (widget, WmBSC, 0, _pAppearanceData->background,
2004        value);
2005
2006} /* END OF FUNCTION _WmBottomShadowColorDefault */
2007
2008
2009#ifdef _NO_PROTO
2010void
2011_WmTopShadowColorDefault (widget, offset, value)
2012        Widget   widget;
2013        int      offset;
2014        XrmValue *value;
2015
2016#else /* _NO_PROTO */
2017void
2018_WmTopShadowColorDefault (Widget widget, int offset, XrmValue *value)
2019#endif /* _NO_PROTO */
2020{
2021    _WmGetDynamicDefault (widget, WmTSC, 0, _pAppearanceData->background,
2022        value);
2023
2024} /* END OF FUNCTION _WmTopShadowColorDefault */
2025
2026
2027#ifdef _NO_PROTO
2028void
2029_WmTopShadowPixmapDefault (widget, offset, value)
2030        Widget   widget;
2031        int      offset;
2032        XrmValue *value;
2033
2034#else /* _NO_PROTO */
2035void
2036_WmTopShadowPixmapDefault (Widget widget, int offset, XrmValue *value)
2037#endif /* _NO_PROTO */
2038{
2039    static String string;
2040
2041
2042    if ((Monochrome (XtScreen (widget))) ||
2043        (_pAppearanceData->topShadowColor == _pAppearanceData->background))
2044    {
2045        /* Fix monochrome 3D appearance */
2046        string = _50_foreground;
2047        if (_pAppearanceData->backgroundPStr != NULL)
2048            if (!strcmp(_pAppearanceData->backgroundPStr, _25_foreground) ||
2049                !strcmp(_pAppearanceData->backgroundPStr, _50_foreground))
2050            {
2051                string = _foreground;
2052            }
2053    }
2054    else
2055    {
2056        string = NULL;
2057    }
2058
2059    value->addr = (char *)string;
2060    value->size = sizeof (String);
2061
2062} /* END OF FUNCTION _WmTopShadowPixmapDefault */
2063
2064
2065#ifdef _NO_PROTO
2066void
2067_WmABackgroundDefault (widget, offset, value)
2068        Widget   widget;
2069        int      offset;
2070        XrmValue *value;
2071
2072#else /* _NO_PROTO */
2073void
2074_WmABackgroundDefault (Widget widget, int offset, XrmValue *value)
2075#endif /* _NO_PROTO */
2076{
2077    _WmGetDynamicDefault (widget, WmBGC, _defaultActiveBackground, 0, value);
2078
2079} /* END OF FUNCTION _WmABackgroundDefault */
2080
2081
2082#ifdef _NO_PROTO
2083void
2084_WmAForegroundDefault (widget, offset, value)
2085        Widget   widget;
2086        int      offset;
2087        XrmValue *value;
2088
2089#else /* _NO_PROTO */
2090void
2091_WmAForegroundDefault (Widget widget, int offset, XrmValue *value)
2092#endif /* _NO_PROTO */
2093{
2094    _WmGetDynamicDefault (widget, WmFGC, 0, _pAppearanceData->activeBackground,
2095        value);
2096
2097} /* END OF FUNCTION _WmAForegroundDefault */
2098
2099#ifdef _NO_PROTO
2100void
2101_WmABackgroundPixmapDefault (widget, offset, value)
2102        Widget   widget;
2103        int      offset;
2104        XrmValue *value;
2105
2106#else /* _NO_PROTO */
2107void
2108_WmABackgroundPixmapDefault (Widget widget, int offset, XrmValue *value)
2109#endif /* _NO_PROTO */
2110{
2111    static String string;
2112
2113
2114    if ((Monochrome (XtScreen (widget))) ||
2115        (_pAppearanceData->activeTopShadowColor ==
2116                                        _pAppearanceData->activeBackground))
2117    {
2118        string = _50_foreground;
2119    }
2120    else
2121    {
2122        string = NULL;
2123    }
2124
2125    value->addr = (char *)string;
2126    value->size = sizeof (String);
2127
2128} /* END OF FUNCTION _WmABackgroundPixmapDefault */
2129
2130#ifdef _NO_PROTO
2131void
2132_WmABottomShadowColorDefault (widget, offset, value)
2133        Widget   widget;
2134        int      offset;
2135        XrmValue *value;
2136
2137#else /* _NO_PROTO */
2138void
2139_WmABottomShadowColorDefault (Widget widget, int offset, XrmValue *value)
2140#endif /* _NO_PROTO */
2141{
2142    _WmGetDynamicDefault (widget, WmBSC, 0, _pAppearanceData->activeBackground,
2143        value);
2144
2145} /* END OF FUNCTION _WmABottomShadowColorDefault */
2146
2147
2148#ifdef _NO_PROTO
2149void
2150_WmATopShadowColorDefault (widget, offset, value)
2151        Widget   widget;
2152        int      offset;
2153        XrmValue *value;
2154
2155#else /* _NO_PROTO */
2156void
2157_WmATopShadowColorDefault (Widget widget, int offset, XrmValue *value)
2158#endif /* _NO_PROTO */
2159{
2160    _WmGetDynamicDefault (widget, WmTSC, 0, _pAppearanceData->activeBackground,
2161        value);
2162
2163} /* END OF FUNCTION _WmATopShadowColorDefault */
2164
2165
2166#ifdef _NO_PROTO
2167void
2168_WmATopShadowPixmapDefault (widget, offset, value)
2169        Widget   widget;
2170        int      offset;
2171        XrmValue *value;
2172
2173#else /* _NO_PROTO */
2174void
2175_WmATopShadowPixmapDefault (Widget widget, int offset, XrmValue *value)
2176#endif /* _NO_PROTO */
2177{
2178    static String string;
2179
2180    if ((Monochrome (XtScreen (widget))) ||
2181        (_pAppearanceData->activeTopShadowColor ==
2182                                     _pAppearanceData->activeBackground))
2183    {
2184        /* Fix monochrome 3D appearance */
2185        string = _50_foreground;
2186        if (_pAppearanceData->activeBackgroundPStr != NULL)
2187            if (!strcmp
2188                    (_pAppearanceData->activeBackgroundPStr, _25_foreground) ||
2189                !strcmp
2190                    (_pAppearanceData->activeBackgroundPStr, _50_foreground))
2191            {
2192                string = _foreground;
2193            }
2194    }
2195    else
2196    {
2197        string = NULL;
2198    }
2199   
2200    value->addr = (char *)string;
2201    value->size = sizeof (String);
2202   
2203} /* END OF FUNCTION _WmATopShadowPixmapDefault */
2204
2205
2206
2207
2208/*************************************<->*************************************
2209 *
2210 *  _WmFocusAutoRaiseDefault (widget, offset, value)
2211 *
2212 *
2213 *  Description:
2214 *  -----------
2215 *  This function generates a default value for the focusAutoRaise resource.
2216 *
2217 *
2218 *  Inputs:
2219 *  ------
2220 *  widget = this is the parent widget for the wm subpart
2221 *
2222 *  offset = this is the resource offset
2223 *
2224 *  value = this is a pointer to a XrmValue in which to store the result
2225 *
2226 *
2227 *  Outputs:
2228 *  -------
2229 *  value = default resource value and size
2230 *
2231 *************************************<->***********************************/
2232
2233#ifdef _NO_PROTO
2234void
2235_WmFocusAutoRaiseDefault (widget, offset, value)
2236        Widget   widget;
2237        int      offset;
2238        XrmValue *value;
2239
2240#else /* _NO_PROTO */
2241void
2242_WmFocusAutoRaiseDefault (Widget widget, int offset, XrmValue *value)
2243#endif /* _NO_PROTO */
2244{
2245    static Boolean focusAutoRaise;
2246
2247    if (wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_EXPLICIT)
2248    {
2249        focusAutoRaise = True;
2250    }
2251    else
2252    {
2253        focusAutoRaise = False;
2254    }
2255
2256    value->addr = (char *)&focusAutoRaise;
2257    value->size = sizeof (Boolean);
2258
2259} /* END OF FUNCTION _WmFocusAutoRaiseDefault */
2260
2261
2262/*************************************<->*************************************
2263 *
2264 *  _WmMultiClickTimeDefault (widget, offset, value)
2265 *
2266 *
2267 *  Description:
2268 *  -----------
2269 *  This function generates a default value for the doubleClickTime resource.
2270 *  We dynamically default to the XtR4 multiClickTime value.
2271 *
2272 *  Inputs:
2273 *  ------
2274 *  widget = this is the parent widget for the wm subpart
2275 *
2276 *  offset = this is the resource offset
2277 *
2278 *  value = this is a pointer to a XrmValue in which to store the result
2279 *
2280 *  Outputs:
2281 *  -------
2282 *  value = default resource value and size
2283 *
2284 *************************************<->***********************************/
2285
2286#ifdef _NO_PROTO
2287void
2288_WmMultiClickTimeDefault (widget, offset, value)
2289        Widget   widget;
2290        int      offset;
2291        XrmValue *value;
2292
2293#else /* _NO_PROTO */
2294void
2295_WmMultiClickTimeDefault (Widget widget, int offset, XrmValue *value)
2296#endif /* _NO_PROTO */
2297{
2298    static int multiClickTime;
2299
2300    multiClickTime = XtGetMultiClickTime(XtDisplay(widget));
2301
2302    value->addr = (char *)&multiClickTime;
2303    value->size = sizeof (int);
2304
2305} /* END OF FUNCTION _WmMultiClickTimeDefault */
2306
2307
2308
2309
2310
2311/******************************<->*************************************
2312 *
2313 *  ProcessWmResources ()
2314 *
2315 *
2316 *  Description:
2317 *  -----------
2318 *  This function is used to retrieve and process window manager resources
2319 *  that are not client-specific.
2320 *
2321 *
2322 *  Inputs:
2323 *  ------
2324 *  wmGlobalResources = pointer to wm resource list
2325 *
2326 *
2327 *  Outputs:
2328 *  -------
2329 *  wmGD = (global data filled out with resource values)
2330 *
2331 *************************************<->***********************************/
2332
2333#ifdef _NO_PROTO
2334void
2335ProcessWmResources ()
2336
2337#else /* _NO_PROTO */
2338void
2339ProcessWmResources (void)
2340#endif /* _NO_PROTO */
2341{
2342
2343    /*
2344     * Process the mwm general appearance and behavior resources.  Retrieve
2345     * a limited set of resource values if the window manager is starting
2346     * up with the standard behavior.
2347     */
2348
2349    if (wmGD.useStandardBehavior)
2350    {
2351        XtGetApplicationResources (wmGD.topLevelW, (XtPointer) &wmGD,
2352            wmStdGlobalResources, XtNumber (wmStdGlobalResources), NULL, 0);
2353
2354        /*
2355         * Fill in the standard resource values.
2356         */
2357
2358        SetStdGlobalResourceValues ();
2359    }
2360    else
2361    {
2362        XtGetApplicationResources (wmGD.topLevelW, (XtPointer) &wmGD,
2363            wmGlobalResources, XtNumber (wmGlobalResources), NULL, 0);
2364    }
2365
2366    wmGD.ignoreLockMod = True;          /* !!! use a resource? !!! */
2367
2368} /* END OF FUNCTION ProcessWmResources */
2369
2370
2371
2372/******************************<->*************************************
2373 *
2374 *  ProcessGlobalScreenResources ()
2375 *
2376 *
2377 *  Description:
2378 *  -----------
2379 *  This function is used to retrieve window manager resources to
2380 *  determine the screens to manage.
2381 *
2382 *
2383 *  Inputs:
2384 *  ------
2385 *  wmGlobalScreenResources = pointer to wm resource list
2386 *
2387 *
2388 *  Outputs:
2389 *  -------
2390 *  wmGD = (global data filled out with resource values)
2391 *
2392 *************************************<->***********************************/
2393
2394#ifdef _NO_PROTO
2395void
2396ProcessGlobalScreenResources ()
2397
2398#else /* _NO_PROTO */
2399void
2400ProcessGlobalScreenResources (void)
2401#endif /* _NO_PROTO */
2402{
2403    XtGetApplicationResources (wmGD.topLevelW, (XtPointer)&wmGD,
2404        wmGlobalScreenResources,
2405        XtNumber (wmGlobalScreenResources), NULL, 0);
2406
2407    if (wmGD.multiScreen)
2408    {
2409        wmGD.numScreens = ScreenCount(DISPLAY);
2410    }
2411    else
2412    {
2413        wmGD.numScreens = 1;
2414    }
2415
2416    if (wmGD.screenList != NULL)
2417    {
2418        ProcessScreenListResource();
2419    }
2420}
2421
2422
2423
2424/*************************************<->*************************************
2425 *
2426 *  SetStdGlobalResourceValues ()
2427 *
2428 *
2429 *  Description:
2430 *  -----------
2431 *  This function sets resource data to standard values.  This setting
2432 *  is done in place of getting the values from the user settings in
2433 *  the resource database.
2434 *
2435 *
2436 *  Outputs:
2437 *  -------
2438 *  wmGD = (global data filled out with resource values)
2439 *
2440 *************************************<->***********************************/
2441
2442#ifdef _NO_PROTO
2443void
2444SetStdGlobalResourceValues ()
2445
2446#else /* _NO_PROTO */
2447void
2448SetStdGlobalResourceValues (void)
2449#endif /* _NO_PROTO */
2450{
2451    wmGD.autoKeyFocus = True;
2452    wmGD.clientAutoPlace = True;
2453    wmGD.colormapFocusPolicy = CMAP_FOCUS_KEYBOARD;
2454    wmGD.deiconifyKeyFocus = True;
2455    wmGD.doubleClickTime = 500;
2456    wmGD.freezeOnConfig = True;
2457    wmGD.iconAutoPlace = True;
2458    wmGD.iconClick = True;
2459    wmGD.interactivePlacement = False;
2460    wmGD.keyboardFocusPolicy = KEYBOARD_FOCUS_EXPLICIT;
2461    wmGD.lowerOnIconify = True;
2462    wmGD.passSelectButton = True;
2463    wmGD.startupKeyFocus = True;
2464    wmGD.systemButtonClick = True;
2465    wmGD.systemButtonClick2 = True;
2466
2467} /* END OF FUNCTION SetStdGlobalResourceValues */
2468
2469
2470
2471/*************************************<->*************************************
2472 *
2473 *  ProcessScreenListResource ()
2474 *
2475 *
2476 *  Description:
2477 *  -----------
2478 *  This processes the names in the screenList resource.
2479 *
2480 *
2481 *  Inputs:
2482 *  ------
2483 *  wmGlobalResources = pointer to wmGD.screenList
2484 *
2485 *
2486 *  Outputs:
2487 *  -------
2488 *  wmGD.screenNames
2489 *
2490 *************************************<->***********************************/
2491
2492#ifdef _NO_PROTO
2493void
2494ProcessScreenListResource ()
2495
2496#else /* _NO_PROTO */
2497void
2498ProcessScreenListResource (void)
2499#endif /* _NO_PROTO */
2500{
2501    unsigned char *lineP;
2502    unsigned char *string;
2503    int sNum = 0;
2504    int nameCount = 0;
2505
2506    lineP = (unsigned char *)wmGD.screenList;
2507
2508    /*
2509     *  Parse screenList.
2510     */
2511    while (((string = GetString(&lineP)) != NULL) &&
2512           (sNum < ScreenCount(DISPLAY)))
2513    {
2514        if (!(wmGD.screenNames[sNum] = (unsigned char *)
2515            WmRealloc ((char*)wmGD.screenNames[sNum], strlen((char*)string)+1)))
2516        {
2517            exit(WM_ERROR_EXIT_VALUE);
2518        }
2519        else
2520        {
2521            strcpy((char *)wmGD.screenNames[sNum], (char *)string);
2522            nameCount++;
2523            sNum++;
2524        }
2525    }
2526
2527    /*
2528     * If the number of listed screens (sNum) is < screen count, fill in the
2529     * remaining screen names with the name of the first screen specified,
2530     * if such exists.
2531     */
2532    if (nameCount > 0)
2533    {
2534        string = wmGD.screenNames[0];    /* name of the first screen */
2535        while (sNum < ScreenCount(DISPLAY))
2536        {
2537            if (!(wmGD.screenNames[sNum] = (unsigned char *)
2538                WmRealloc ((char*)wmGD.screenNames[sNum],
2539                                strlen((char *)string)+1)))
2540            {
2541                exit(WM_ERROR_EXIT_VALUE);
2542            }
2543            else
2544            {
2545                strcpy((char *)wmGD.screenNames[sNum], (char *)string);
2546                sNum++;
2547            }
2548        }
2549    }
2550
2551       
2552} /* END OF FUNCTION ProcessScreenListResource */
2553
2554
2555
2556
2557/******************************<->*************************************
2558 *
2559 *  ProcessAppearanceResources (pSD)
2560 *
2561 *
2562 *  Description:
2563 *  -----------
2564 *  Retrieve and process the general appearance resources for the mwm
2565 *  subparts: "client", "icon", and "feedback"
2566 *
2567 *
2568 *  Inputs:
2569 *  ------
2570 *  pSD   = pointer to screen data
2571 *
2572 *  Outputs:
2573 *  -------
2574 *  modifies parts of global data wmGD.
2575 *
2576 *  Comments:
2577 *  --------
2578 *  o Changeable GCs are created with XCreateGC. The base GCs used for
2579 *    text output will have clip_masks defined for them later.
2580 * 
2581 *
2582 *************************************<->***********************************/
2583
2584#ifdef _NO_PROTO
2585void
2586ProcessAppearanceResources (pSD)
2587
2588        WmScreenData *pSD;
2589
2590#else /* _NO_PROTO */
2591void
2592ProcessAppearanceResources (WmScreenData *pSD)
2593#endif /* _NO_PROTO */
2594{
2595    Widget clientW;             /* dummy widget for resource fetching */
2596    int i;
2597    Arg args[10];
2598
2599
2600    /*
2601     * Get the client subpart resources:
2602     */
2603
2604    /* save info in static globals for dynamic default processing */
2605    _defaultBackground = _defaultColor1;
2606    _defaultActiveBackground = _defaultColor2;
2607    _pAppearanceData = &(pSD->clientAppearance);
2608
2609    (void)XtGetSubresources (pSD->screenTopLevelW,
2610              (caddr_t) &(pSD->clientAppearance),
2611              WmNclient, WmCClient, wmAppearanceResources,
2612              XtNumber (wmAppearanceResources), NULL, 0);
2613
2614
2615    /*
2616     * Process the client resource values:
2617     */
2618
2619    /* make background, top and bottom shadow pixmaps */
2620
2621    MakeAppearanceResources (pSD, &(pSD->clientAppearance), True);
2622
2623
2624    /*
2625     * Get the client.title subpart resources:
2626     */
2627
2628        /* insert "client" widget in hierarchy */
2629
2630    i = 0;
2631    clientW = XtCreateWidget (WmNclient, xmRowColumnWidgetClass,
2632                        pSD->screenTopLevelW, (ArgList) args, i);
2633
2634
2635        /* fetch "client.title" subpart appearance resources */
2636
2637    _pAppearanceData = &(pSD->clientTitleAppearance);
2638
2639    (void)XtGetSubresources (clientW, (caddr_t) &(pSD->clientTitleAppearance),
2640              WmNtitle, WmCTitle, wmAppearanceResources,
2641              XtNumber (wmAppearanceResources), NULL, 0);
2642
2643
2644    /*
2645     * Process the client.title resource values:
2646     */
2647
2648
2649    /*
2650     * check if client title appearance is different from the rest of frame.
2651     */
2652    if (SimilarAppearanceData (&(pSD->clientAppearance),
2653                               &(pSD->clientTitleAppearance)))
2654    {
2655        /* title bar doesn't need special graphic processing */
2656        pSD->decoupleTitleAppearance = False;
2657    }
2658    else
2659    {
2660        /* make background, top and bottom shadow pixmaps */
2661        MakeAppearanceResources (pSD, &(pSD->clientTitleAppearance), True);
2662        pSD->decoupleTitleAppearance = True;
2663    }
2664
2665    XtDestroyWidget (clientW);  /* all done with dummy widget */
2666
2667
2668    /*
2669     * Get the icon subpart resources:
2670     */
2671
2672    _pAppearanceData = &(pSD->iconAppearance);
2673
2674    (void)XtGetSubresources (pSD->screenTopLevelW,
2675              (caddr_t) &(pSD->iconAppearance),
2676              WmNicon, WmCIcon, wmAppearanceResources,
2677              XtNumber (wmAppearanceResources), NULL, 0);
2678
2679
2680    /*
2681     * Process the icon resource values:
2682     */
2683
2684    /* make background, top and bottom shadow pixmaps */
2685
2686    MakeAppearanceResources (pSD, &(pSD->iconAppearance), True);
2687
2688
2689    /*
2690     * Get the feedback subpart resources:
2691     * !!! only get "inactive" resources !!!
2692     */
2693
2694    _defaultBackground = _defaultColor2;
2695    _defaultActiveBackground = _defaultColor2;
2696    _pAppearanceData = &(pSD->feedbackAppearance);
2697
2698    (void)XtGetSubresources (pSD->screenTopLevelW,
2699              (caddr_t) &(pSD->feedbackAppearance),
2700              WmNfeedback, WmCFeedback, wmAppearanceResources,
2701              XtNumber (wmAppearanceResources), NULL, 0);
2702
2703    /*
2704     * Process the feedback resource values:
2705     */
2706
2707    /* make background, top and bottom shadow pixmaps */
2708
2709    MakeAppearanceResources (pSD, &(pSD->feedbackAppearance), False);
2710
2711
2712} /* END OF FUNCTION ProcessAppearanceResources */
2713
2714#ifndef NO_MULTIBYTE
2715#ifdef _NO_PROTO
2716static unsigned int
2717WmFontListFontHeight(fontlist, findex)
2718     XmFontList fontlist;
2719     short   findex;
2720#else
2721static unsigned int
2722WmFontListFontHeight(XmFontList fontlist, short findex)
2723#endif /* _NO_PROTO */
2724{
2725
2726#define FontSetAscent(xfontsetextents) \
2727    ( -((xfontsetextents)->max_logical_extent.y))
2728#define FontSetDescent(xfontsetextents) \
2729      (((xfontsetextents)->max_logical_extent.height) \
2730       + ((xfontsetextents)->max_logical_extent.y))
2731
2732    XmFontListEntry     fontEntry;
2733    XmFontContext       fontContext;
2734    XmFontType          fontType;
2735    XtPointer           fontPointer;
2736    Boolean             contextIsValid;
2737    int                 i;
2738
2739    contextIsValid = XmFontListInitFontContext(&fontContext, fontlist);
2740
2741    for (i=0; i<=findex; i++)
2742    {
2743        fontEntry = XmFontListNextEntry(fontContext);
2744    }
2745
2746    fontPointer = XmFontListEntryGetFont(fontEntry, &fontType);
2747
2748    if (contextIsValid)
2749      XmFontListFreeFontContext(fontContext);
2750
2751   
2752    if (fontType == XmFONT_IS_FONTSET)
2753    {
2754        XFontSetExtents *extents;
2755
2756        extents = XExtentsOfFontSet((XFontSet)fontPointer);
2757
2758        if (extents != NULL)
2759        {
2760            return(FontSetAscent(extents) + FontSetDescent(extents));
2761        }
2762        else return(0);
2763    }
2764    else if (fontType == XmFONT_IS_FONT)
2765    {
2766        return(((XFontStruct *)fontPointer)->ascent +
2767               ((XFontStruct *)fontPointer)->descent);
2768    }
2769    else return(0);
2770}
2771#endif
2772
2773
2774/*************************************<->*************************************
2775 *
2776 *  MakeAppearanceResources (pSD, pAData, makeActiveResources)
2777 *
2778 *
2779 *  Description:
2780 *  -----------
2781 *  This function makes top, bottom and background pixmaps for a window
2782 *  manager component.  Inactive and active (if specified) GC's are
2783 *  also made.
2784 *
2785 *
2786 *  Inputs:
2787 *  ------
2788 *  pSD = pointer to screen data
2789 *
2790 *  pAData = pointer to appearance data structure containing resource info
2791 *
2792 *  makeActiveResources = if True then make active resources
2793 *
2794 *  Outputs:
2795 *  -------
2796 *  *pAData = pixmap and GC fields filled out
2797 *
2798 *************************************<->***********************************/
2799
2800#ifdef _NO_PROTO
2801void
2802MakeAppearanceResources (pSD, pAData, makeActiveResources)
2803        WmScreenData *pSD;
2804        AppearanceData *pAData;
2805        Boolean makeActiveResources;
2806
2807#else /* _NO_PROTO */
2808void
2809MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean makeActiveResources)
2810#endif /* _NO_PROTO */
2811{
2812    short findex;
2813    Pixel foreground;
2814
2815
2816    /*
2817     * Extract a font from the font list.
2818     */
2819
2820    _XmFontListSearch (pAData->fontList, XmFONTLIST_DEFAULT_TAG, &findex,
2821        &(pAData->font));
2822
2823    if (!pAData->font)
2824    {
2825        char msg[130];
2826
2827        sprintf(msg, "failed to load font: %.100s", (char*) pAData->fontList);
2828        Warning(msg);
2829        exit(WM_ERROR_EXIT_VALUE);
2830    }
2831
2832#ifndef NO_MULTIBYTE
2833    /*
2834     *  Calculate title bar's height and store it in pAData.
2835     */
2836    if (findex < 0 )
2837    {
2838        char msg[130];
2839        sprintf(msg, "cannot find an appropriate font: %.100s",
2840                (char*) pAData->fontList);
2841        Warning(msg);
2842        pAData->font = XLoadQueryFont(DISPLAY,"fixed");
2843        if (pAData->font)
2844                pAData->titleHeight = (pAData->font)->ascent
2845                                        + (pAData->font)->descent
2846                                        + WM_TITLE_BAR_PADDING;
2847        else pAData->titleHeight = 16;
2848    }
2849    else
2850    {
2851        pAData->titleHeight = WmFontListFontHeight(pAData->fontList, findex)
2852                                        + WM_TITLE_BAR_PADDING;
2853    }
2854#endif
2855
2856
2857    /*
2858     * Make standard (inactive) appearance resources.
2859     */
2860
2861    /* background pixmap */
2862
2863    if (pAData->backgroundPStr)
2864    {
2865        pAData->backgroundPixmap = XmGetPixmap (
2866                                       ScreenOfDisplay (DISPLAY,
2867                                           pSD->screen),
2868                                       pAData->backgroundPStr,
2869                                       pAData->foreground,
2870                                       pAData->background);
2871
2872        if (pAData->backgroundPixmap == XmUNSPECIFIED_PIXMAP)
2873        {
2874            pAData->backgroundPixmap = (Pixmap)NULL;
2875        }
2876    }
2877    else
2878    {
2879        pAData->backgroundPixmap = (Pixmap)NULL;
2880    }
2881
2882    /* top shadow pixmap */
2883
2884    if (pAData->topShadowPStr)
2885    {
2886        /*
2887         * Make sure top shadow color is not the same as background
2888         * otherwise the wrong pixmap will be generated.
2889         */
2890        if (pAData->topShadowColor != pAData->background)
2891            foreground = pAData->topShadowColor;
2892        else
2893            foreground = pAData->foreground;
2894        pAData->topShadowPixmap = XmGetPixmap (
2895                                       ScreenOfDisplay (DISPLAY,
2896                                           pSD->screen),
2897                                       pAData->topShadowPStr,
2898                                       foreground,
2899                                       pAData->background);
2900
2901        if (pAData->topShadowPixmap == XmUNSPECIFIED_PIXMAP)
2902        {
2903            pAData->topShadowPixmap = (Pixmap)NULL;
2904        }
2905    }
2906    else
2907    {
2908        pAData->topShadowPixmap = (Pixmap)NULL;
2909    }
2910
2911
2912    /* bottom shadow pixmap */
2913
2914    if (pAData->bottomShadowPStr)
2915    {
2916        /*
2917         * Make sure bottom shadow color is not the same as background
2918         * otherwise the wrong pixmap will be generated.
2919         */
2920        if (pAData->bottomShadowColor != pAData->background)
2921            foreground = pAData->bottomShadowColor;
2922        else
2923            foreground = pAData->foreground;
2924        pAData->bottomShadowPixmap = XmGetPixmap (
2925                                       ScreenOfDisplay (DISPLAY,
2926                                           pSD->screen),
2927                                       pAData->bottomShadowPStr,
2928                                       foreground,
2929                                       pAData->background);
2930
2931        if (pAData->bottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
2932        {
2933            pAData->bottomShadowPixmap = (Pixmap)NULL;
2934        }
2935    }
2936    else
2937    {
2938        pAData->bottomShadowPixmap = (Pixmap)NULL;
2939    }
2940
2941    /* inactive appearance GC */
2942
2943    GetAppearanceGCs (pSD,
2944                      pAData->foreground,
2945                      pAData->background,
2946                      pAData->font,
2947                      pAData->backgroundPixmap,
2948                      pAData->topShadowColor,
2949                      pAData->topShadowPixmap,
2950                      pAData->bottomShadowColor,
2951                      pAData->bottomShadowPixmap,
2952                      &(pAData->inactiveGC),
2953                      &(pAData->inactiveTopShadowGC),
2954                      &(pAData->inactiveBottomShadowGC));
2955
2956
2957
2958    /*
2959     * Make active apppearance resources if specified.
2960     */
2961
2962    if (!makeActiveResources)
2963    {
2964        return;
2965    }
2966
2967    /* active background pixmap */
2968
2969    if (pAData->activeBackgroundPStr)
2970    {
2971        pAData->activeBackgroundPixmap = XmGetPixmap (
2972                                             ScreenOfDisplay (DISPLAY,
2973                                                 pSD->screen),
2974                                             pAData->activeBackgroundPStr,
2975                                             pAData->activeForeground,
2976                                             pAData->activeBackground);
2977
2978        if (pAData->activeBackgroundPixmap == XmUNSPECIFIED_PIXMAP)
2979        {
2980            pAData->activeBackgroundPixmap = (Pixmap)NULL;
2981        }
2982    }
2983    else
2984    {
2985        pAData->activeBackgroundPixmap = (Pixmap)NULL;
2986    }
2987
2988    /* active top shadow pixmap */
2989
2990    if (pAData->activeTopShadowPStr)
2991    {
2992        pAData->activeTopShadowPixmap = XmGetPixmap (
2993                                            ScreenOfDisplay (DISPLAY,
2994                                                pSD->screen),
2995                                            pAData->activeTopShadowPStr,
2996                                            pAData->activeTopShadowColor,
2997                                            pAData->activeBackground);
2998
2999        if (pAData->activeTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
3000        {
3001            pAData->activeTopShadowPixmap = (Pixmap)NULL;
3002        }
3003    }
3004    else
3005    {
3006        pAData->activeTopShadowPixmap = (Pixmap)NULL;
3007    }
3008
3009
3010    /* active bottom shadow pixmap */
3011
3012    if (pAData->activeBottomShadowPStr)
3013    {
3014        pAData->activeBottomShadowPixmap = XmGetPixmap (
3015                                               ScreenOfDisplay (DISPLAY,
3016                                                   pSD->screen),
3017                                               pAData->activeBottomShadowPStr,
3018                                               pAData->activeBottomShadowColor,
3019                                               pAData->activeBackground);
3020
3021        if (pAData->activeBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
3022        {
3023            pAData->activeBottomShadowPixmap = (Pixmap)NULL;
3024        }
3025    }
3026    else
3027    {
3028        pAData->activeBottomShadowPixmap = (Pixmap)NULL;
3029    }
3030
3031    /* inactive appearance GC */
3032
3033    GetAppearanceGCs (pSD,
3034                      pAData->activeForeground,
3035                      pAData->activeBackground,
3036                      pAData->font,
3037                      pAData->activeBackgroundPixmap,
3038                      pAData->activeTopShadowColor,
3039                      pAData->activeTopShadowPixmap,
3040                      pAData->activeBottomShadowColor,
3041                      pAData->activeBottomShadowPixmap,
3042                      &(pAData->activeGC),
3043                      &(pAData->activeTopShadowGC),
3044                      &(pAData->activeBottomShadowGC));
3045
3046
3047} /* END OF FUNCTION MakeAppearanceResources */
3048
3049
3050
3051/*************************************<->*************************************
3052 *
3053 *  GetAppearanceGCs (pSD, fg, bg, font, bg_pixmap, ts_color,
3054 *                    ts_pixmap, bs_color, bs_pixmap, pGC, ptsGC, pbsGC)
3055 *
3056 *
3057 *  Description:
3058 *  -----------
3059 *  Creates the appearance GCs for any of the icon, client, or feedback
3060 *  resources.
3061 *
3062 *
3063 *  Inputs:
3064 *  ------
3065 *  pSD         - pointer to screen data
3066 *  fg          - base foreground color
3067 *  bg          - base background color
3068 *  font        - font
3069 *  bg_pixmap   - background pixmap
3070 *  ts_color    - top shadow color
3071 *  ts_pixmap   - top shadow pixmap
3072 *  bs_color    - bottom shadow color
3073 *  bs_pixmap   - bottom shadow pixmap
3074 *  pGC         - pointer to location to receive base GC
3075 *  ptsGC       - pointer to location to receive top shadow GC
3076 *  pbsGC       - pointer to location to receive bottom shadow GC
3077 *
3078 *  Outputs:
3079 *  -------
3080 *  *pGC        - base GC
3081 *  *ptsGC      - top shadow GC
3082 *  *pbsGC      - bottom shadow GC
3083 * 
3084 *
3085 *  Comments:
3086 *  --------
3087 *
3088 *
3089 *************************************<->***********************************/
3090
3091#ifdef _NO_PROTO
3092void
3093GetAppearanceGCs (pSD, fg, bg, font, bg_pixmap, ts_color, ts_pixmap, bs_color, bs_pixmap, pGC, ptsGC, pbsGC)
3094        WmScreenData *pSD;
3095        Pixel fg, bg, ts_color, bs_color;
3096        Pixmap bg_pixmap, ts_pixmap, bs_pixmap;
3097        XFontStruct *font;
3098        GC *pGC, *ptsGC, *pbsGC;
3099
3100#else /* _NO_PROTO */
3101void
3102GetAppearanceGCs (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)
3103#endif /* _NO_PROTO */
3104{
3105    XGCValues gcv;
3106    XtGCMask  mask;
3107
3108
3109    /*
3110     * Get base GC
3111     */
3112
3113    mask = GCForeground | GCBackground | GCFont;
3114    gcv.foreground = fg;
3115    gcv.background = bg;
3116    gcv.font = font->fid;
3117
3118    if (bg_pixmap)
3119    {
3120        mask |= GCTile;
3121        gcv.tile = bg_pixmap;
3122    }
3123
3124    *pGC = XCreateGC (DISPLAY, pSD->rootWindow, mask, &gcv);
3125
3126    /*
3127     * !!! Need GC error detection !!!
3128     */
3129
3130    *ptsGC = GetHighlightGC (pSD, ts_color, bg, ts_pixmap);
3131
3132    *pbsGC = GetHighlightGC (pSD, bs_color, bg, bs_pixmap);
3133
3134} /* END OF FUNCTION GetAppearanceGCs */
3135
3136
3137
3138
3139/*************************************<->*************************************
3140 *
3141 *  ProcessScreenResources (pSD, screenName)
3142 *
3143 *
3144 *  Description:
3145 *  -----------
3146 *  This function retrieves resources that are screen specific.  If the
3147 *  window manager is providing standard behavior then retrieve the limited
3148 *  set of resources that don't affect standard behavior and set the
3149 *  values of the other resources to the standard values.
3150 *
3151 *
3152 *  Inputs:
3153 *  ------
3154 *  pSD = pointer to screen data
3155 *  screenName = name of screen
3156 *
3157 *
3158 *  Outputs:
3159 *  -------
3160 *  pSD = resource data for screen is set
3161 *
3162 *
3163 *  Comments:
3164 *  --------
3165 *  o Gets subresources based on workspace name
3166 *
3167 *************************************<->***********************************/
3168
3169#ifdef _NO_PROTO
3170void
3171ProcessScreenResources (pSD, screenName)
3172        WmScreenData *pSD;
3173        unsigned char *screenName;
3174
3175#else /* _NO_PROTO */
3176void
3177ProcessScreenResources (WmScreenData *pSD, unsigned char *screenName)
3178#endif /* _NO_PROTO */
3179{
3180    /*
3181     * Retrieve screen specific resources.
3182     */
3183
3184    if (wmGD.useStandardBehavior)
3185    {
3186        XtGetSubresources (wmGD.topLevelW, (caddr_t) pSD,
3187            (String) screenName, (String)screenName, wmStdScreenResources,
3188            XtNumber (wmStdScreenResources), NULL, 0);
3189
3190        /*
3191         * Fill in the standard resource values.
3192         */
3193
3194        SetStdScreenResourceValues (pSD);
3195    }
3196    else
3197    {
3198        XtGetSubresources (wmGD.topLevelW, (caddr_t) pSD,
3199            (String)screenName, (String)screenName, wmScreenResources,
3200            XtNumber (wmScreenResources), NULL, 0);
3201
3202#ifndef MOTIF_ONE_DOT_ONE
3203        pSD->moveOpaque = _XmGetMoveOpaqueByScreen(ScreenOfDisplay(DISPLAY,pSD->screen));
3204#endif
3205    }
3206
3207    /*
3208     * Do some additional processing on the window manager resource values.
3209     */
3210
3211
3212    if (pSD->iconImageMinimum.width < ICON_IMAGE_MIN_WIDTH)
3213    {
3214        pSD->iconImageMinimum.width = ICON_IMAGE_MIN_WIDTH;
3215    }
3216    else if (pSD->iconImageMinimum.width > ICON_IMAGE_MAX_WIDTH)
3217    {
3218        pSD->iconImageMinimum.width = ICON_IMAGE_MAX_WIDTH;
3219    }
3220
3221    if (pSD->iconImageMinimum.height < ICON_IMAGE_MIN_HEIGHT)
3222    {
3223        pSD->iconImageMinimum.height = ICON_IMAGE_MIN_HEIGHT;
3224    }
3225    else if (pSD->iconImageMinimum.height > ICON_IMAGE_MAX_HEIGHT)
3226    {
3227        pSD->iconImageMinimum.height = ICON_IMAGE_MAX_HEIGHT;
3228    }
3229
3230    if (pSD->iconImageMaximum.width < pSD->iconImageMinimum.width)
3231    {
3232        pSD->iconImageMaximum.width = pSD->iconImageMinimum.width;
3233    }
3234    else if (pSD->iconImageMaximum.width > ICON_IMAGE_MAX_WIDTH)
3235    {
3236        pSD->iconImageMaximum.width = ICON_IMAGE_MAX_WIDTH;
3237    }
3238
3239    if (pSD->iconImageMaximum.height < pSD->iconImageMinimum.height)
3240    {
3241        pSD->iconImageMaximum.height = pSD->iconImageMinimum.height;
3242    }
3243    else if (pSD->iconImageMaximum.height > ICON_IMAGE_MAX_HEIGHT)
3244    {
3245        pSD->iconImageMaximum.height = ICON_IMAGE_MAX_HEIGHT;
3246    }
3247
3248    if (pSD->iconPlacementMargin > MAXIMUM_ICON_MARGIN)
3249    {
3250        pSD->iconPlacementMargin = MAXIMUM_ICON_MARGIN;
3251    }
3252
3253    if (pSD->maximumMaximumSize.width <= 0)
3254    {
3255        pSD->maximumMaximumSize.width =
3256                        2 * DisplayWidth (DISPLAY, pSD->screen);
3257    }
3258
3259    if (pSD->maximumMaximumSize.height <= 0)
3260    {
3261        pSD->maximumMaximumSize.height =
3262                        2 * DisplayHeight (DISPLAY, pSD->screen);
3263    }
3264
3265    /*
3266     * Set the icon appearance default based on whether or not the icon box
3267     * is being used.
3268     */
3269
3270    if (pSD->iconDecoration & USE_ICON_DEFAULT_APPEARANCE)
3271    {
3272        if (pSD->useIconBox)
3273        {
3274            pSD->iconDecoration = ICON_APPEARANCE_ICONBOX;
3275        }
3276        else
3277        {
3278            pSD->iconDecoration = ICON_APPEARANCE_STANDALONE;
3279        }
3280    }
3281
3282    /*
3283     * If resizeBorderWidth or frameBorderWidth is unset then initialize
3284     * to dynamic defaults.
3285     */
3286
3287    if ((pSD->resizeBorderWidth == (Dimension)BIGSIZE) ||
3288        (pSD->frameBorderWidth == (Dimension)BIGSIZE))
3289    {
3290        double xres, yres, avg_res;
3291
3292        xres = (((double) DisplayWidth(DISPLAY, pSD->screen)) /
3293                ((double) DisplayWidthMM(DISPLAY, pSD->screen)));
3294        yres = (((double) DisplayHeight(DISPLAY, pSD->screen)) /
3295                ((double) DisplayHeightMM(DISPLAY, pSD->screen)));
3296
3297        avg_res = (xres + yres) / 2.0;
3298
3299        /* Multiply times width in mm (avg. 7-8 pixels) */
3300        if (pSD->resizeBorderWidth == (Dimension)BIGSIZE)
3301        {
3302            pSD->resizeBorderWidth = (int) (avg_res * 2.2);
3303
3304            /* limit size because big borders look ugly */
3305            if (pSD->resizeBorderWidth > 7) pSD->resizeBorderWidth = 7;
3306        }
3307
3308        /* Multiply times width in mm (avg. 5-6 pixels) */
3309        if (pSD->frameBorderWidth == (Dimension)BIGSIZE)
3310        {
3311            pSD->frameBorderWidth = (int) (avg_res * 1.7);
3312
3313            /* limit size because big borders look ugly */
3314            if (pSD->frameBorderWidth > 5) pSD->frameBorderWidth = 5;
3315        }
3316    }
3317
3318
3319    pSD->externalBevel = FRAME_EXTERNAL_SHADOW_WIDTH;
3320    pSD->joinBevel = FRAME_INTERNAL_SHADOW_WIDTH;
3321    if (pSD->frameBorderWidth <
3322           (pSD->externalBevel + MIN_INTERNAL_BEVEL))
3323    {
3324        pSD->frameBorderWidth =
3325            pSD->externalBevel + MIN_INTERNAL_BEVEL;
3326    }
3327    else if (pSD->frameBorderWidth > MAXIMUM_FRAME_BORDER_WIDTH)
3328    {
3329        pSD->frameBorderWidth = MAXIMUM_FRAME_BORDER_WIDTH;
3330    }
3331
3332    if (pSD->resizeBorderWidth <
3333           (pSD->externalBevel + MIN_INTERNAL_BEVEL))
3334    {
3335        pSD->resizeBorderWidth =
3336            (pSD->externalBevel + MIN_INTERNAL_BEVEL);
3337    }
3338    else if (pSD->resizeBorderWidth > MAXIMUM_FRAME_BORDER_WIDTH)
3339    {
3340        pSD->resizeBorderWidth = MAXIMUM_FRAME_BORDER_WIDTH;
3341    }
3342
3343    /*
3344     * Process the component appearance resources for client,
3345     * icon and feedback parts of mwm.
3346     */
3347
3348     ProcessAppearanceResources (pSD);
3349
3350    /*
3351     * Save the default icon pixmap in global data. We'll use it only
3352     * as a last resort.
3353     */
3354
3355    pSD->builtinIconPixmap =
3356        XCreateBitmapFromData (DISPLAY, pSD->rootWindow, (char *)iImage_bits,
3357                                       iImage_width, iImage_height);
3358
3359} /* END OF FUNCTION ProcessScreenResources */
3360
3361
3362
3363/******************************<->*************************************
3364 *
3365 *  ProcessWorkspaceResources (pWS)
3366 *
3367 *
3368 *  Description:
3369 *  -----------
3370 *  This function retrieves resources that are workspace specific.  If the
3371 *  window manager is providing standard behavior then retrieve the limited
3372 *  set of resources that don't affect standard behavior and set the
3373 *  values of the other resources to the standard values.
3374 *
3375 *
3376 *  Inputs:
3377 *  ------
3378 *  pWS = pointer to workspace data
3379 *
3380 *
3381 *  Outputs:
3382 *  -------
3383 *  pWS = resource data for workspace is set
3384 *
3385 *
3386 *  Comments:
3387 *  --------
3388 *  o Gets subresources based on workspace name
3389 *
3390 ******************************<->***********************************/
3391
3392#ifdef _NO_PROTO
3393void
3394ProcessWorkspaceResources (pWS)
3395        WmWorkspaceData *pWS;
3396
3397#else /* _NO_PROTO */
3398void
3399ProcessWorkspaceResources (WmWorkspaceData *pWS)
3400#endif /* _NO_PROTO */
3401{
3402
3403    /*
3404     * Retrieve workspace specific resources.
3405     */
3406
3407    if (wmGD.useStandardBehavior)
3408    {
3409        XtGetSubresources (pWS->pSD->screenTopLevelW, (caddr_t) pWS,
3410            pWS->name, pWS->name, wmStdWorkspaceResources,
3411            XtNumber (wmStdWorkspaceResources), NULL, 0);
3412
3413        /*
3414         * Fill in the standard resource values.
3415         *
3416         * (no code for this right now)
3417         */
3418
3419    }
3420    else
3421    {
3422        XtGetSubresources (pWS->pSD->screenTopLevelW, (caddr_t) pWS,
3423            pWS->name, pWS->name, wmWorkspaceResources,
3424            XtNumber (wmWorkspaceResources), NULL, 0);
3425    }
3426
3427
3428} /* END OF FUNCTION ProcessWorkspaceResources */
3429
3430
3431
3432/*************************************<->*************************************
3433 *
3434 *  ProcessClientResources (pCD)
3435 *
3436 *
3437 *  Description:
3438 *  -----------
3439 *  This function retrieves resources that are client specific.  If the
3440 *  window manager is providing standard behavior then retrieve the limited
3441 *  set of resources that don't affect standard behavior and set the
3442 *  values of the other resources to the standard values.
3443 *
3444 *
3445 *  Inputs:
3446 *  ------
3447 *  pCD = pointer to client data
3448 *
3449 *
3450 *  Outputs:
3451 *  -------
3452 *  pCD = resource data for client is set
3453 *
3454 *
3455 *  Comments:
3456 *  --------
3457 *  o Gets subresources based on client name and class.
3458 *  o Creates GC for the client Matte, if there is one.
3459 *
3460 *************************************<->***********************************/
3461
3462#ifdef _NO_PROTO
3463void
3464ProcessClientResources (pCD)
3465        ClientData *pCD;
3466
3467#else /* _NO_PROTO */
3468void
3469ProcessClientResources (ClientData *pCD)
3470#endif /* _NO_PROTO */
3471{
3472    String clientName;
3473    String clientClass;
3474    WmScreenData *pSD = pCD->pSD;
3475
3476    /*
3477     * Retrieve basic client specific resources.
3478     */
3479
3480    _pCD = pCD; /* save in static global for dynamic default processing */
3481    clientName = (pCD->clientName) ? pCD->clientName : WmNdefaults;
3482    clientClass = (pCD->clientClass) ? pCD->clientClass : WmNdefaults;
3483
3484    if (wmGD.useStandardBehavior)
3485    {
3486        XtGetSubresources (pSD->screenTopLevelW, (caddr_t) pCD, clientName,
3487            clientClass, wmStdClientResources, XtNumber (wmStdClientResources),
3488            NULL, 0);
3489
3490        /*
3491         * Fill in the standard resource values.
3492         */
3493
3494        SetStdClientResourceValues (pCD);
3495    }
3496    else
3497    {
3498        XtGetSubresources (pSD->screenTopLevelW, (caddr_t) pCD, clientName,
3499            clientClass, wmClientResources, XtNumber (wmClientResources), NULL,
3500            0);
3501    }
3502
3503    /*
3504     * If (window menu spec is not found) then use the builtin
3505     * system menu.
3506     */
3507
3508    if ((pCD->systemMenu == defaultSystemMenuName) &&
3509        (pSD->defaultSystemMenuUseBuiltin == TRUE))
3510    {
3511        pCD->systemMenu = builtinSystemMenuName;
3512    }
3513
3514    /*
3515     * If the client decorations or client functions have been defaulted
3516     * fix up the fields in the ProcessMwmHints function.
3517     */
3518
3519
3520    /* make top and bottom shadow pixmaps */
3521
3522    if (pCD->iconImageBottomShadowPStr)
3523    {
3524        if ((pCD->iconImageBottomShadowPStr ==
3525                    pSD->iconAppearance.bottomShadowPStr) &&
3526            (pCD->iconImageBottomShadowColor ==
3527                    pSD->iconAppearance.bottomShadowColor) &&
3528            (pCD->iconImageBackground ==
3529                    pSD->iconAppearance.background))
3530        {
3531            pCD->iconImageBottomShadowPixmap =
3532                    pSD->iconAppearance.bottomShadowPixmap;
3533        }
3534        else
3535        {
3536            pCD->iconImageBottomShadowPixmap =
3537                            XmGetPixmap ( ScreenOfDisplay (DISPLAY,
3538                                              pSD->screen),
3539                                          pCD->iconImageBottomShadowPStr,
3540                                          pCD->iconImageBottomShadowColor,
3541                                          pCD->iconImageBackground);
3542
3543            if (pCD->iconImageBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
3544            {
3545                pCD->iconImageBottomShadowPixmap = (Pixmap)NULL;
3546            }
3547        }
3548    }
3549    else
3550    {
3551        pCD->iconImageBottomShadowPixmap = (Pixmap)NULL;
3552    }
3553
3554    if (pCD->iconImageTopShadowPStr)
3555    {
3556        if ((pCD->iconImageTopShadowPStr ==
3557                                pSD->iconAppearance.topShadowPStr) &&
3558            (pCD->iconImageTopShadowColor ==
3559                                pSD->iconAppearance.topShadowColor) &&
3560            (pCD->iconImageBackground == pSD->iconAppearance.background))
3561        {
3562            pCD->iconImageTopShadowPixmap =
3563                                        pSD->iconAppearance.topShadowPixmap;
3564        }
3565        else
3566        {
3567            pCD->iconImageTopShadowPixmap =
3568                            XmGetPixmap ( ScreenOfDisplay (DISPLAY,
3569                                              pSD->screen),
3570                                          pCD->iconImageTopShadowPStr,
3571                                          pCD->iconImageTopShadowColor,
3572                                          pCD->iconImageBackground);
3573
3574            if (pCD->iconImageTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
3575            {
3576                pCD->iconImageTopShadowPixmap = (Pixmap)NULL;
3577            }
3578        }
3579    }
3580    else
3581    {
3582        pCD->iconImageTopShadowPixmap = (Pixmap)NULL;
3583    }
3584
3585    if ((pCD->internalBevel < MIN_INTERNAL_BEVEL)  ||
3586        (pCD->internalBevel > MAX_INTERNAL_BEVEL))
3587    {
3588        pCD->internalBevel = MAX_INTERNAL_BEVEL;
3589    }
3590
3591
3592    /*
3593     * Retrieve matte resources and make internal matte resources.
3594     */
3595
3596    if (pCD->matteWidth > 0)
3597    {
3598        XtGetSubresources (pSD->screenTopLevelW, (caddr_t) pCD, clientName,
3599            clientClass, wmClientResourcesM, XtNumber (wmClientResourcesM),
3600            NULL, 0);
3601
3602        /* make top and bottom shadow pixmaps */
3603
3604        if (pCD->matteBottomShadowPStr)
3605        {
3606            if ((pCD->matteBottomShadowPStr ==
3607                                    pSD->clientAppearance.bottomShadowPStr) &&
3608                (pCD->matteBottomShadowColor ==
3609                                    pSD->clientAppearance.bottomShadowColor) &&
3610                (pCD->matteBackground == pSD->clientAppearance.background))
3611            {
3612                pCD->matteBottomShadowPixmap =
3613                                pSD->clientAppearance.bottomShadowPixmap;
3614            }
3615            else
3616            {
3617                pCD->matteBottomShadowPixmap =
3618                                XmGetPixmap (ScreenOfDisplay (DISPLAY,
3619                                                 pSD->screen),
3620                                             pCD->matteBottomShadowPStr,
3621                                             pCD->matteBottomShadowColor,
3622                                             pCD->matteBackground);
3623
3624                if (pCD->matteBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
3625                {
3626                    pCD->matteBottomShadowPixmap = (Pixmap)NULL;
3627                }
3628            }
3629        }
3630        else
3631        {
3632            pCD->matteBottomShadowPixmap = (Pixmap)NULL;
3633        }
3634
3635        if (pCD->matteTopShadowPStr)
3636        {
3637            if ((pCD->matteTopShadowPStr ==
3638                                    pSD->clientAppearance.topShadowPStr) &&
3639                (pCD->matteTopShadowColor ==
3640                                    pSD->clientAppearance.topShadowColor) &&
3641                (pCD->matteBackground == pSD->clientAppearance.background))
3642            {
3643                pCD->matteTopShadowPixmap =
3644                                        pSD->clientAppearance.topShadowPixmap;
3645            }
3646            else
3647            {
3648                pCD->matteTopShadowPixmap =
3649                                XmGetPixmap (ScreenOfDisplay (DISPLAY,
3650                                                 pSD->screen),
3651                                             pCD->matteTopShadowPStr,
3652                                             pCD->matteTopShadowColor,
3653                                             pCD->matteBackground);
3654
3655                if (pCD->matteTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
3656                {
3657                    pCD->matteTopShadowPixmap = (Pixmap)NULL;
3658                }
3659            }
3660        }
3661        else
3662        {
3663            pCD->matteTopShadowPixmap = (Pixmap)NULL;
3664        }
3665
3666
3667        /* make top and bottom shadow GC's */
3668
3669        pCD->clientMatteTopShadowGC = GetHighlightGC (pCD->pSD,
3670                                          pCD->matteTopShadowColor,
3671                                          pCD->matteBackground,
3672                                          pCD->matteTopShadowPixmap);
3673
3674        pCD->clientMatteBottomShadowGC = GetHighlightGC (pCD->pSD,
3675                                          pCD->matteBottomShadowColor,
3676                                          pCD->matteBackground,
3677                                          pCD->matteBottomShadowPixmap);
3678    }
3679
3680} /* END OF FUNCTION ProcessClientResources */
3681
3682
3683
3684/*************************************<->*************************************
3685 *
3686 *  SetStdClientResourceValues (pCD)
3687 *
3688 *
3689 *  Description:
3690 *  -----------
3691 *  This function sets client resource data to standard values.  This setting
3692 *  is done in place of getting the values from the user settings in
3693 *  the resource database.
3694 *
3695 *  Input:
3696 *  -----
3697 *  pCD = pointer to the client data
3698 *
3699 *
3700 *  Output:
3701 *  ------
3702 *  pCD = (client data filled out with resource values)
3703 *
3704 *************************************<->***********************************/
3705
3706#ifdef _NO_PROTO
3707void
3708SetStdClientResourceValues (pCD)
3709        ClientData *pCD;
3710
3711#else /* _NO_PROTO */
3712void
3713SetStdClientResourceValues (ClientData *pCD)
3714#endif /* _NO_PROTO */
3715{
3716    pCD->clientDecoration = WM_DECOR_DEFAULT;
3717    pCD->clientFunctions = WM_FUNC_DEFAULT;
3718    pCD->focusAutoRaise = True;
3719    pCD->systemMenu = builtinSystemMenuName;
3720    pCD->usePPosition = USE_PPOSITION_NONZERO;
3721
3722} /* END OF FUNCTION SetStdClientResourceValues */
3723
3724
3725
3726/******************************<->*************************************
3727 *
3728 *  SetStdScreenResourceValues (pSD)
3729 *
3730 *
3731 *  Description:
3732 *  -----------
3733 *  This function sets screen resource data to standard values.  This setting
3734 *  is done in place of getting the values from the user settings in
3735 *  the resource database.
3736 *
3737 *  Input:
3738 *  -----
3739 *  pSD = pointer to the screen data
3740 *
3741 *
3742 *  Output:
3743 *  ------
3744 *  pSD = (screen data filled out with resource values)
3745 *
3746 ******************************<->***********************************/
3747
3748#ifdef _NO_PROTO
3749void
3750SetStdScreenResourceValues (pSD)
3751        WmScreenData *pSD;
3752
3753#else /* _NO_PROTO */
3754void
3755SetStdScreenResourceValues (WmScreenData *pSD)
3756#endif /* _NO_PROTO */
3757{
3758    pSD->buttonBindings = builtinButtonBindingsName;
3759    pSD->cleanText = True;
3760    pSD->iconDecoration =
3761                (ICON_LABEL_PART | ICON_IMAGE_PART | ICON_ACTIVE_LABEL_PART);
3762    pSD->iconPlacement =
3763                (ICON_PLACE_LEFT_PRIMARY | ICON_PLACE_BOTTOM_SECONDARY);
3764    pSD->keyBindings = builtinKeyBindingsName;
3765    pSD->limitResize = True;
3766    pSD->resizeCursors = True;
3767    pSD->transientDecoration = (WM_DECOR_SYSTEM | WM_DECOR_RESIZEH);
3768    pSD->transientFunctions =
3769                (WM_FUNC_ALL & ~(MWM_FUNC_MAXIMIZE | MWM_FUNC_MINIMIZE |
3770                                 MWM_FUNC_RESIZE));
3771    pSD->useIconBox = False;
3772
3773    pSD->feedbackGeometry = NULL;
3774    pSD->moveOpaque = False;
3775
3776} /* END OF FUNCTION SetStdScreenResourceValues */
3777
3778
3779/*************************************<->*************************************
3780 *
3781 *  GetHighlightGC (pSD, fg, bg, pixmap)
3782 *
3783 *
3784 *  Description:
3785 *  -----------
3786 *  Get a graphic context for either drawing top- or bottom-shadow
3787 *  highlights.
3788 *
3789 *
3790 *  Inputs:
3791 *  ------
3792 *  pSD = pointer to screen data
3793 *  fg = foreground color
3794 *  bg = background color
3795 *  pixmap = pixmap for highlight
3796 *
3797 *  Outputs:
3798 *  -------
3799 *  RETRUN = GC with the input parameters incorporated.
3800 *
3801 *************************************<->***********************************/
3802
3803#ifdef _NO_PROTO
3804GC GetHighlightGC (pSD, fg, bg, pixmap)
3805        WmScreenData *pSD;
3806        Pixel fg;
3807        Pixel bg;
3808        Pixmap pixmap;
3809
3810#else /* _NO_PROTO */
3811GC GetHighlightGC (WmScreenData *pSD, Pixel fg, Pixel bg, Pixmap pixmap)
3812#endif /* _NO_PROTO */
3813{
3814    XGCValues gcv;
3815    XtGCMask  mask;
3816
3817
3818    mask = GCForeground | GCBackground | GCLineWidth | GCFillStyle;
3819    gcv.background = bg;
3820    gcv.foreground = fg;
3821    gcv.line_width = 1;
3822
3823    if (pixmap)
3824    {
3825        mask |= GCFillStyle | GCTile;
3826        gcv.fill_style = FillTiled;
3827        gcv.tile = pixmap;
3828    }
3829    else
3830    {
3831        gcv.fill_style = FillSolid;
3832    }
3833
3834
3835    return (XtGetGC (pSD->screenTopLevelW, mask, &gcv));
3836
3837} /* END OF FUNCTION GetHighlightGC */
3838
3839
3840
3841/*************************************<->*************************************
3842 *
3843 *  _WmGetDynamicDefault (widget, type, defaultColor, newBackground, value)
3844 *
3845 *
3846 *  Description:
3847 *  -----------
3848 *  This function is used to generate a default color of the requested
3849 *  type.  Default colors are generated for a 3-D appearance.
3850 *
3851 *
3852 *  Inputs:
3853 *  ------
3854 *  widget = this is the widget that is associated with the resource or
3855 *           that is the reference widget for the wm subpart.
3856 *
3857 *  type = this is the type of color resource (e.g., top shadow color).
3858 *
3859 *  defaultColor = pointer to default color name/specification.
3860 *
3861 *  newBackground = background pixel for generating 3-D colors.
3862 *
3863 *
3864 *  Outputs:
3865 *  -------
3866 *  value = pointer to the XrmValue in which to store the color
3867 *
3868 *************************************<->***********************************/
3869
3870#ifdef _NO_PROTO
3871void
3872_WmGetDynamicDefault (widget, type, defaultColor, newBackground, value)
3873        Widget widget;
3874        unsigned char type;
3875        String defaultColor;
3876        Pixel newBackground;
3877        XrmValue *value;
3878
3879#else /* _NO_PROTO */
3880void
3881_WmGetDynamicDefault (Widget widget, unsigned char type, String defaultColor, Pixel newBackground, XrmValue *value)
3882#endif /* _NO_PROTO */
3883{
3884    static Screen *oldScreen = NULL;
3885    static Screen *newScreen;
3886    static Colormap oldColormap;
3887    static Colormap newColormap;
3888    static Pixel newValue;
3889    static Pixel background;
3890    static String oldDefaultColor = DEFAULT_COLOR_NONE;
3891    static XmColorData colorData;
3892
3893    /* initialize the return value */
3894
3895    value->size = sizeof (newValue);
3896    value->addr = (char *)&newValue;
3897
3898
3899    /*
3900     * Process monochrome defaults first.
3901     */
3902
3903    newScreen = XtScreen (widget);
3904
3905    if (Monochrome (newScreen))
3906    {
3907        if (type == WmFGC)
3908        {
3909            newValue = BlackPixelOfScreen (newScreen);
3910        }
3911        else if (type == WmBGC)
3912        {
3913            newValue = WhitePixelOfScreen (newScreen);
3914        }
3915        else if (type == WmTSC)
3916        {
3917            newValue = WhitePixelOfScreen (newScreen);         
3918        }
3919        else if (type == WmBSC)
3920        {
3921            newValue = BlackPixelOfScreen (newScreen);
3922        }
3923
3924        return;
3925    }
3926
3927
3928    /*
3929     * Check to see if appropriate colors are available from the
3930     * previous request; if the color is a background color then get
3931     * default colors.  Generate 3-D colors if necessary.  Maintain
3932     * new colors in static variables for later reuse.
3933     */
3934
3935    newColormap = widget->core.colormap;
3936
3937    if ((oldScreen != NULL) && (oldScreen == newScreen) &&
3938        (oldColormap == newColormap) && (type != WmBGC) &&
3939        (background == newBackground))
3940    {
3941    }
3942    else if ((oldScreen == newScreen) && (oldColormap == newColormap) &&
3943             (type == WmBGC) && (oldDefaultColor == defaultColor))
3944    {
3945    }
3946    else if (type == WmBGC)
3947    {
3948        /*
3949         * Find or generate a background color and associated 3-D colors.
3950         */
3951
3952        oldDefaultColor = defaultColor;
3953/*
3954 * Fix for CR 5152 - Due to the use of Realloc in the color caches,
3955 *                   a static pointer is not acceptable.  Change it
3956 *                   to a static structure to maintain the data
3957 */
3958        colorData = *_WmGetDefaultColors (newScreen, newColormap, defaultColor);
3959    }
3960    else
3961    {
3962        /*
3963         * Find or generate a color based on the associated background color.
3964         */
3965
3966        oldDefaultColor = DEFAULT_COLOR_NONE;
3967        background = newBackground;
3968
3969        colorData = *_XmGetColors (newScreen, newColormap, background);
3970       
3971    }
3972
3973    oldScreen = newScreen;
3974    oldColormap = newColormap;
3975
3976
3977    /*
3978     * Set up the return value.
3979     */
3980
3981    newValue =  _XmAccessColorData(&colorData, type);
3982
3983} /* END OF FUNCTION _WmGetDynamicDefault */
3984
3985
3986
3987/*************************************<->*************************************
3988 *
3989 *  _WmGetDefaultColors (screen, colormap, defaultColor)
3990 *
3991 *
3992 *  Description:
3993 *  -----------
3994 *  This function is used to find or generate default 3-D colors based on a
3995 *  default background color.
3996 *
3997 *
3998 *  Inputs:
3999 *  ------
4000 *  screen = screen for which colors are to be generated.
4001 *
4002 *  colormap = colormap that is to be used to make colors.
4003 *
4004 *  defaultColor = pointer to a default color name/specification.
4005 *
4006 *
4007 *  Outputs:
4008 *  -------
4009 *  RETURN = pointer to WmColorData structure containing 3-D colors.
4010 *
4011 *************************************<->***********************************/
4012
4013XmColorData * _WmGetDefaultColors (screen, colormap, defaultColor)
4014        Screen *screen;
4015        Colormap colormap;
4016        String defaultColor;
4017
4018{
4019    static XmColorData *defaultSet[2] = {NULL, NULL};
4020    static int defaultCount[2] = {0, 0};
4021    static int defaultSize[2] = {0, 0};
4022    int setId;
4023    register XmColorData *set;
4024    register int count;
4025    register int size;
4026    register int i;
4027    Display *display = DisplayOfScreen (screen);
4028    XColor colorDef;
4029
4030/*
4031 * Fix for CR 5152 - Due to the use of Realloc with _XmGetColors, it is
4032 *                   necessary to maintain a separate cache of color
4033 *                   data.  The Realloc may cause the data to be moved,
4034 *                   and the cache would contain pointers into the heap.
4035 */
4036
4037    /*
4038     * Look through the cache to see if the defaults are already in the
4039     * cache.  There is a list of cached defaults for each default color.
4040     */
4041
4042    if (defaultColor == _defaultColor2)
4043    {
4044        setId = 1;
4045    }
4046    else
4047    {
4048        setId = 0;
4049    }
4050
4051    set = defaultSet[setId];
4052    count = defaultCount[setId];
4053    size = defaultSize[setId];
4054   
4055    for (i = 0; i < count; i++)
4056    {
4057        if (((set + i)->screen == screen) && ((set + i)->color_map == colormap))
4058        {
4059            return (set + i);
4060        }
4061    }
4062
4063    /*
4064     * No match in the cache, make a new entry and generate the colors.
4065     */
4066
4067    if (count == size)
4068    {
4069        size = (defaultSize[setId] += 10);
4070        set = defaultSet[setId] =
4071                (XmColorData *)WmRealloc ((char *) defaultSet[setId],
4072                                    sizeof (XmColorData) * size);
4073    }
4074
4075    /*
4076     * Make the default background color for the resource set.
4077     */
4078
4079    if(!XParseColor (display, colormap, defaultColor, &colorDef))
4080    {
4081        if(!(strcmp(defaultColor, _defaultColor1)))
4082        {
4083            XParseColor (display, colormap, _defaultColor1HEX, &colorDef);
4084        }
4085        else
4086        {
4087            XParseColor (display, colormap, _defaultColor2HEX, &colorDef);
4088        }
4089    }
4090
4091    XAllocColor (display, colormap, &colorDef);
4092
4093
4094    /*
4095     * Generate the 3-D colors and save them in the defaults cache.
4096     */
4097
4098    set[count] = *_XmGetColors (screen, colormap, colorDef.pixel);
4099    (defaultCount[setId])++;
4100
4101    return (set + count);
4102
4103
4104} /* END OF FUNCTION _WmGetDefaultColors */
4105
4106
4107
4108/*************************************<->*************************************
4109 *
4110 *  WmRealloc (ptr, size)
4111 *
4112 *
4113 *  Description:
4114 *  -----------
4115 *  This function is used reallocate a block of storage that has been
4116 *  malloc'ed.
4117 *
4118 *
4119 *  Inputs:
4120 *  ------
4121 *  ptr = pointer to storage that is to be realloc'ed; if NULL malloc an
4122 *        initial block of storage.
4123 *
4124 *  size = size of new storage
4125 *
4126 *  Outputs:
4127 *  -------
4128 *  RETURN = pointer to realloc'ed block of storage
4129 *
4130 *************************************<->***********************************/
4131
4132char * WmRealloc (ptr, size)
4133        char *ptr;
4134        unsigned size;
4135
4136{
4137    if (ptr)
4138    {
4139        ptr = (char *)XtRealloc (ptr, size);
4140    }
4141    else
4142    {
4143        ptr = (char *)XtMalloc (size);
4144    }
4145
4146    if (ptr == NULL)
4147    {
4148        Warning ("Insufficient memory for window manager data");
4149    }
4150
4151    return (ptr);
4152
4153} /* END OF FUNCTION WmRealloc */
4154
4155
4156
4157/*************************************<->*************************************
4158 *
4159 *  WmMalloc (ptr, size)
4160 *
4161 *
4162 *  Description:
4163 *  -----------
4164 *  This function is used malloc a block of storage.  If a previous block
4165 *  of storage is being replace the old block is free'd.
4166 *
4167 *
4168 *  Inputs:
4169 *  ------
4170 *  ptr = pointer to storage that is to be replaced (free'd).
4171 *
4172 *  size = size of new storage
4173 *
4174 *  Outputs:
4175 *  -------
4176 *  RETURN = pointer to malloc'ed block of storage
4177 *
4178 *************************************<->***********************************/
4179
4180char * WmMalloc (ptr, size)
4181        char *ptr;
4182        unsigned size;
4183
4184{
4185    if (ptr)
4186    {
4187        XtFree (ptr);
4188    }
4189
4190    ptr = (char *)XtMalloc (size);
4191
4192    if (ptr == NULL)
4193    {
4194        Warning ("Insufficient memory for window manager data");
4195    }
4196
4197    return (ptr);
4198
4199} /* END OF FUNCTION WmMalloc */
4200
4201
4202
4203/*************************************<->*************************************
4204 *
4205 *  SetupDefaultResources (pSD)
4206 *
4207 *
4208 *  Description:
4209 *  -----------
4210 *  This function is used to setup default (builtin) resources for the
4211 *  key bindings.
4212 *
4213 *
4214 *  Inputs:
4215 *  ------
4216 *  pSD = pointer to screen data
4217 *  wmGD = (defaultKeyBindingsString, ...)
4218 *
4219 *  builtinKeyBindingsName = name of default key bindings set
4220 *
4221 *
4222 *  Outputs:
4223 *  -------
4224 *   None
4225 *
4226 *************************************<->***********************************/
4227
4228void
4229SetupDefaultResources (pSD)
4230
4231WmScreenData *pSD;
4232
4233{
4234    KeySpec *nextKeySpec;
4235    String keyBindings;
4236    MenuSpec *menuSpec;
4237
4238
4239/*
4240 * If (using DefaultBindings mechanism and bindings are not found in .mwmrc)
4241 *      then use the builtin bindings.
4242 */
4243    if (!pSD->keySpecs && !wmGD.useStandardBehavior)
4244    {
4245        /*
4246         * Print warning if user is NOT using "DefaultKeyBindings".
4247         */
4248        if (strcmp (pSD->keyBindings, defaultKeyBindingsName))
4249        {
4250            MWarning("Key bindings %s not found, using builtin key bindings\n",
4251                     pSD->keyBindings);
4252        }
4253        pSD->keyBindings = builtinKeyBindingsName;
4254    }
4255
4256    if (!pSD->buttonSpecs && !wmGD.useStandardBehavior)
4257    {
4258        /*
4259         * Print warning if user is NOT using "DefaultButtonBindings".
4260         */
4261        if (strcmp (pSD->buttonBindings, defaultButtonBindingsName))
4262        {
4263            MWarning("Button bindings %s not found, using builtin button bindings\n",
4264                     pSD->buttonBindings);
4265        }
4266        pSD->buttonBindings = builtinButtonBindingsName;
4267    }
4268
4269    if (pSD->keyBindings == builtinKeyBindingsName)
4270    {
4271        /*
4272         * Default key specifications are to be used and no default
4273         * set has been provided by the user.  Make the built-in default
4274         * set.
4275         */
4276
4277        ParseKeyStr (pSD, (unsigned char *)builtinKeyBindings);
4278    }
4279    else
4280    {
4281        /*
4282         * Add the switch behavior key binding to the front of the list
4283         * of user specified key bindings that have been parsed.
4284         */
4285
4286        nextKeySpec = pSD->keySpecs;
4287        keyBindings = pSD->keyBindings;
4288        pSD->keyBindings = behaviorKeyBindingName;
4289        pSD->keySpecs = NULL;
4290
4291        ParseKeyStr (pSD, (unsigned char *)behaviorKeyBindings);
4292
4293        if (pSD->keySpecs)
4294        {
4295            /* Skip past the TWO key definitions (1.2 & 1.1.4) */
4296            pSD->keySpecs->nextKeySpec->nextKeySpec = nextKeySpec;
4297        }
4298        else
4299        {
4300            pSD->keySpecs = nextKeySpec;
4301        }
4302        pSD->keyBindings = keyBindings;
4303    }
4304
4305    if (pSD->buttonBindings == builtinButtonBindingsName)
4306    {
4307        /*
4308         * Default button specifications are to be used and no default
4309         * set has been provided by the user.  Make the built-in default
4310         * set.
4311         */
4312
4313        ParseButtonStr (pSD, (unsigned char *)builtinButtonBindings);
4314    }
4315
4316    /*
4317     * Set defaultSystemMenuUseBuiltin to FALSE if DefaultWindowMenu spec
4318     * is found.
4319     */
4320
4321    menuSpec = pSD->menuSpecs;
4322    while ( menuSpec )
4323    {
4324        if (!strcmp(menuSpec->name, defaultSystemMenuName))
4325        {
4326                pSD->defaultSystemMenuUseBuiltin = FALSE;
4327                break;
4328        }
4329        menuSpec = menuSpec->nextMenuSpec;
4330    }
4331
4332} /* END OF FUNCTION SetupDefaultResources */
4333
4334
4335
4336/*************************************<->*************************************
4337 *
4338 *  SimilarAppearanceData (pAD1, pAD2)
4339 *
4340 *
4341 *  Description:
4342 *  -----------
4343 *  This function returns True if the two passed sets of AppearanceData
4344 *  are similar. This is designed to compare appearance data before
4345 *  creation of the GCs.
4346 *
4347 *
4348 *  Inputs:
4349 *  ------
4350 *  pAD1        pointer to AppearanceData 1
4351 *  pAD2        pointer to AppearanceData 2
4352 *
4353 *
4354 *  Outputs:
4355 *  -------
4356 *  Function returns True if similar, False otherwise.
4357 *
4358 *  Comments:
4359 *  ---------
4360 *  This function is only used to compare the client
4361 *  and client*title appearance data.
4362 *************************************<->***********************************/
4363
4364#ifdef _NO_PROTO
4365Boolean SimilarAppearanceData (pAD1, pAD2)
4366
4367        AppearanceData *pAD1, *pAD2;
4368#else /* _NO_PROTO */
4369Boolean SimilarAppearanceData (AppearanceData *pAD1, AppearanceData *pAD2)
4370#endif /* _NO_PROTO */
4371{
4372    Boolean rval;
4373
4374    /*
4375     * !!! Should find out why all the Pixmap resources are unset !!!
4376     */
4377
4378    if ((pAD1->fontList == pAD2->fontList) &&
4379        (pAD1->background == pAD2->background) &&
4380        (pAD1->foreground == pAD2->foreground) &&
4381        (pAD1->backgroundPStr == pAD2->backgroundPStr) &&
4382        (pAD1->bottomShadowColor == pAD2->bottomShadowColor) &&
4383        (pAD1->bottomShadowPStr == pAD2->bottomShadowPStr) &&
4384        (pAD1->topShadowColor == pAD2->topShadowColor) &&
4385        (pAD1->topShadowPStr == pAD2->topShadowPStr) &&
4386        (pAD1->activeBackground == pAD2->activeBackground) &&
4387        (pAD1->activeForeground == pAD2->activeForeground) &&
4388        (pAD1->activeBackgroundPStr == pAD2->activeBackgroundPStr) &&
4389        (pAD1->activeBottomShadowColor == pAD2->activeBottomShadowColor) &&
4390        (pAD1->activeBottomShadowPStr == pAD2->activeBottomShadowPStr) &&
4391        (pAD1->activeTopShadowColor == pAD2->activeTopShadowColor) &&
4392        (pAD1->activeTopShadowPStr == pAD2->activeTopShadowPStr) )
4393    {
4394        rval = True;
4395    }
4396    else
4397    {
4398        rval = False;
4399    }
4400
4401    return (rval);
4402
4403} /* END OF FUNCTION SimilarAppearanceData */
4404
Note: See TracBrowser for help on using the repository browser.