Merge branch 'master' of https://git.code.sf.net/p/cdesktopenv/code
[oweals/cde.git] / cde / programs / dtsession / Srv.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: Srv.h /main/6 1996/09/25 08:32:34 barstow $ */
24 /*                                                                      *
25  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
26  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
27  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
28  * (c) Copyright 1993, 1994 Novell, Inc.                                *
29  */
30 /*************************************<+>*************************************
31  *****************************************************************************
32  **
33  **  File:        Srv.h
34  **
35  **  Project:     HP DT Style Manager (part of the session manager)
36  **
37  **  Description:
38  **  -----------
39  **
40  **
41  *******************************************************************
42  **  (c) Copyright Hewlett-Packard Company, 1990.  All rights are  
43  **  reserved.  Copying or other reproduction of this program      
44  **  except for archival purposes is prohibited without prior      
45  **  written consent of Hewlett-Packard Company.                     
46  ********************************************************************
47  **
48  **
49  **
50  *****************************************************************************
51  *************************************<+>*************************************/
52 /*  Standard C headers  */
53 #include <stdio.h>
54
55 #ifdef _AIX
56 #include <sys/types.h>
57 #include <sys/dir.h>
58 #else
59 #include <dirent.h>
60 #include <limits.h>
61 #endif /* _AIX */
62
63 /*  Dt header  */
64 #include <Dt/UserMsg.h>
65
66 /*  Xm headers  */
67 #include <Xm/ColorObjP.h>
68
69 /* #defines */
70
71 #define NUM_OF_COLORS        8
72 #define MAX_NUM_SCREENS      6
73
74 /* defines for foreground colors */
75 #define DYNAMIC    0
76 #define BLACK      1
77 #define WHITE      2
78
79 #define PALETTE_SUFFIX     ".dp"
80
81 #define B_O_W   "BlackWhite"
82 #define W_ONLY  "White"
83 #define W_O_B   "WhiteBlack"
84 #define B_ONLY  "Black"
85
86 /*
87  * macro to get message catalog strings
88  */
89 #ifndef NO_MESSAGE_CATALOG
90 # ifdef __ultrix
91 #  define _CLIENT_CAT_NAME "dtsession.cat"
92 # else  /* __ultrix */
93 #  define _CLIENT_CAT_NAME "dtsession"
94 # endif /* __ultrix */
95 extern char *_DtGetMessage(char *filename, int set, int n, char *s);
96 # define GETMESSAGE(set, number, string)\
97     (_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
98 #else
99 # define GETMESSAGE(set, number, string)\
100     string
101 #endif
102
103 /*******************************************************************************
104  * Color Palette data structures
105  *
106  ******************************************************************************/
107
108 /*
109 **  Define a colorset as foreground, background, topshadow, bottomshadow
110 **  and selectcolor (also known as arm color).
111 */
112 typedef struct _colorset {
113     XColor fg;
114     XColor bg;
115     XColor ts;
116     XColor bs;
117     XColor sc;
118 } ColorSet;
119
120 typedef struct _hsv {
121     int hue;
122     int saturation;
123     int value;
124 } HSVset;
125
126 /*
127 **  Structure which stores the palettes for the customizer
128 */
129 typedef struct _palette {
130       char *name;
131       char *directory;
132       int num_of_colors;
133       ColorSet color[XmCO_MAX_NUM_COLORS];
134       short defaultActive;
135       short defaultInactive;
136       short defaultPrimary;
137       short defaultSecondary;
138       short defaultRoot;
139       char *converted;
140       unsigned long converted_len;
141       struct _palette *prev;
142       struct _palette *next;
143 } palettes;
144
145 /****** Global Variables ********/
146
147 typedef struct {
148    int                TypeOfMonitor[MAX_NUM_SCREENS];
149    int                FgColor[MAX_NUM_SCREENS];
150    Bool               UsePixmaps[MAX_NUM_SCREENS];
151    Bool               DynamicColor[MAX_NUM_SCREENS];
152    int                NumOfScreens;
153    Atom               XA_CUSTOMIZE[MAX_NUM_SCREENS];
154    Atom               XA_PIXEL_SET;
155    Atom               XA_PALETTE_NAME;
156    Atom               XA_TYPE_MONITOR;
157    Atom               XA_UPDATE;
158    struct _palette    *pCurrentPalette[MAX_NUM_SCREENS];
159 } ColorSrv;
160 extern ColorSrv colorSrv; /* defined in SrvPalette.c */
161
162 #define MAX_STR_LEN   128
163
164 /*
165  *  Wrappers for system calls
166  */
167 #define     SRV_MALLOC(SIZE)         XtMalloc(SIZE)
168 #define     SRV_REALLOC(PTR, SIZE)   XtRealloc(PTR, SIZE)
169 #define     SRV_FREE(PTR)            XtFree(PTR)
170 #define     SRV_EXIT(STATUS)         exit(status)